3 ms·
the easiest way I found was to attach gdb to qemu (since you're normally running the OS in an emulator). there are instructions for how to do this in a comment
by jvns 11y ago
the easiest way I found was to attach gdb to qemu (since you're normally running the OS in an emulator). there are instructions for how to do this in a comment on this blog post: http://jvns.ca/blog/2013/12/04/day-37-how-a-keyboard-works/ http://jvns.ca/blog/2013/12/04/day-37-how-a-keyboard-works/
here are the instructions:
> Sam Rose Julia Evans • 2 years ago
> If you haven't yet experienced the joys of remote debugging with QEMU and gdb, you should totally try it out.
> Run qemu with the flag "-monitor stdio" and that should give you a terminal into QEMU. Then in that terminal, run "gdbserver" and it'll open up a gdb server on port 1234.
> Then, in another terminal, open gdb and run "target remote :1234" to connect to the gdbserver running in qemu.
> At first you'll find that gdb has no fucking idea what's going on. This is because it has no symbol data, so you'll need to load your kernel binary into it with the "file" command.
> After loading your kernel symbol table, you should be free to roam around the inside of your kernel using gdb as normal. If gdb isn't familiar to you, I personally really enjoyed Beej's Quick Guide to GDB: http://beej.us/guide/bggdb/ http://beej.us/guide/bggdb/ (pretty much everything by