assemblyx86gdbx86-16protected-mode

GDB realmode to protected mode, on the fly disassamble


I'm trying to debug a piece of MBR code, with some context switch in it. I have the asm layout set up by default with 16bit disassambled instructions.

My problem appears when I make a context to protected mode, in wich case the instructions in the asm window will go nuts / senseless (the processor will still run the correct instructions ofc).

I know about the set architecture i8086/i386 command. But they work only before I connect to the virtual machine. I can't change the architecture "on the fly".

Note: I'd like to make context switches back & forth, so I need to see the correct instructions.

All in all is it possible to switch the architecture & refresh the instructions in the asm windows? (with some strange command? strange workaroud?)


Solution

  • Okay, figured out myself at the end.

    No magic is needed ...

    The architecture needs to be set up first:

    set arch i8086 / set arch i386 (...)
    

    then the disassemble command should be used on a specific function/address range:

    disassemble 0x7c00, +100