How to do source level debugging of x86 code with GDB inside QEMU?

后端 未结 3 961
青春惊慌失措
青春惊慌失措 2021-01-05 22:37

I wrote a x86 assembly program for MBR section. I compile it as follows:

nasm hellombr.asm -f bin -o hellombr.img

Then I run it in qemu:

3条回答
  •  伪装坚强ぢ
    2021-01-05 23:03

    Instead of using qemu, use bochs. It is completely compatible, albeit slower. It is also an emulator but if you make it from sources, using these flags and build it like this:

    ./configure --enable-debugger --enable-disasm --disable-docbook
    make
    make install
    

    you can place breakpoints in your code, step through it, view GDT, IDT and everything you needed to know.

提交回复
热议问题