Breaking on start of MBR
Hello,
I'm trying to use QEMU step through some MBR assembly code by using gdb remotely, and I can't figure out where to set the breakpoint. I know that on a native PC the MBR code gets relocated to 0x7c00, but that didn't work when running through QEMU. I'm using the -S switch to stop the emulator at the beginning. How would you guys do it?
Cheers,
J.
Hi,
Quoted 5 lines · Jan Rupar
I'm trying to use QEMU step through some MBR assembly code by using gdb remotely, and I can't figure out where to set the breakpoint. I know that on a native PC the MBR code gets relocated to
0x7c00, but that didn't work when running through QEMU. I'm using the -S switch to stop the emulator at the beginning. How would you guys do it?
I'd do the following: start QEmu itself in gdb, breakpoint at raw_read(), let QEmu run until the sector_num == 0, and then set the current env's singlestep_enabled member to 1.
You might have to recompile the code after adjusting it a bit (for example to get the current env, or to go into an if() clause when sector_num == 0).
Hth,
Dscho