Operating System debugger for Ubuntu 11.10

2019-08-23 06:57发布

问题:

I've been doing operating system development (not building a Linux kernel), and have gotten to the point where I need a debugger, for my latest OS. I've tried Bochs (under my Win 7 partition), but that wouldn't recognize my USB (It's unformatted, I'm reading specific sectors right now.) and I would rather do something under Ubuntu 11.10.

Is there a Debugger that would let me debug a custom build OS for Ubuntu 11.10?

回答1:

Personally, I use QEMU for debugging a custom OS (which has USB support).

Run QEMU as follows for a debugging session:

qemu -S -s [more options here]
  • -S tells QEMU to not start the cpu. This gives you time to set breakpoints etc.
  • -s is a shortcut for -gdb tcp::1234 which start a gdbserver at TCP port 1234.

Then connect GDB to QEMU:

$ gdb
(gdb) target remote localhost:1234

From that point, you can use the normal GDB commands.