Trouble Debugging xv6 Kernel with QEMU and Eclipse on Ubuntu: GDB Connection Issues

74 Views Asked by At

I'v a macbook pro 2018, 6-core Intel Core i7, ubuntu 20.04. I am attempting to debug the xv6 OS kernel using QEMU and Eclipse on Ubuntu, but I'm encountering issues with setting up the GDB connection. Here's what I've done so far:

I have xv6 and QEMU installed on my Ubuntu system. The xv6 project is located at /home/user/xv6

I start QEMU with the following command to run the xv6 kernel and wait for a GDB connection:

qemu-system-i386 -nographic -drive file=fs.img,index=1,media=disk,format=raw -drive file=xv6.img,index=0,media=disk,format=raw -smp 2 -m 512 -S -gdb tcp::26000

In Eclipse, I've set up a debug configuration for a C/C++ Remote Application. I have specified localhost for the host and 26000 for the port, intending to connect to QEMU's built-in GDB server.

When I start the debug session in Eclipse, QEMU is running and awaiting a GDB connection. However, I encounter an error message in Eclipse's console:

gdbserver  :26000 /home/user/xv6/kernel;exit

user@ubuntu:~/eclipse$ gdbserver  :26000 /home/user/xv6/kernel;exit 

Process /home/user/xv6/kernel created; pid = 28590
Listening on port 26000
Remote debugging from host 127.0.0.1, port 51590
gdbserver: Unexpected missing AT_PHDR and/or AT_PHNUM: phdr_memaddr = 0, phdr_num = 3
Killed
logout

I have confirmed that the kernel file is an ELF 32-bit LSB executable with debug information. I also made sure there are no multiple instances of gdbserver or QEMU running.

Could someone guide me on what might be going wrong with my setup or suggest steps to successfully debug the xv6 kernel with QEMU and Eclipse?

0

There are 0 best solutions below