Remote debugging with gdb: debugging a kernel with qemu

1. in one terminal, run
#qemu -no-kqemu -m 64 -fda ./floppy.img -s -S
[floppy.img contains kernel.bin which is loaded by GRUB]

2. in other terminal, run
#gdb ./kernel.bin
[kernel.bin is an ELF executable]

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()

(gdb) break _start
Note: breakpoint -1 also set at pc 0x1208a0.
Breakpoint 1 at 0x1208a0

(gdb) c
Stopped due to shared library event


3. Enjoy from here!

No comments: