Anonymous user
Kernel Debugging: Difference between revisions
→Use gdb with Qemu
[unchecked revision] | [unchecked revision] |
Line 57:
This is however rather tricky, since it requires additional hardware, and special support coded into your kernel. You might want to read the [http://web.archive.org/web/20070415113206/http://www.kernelhacking.org/docs/kernelhacking-HOWTO/indexs09.html kernel hacking how-to] and (at minimum) [http://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Debugging.html#Remote-Debugging chapter 20 of the GDB manual], and chances are likely that your debugger will introduce even more bugs at first.
== Use gdb with
You can run
qemu -s -S <harddrive.img>
...will setup
gdb
Line 70:
(Replace localhost with remote IP / URL if necessary.) Then start execution:
But that's not all, you can compile your source code under
objcopy --only-keep-debug kernel.elf kernel.sym
Line 84:
To produce a flat binary which can be debugged using the previously extracted debug information
You can import the symbols in
(gdb) symbol-file kernel.elf ;kernel.elf is the actual unstripped kernel image in this case
From there, you can see the actual C source code as it runs line per line! (Use the stepi instruction in
Example :
Line 115:
(gdb) info registers
I won't start explaining all the nice things about
== GUI frontends ==
|