Page 2 of 2

Re: Qemu vs Bochs+gdb vs Bochs internal debugger

Posted: Mon Oct 05, 2015 9:33 am
by Kevin
bscreator wrote:So GDB only have problems if you change your processor mode, for example switching 16-32Bit, switching Real-/Protected Mode, is this correct ?
This is what I remember, yes.
You need GDB for debugging in QEMU. Or is there another way for debugging/setting breakpoints in QEMU ?
It depends on what you call "debugging". The qemu monitor (accessed with Ctrl-Alt-2) allows some inspection of the VM, including CPU state, memory dumps, TLB contents and some devices. It doesn't allow setting breakpoints or singlestepping or things like that.

You can, however, set a breakpoint in gdb and when that breakpoint stops the VM, you can inspect it both in gdb and in the qemu monitor. Generally, if you want to debug your kernel on a source code level, you'll want to do that in gdb, but if you're interested in machine state, you'll do it in the qemu monitor.

Re: Qemu vs Bochs+gdb vs Bochs internal debugger

Posted: Mon Oct 05, 2015 7:23 pm
by FallenAvatar
bscreator wrote:- I start Bochs with debugger and always have to manually set a breakpoint to specific memory places, like 0x7C00. Is there an "automatically" way to say Bochs when it starts, that it has to set an breakpoint at 0x7C00? Maybe in some kind of script ?

Code: Select all

xchg bx, bx
Should cause Bochs to break on that line. Not 100% sure if there is a config setting needed.

- Monk

Re: Qemu vs Bochs+gdb vs Bochs internal debugger

Posted: Mon Oct 05, 2015 7:46 pm
by BASICFreak
tjmonk15 wrote:
bscreator wrote:- I start Bochs with debugger and always have to manually set a breakpoint to specific memory places, like 0x7C00. Is there an "automatically" way to say Bochs when it starts, that it has to set an breakpoint at 0x7C00? Maybe in some kind of script ?

Code: Select all

xchg bx, bx
Should cause Bochs to break on that line. Not 100% sure if there is a config setting needed.

- Monk
Yes there is a config setting:
magic_break: enabled=1

And for E9 Hack:
port_e9_hack: enabled=1

Re: Qemu vs Bochs+gdb vs Bochs internal debugger

Posted: Wed Oct 07, 2015 1:01 am
by bscreator
To everyone of you : Thank you very much for your help ! =D> =D> =D>