Need help debuging i386 in real mode.

David Daney ddaney@avtrex.com
Mon Mar 26 05:55:00 GMT 2007


Develop.ReactOS wrote:
> Hello:
>     I am trying to debug i386 in real mode. How to disassemble 16-bit code?
>     gdb appears to always assume a 32-bit segment.Is there a way to coerce gdb into 16-bit disassembly mode?  Is there some other tool or cmd I could use?  
>
> I need 16-bit disassembly instruction,but gdb's output is wrong:
> (gdb) x /10i $eip+$cs*16
> 0xffff0:        ljmp   0x3131,0xf000e05b
> 0xffff7:        das
> 0xffff8:        xor    BYTE PTR [ecx],dh
> 0xffffa:        das
> 0xffffb:        xor    BYTE PTR [esi],dh
> 0xffffd:        add    ah,bh
> 0xfffff:        test   DWORD PTR [eax],0x0
> 0x100005:       add    BYTE PTR [eax],al
> 0x100007:       add    BYTE PTR [eax],al
> 0x100009:       add    BYTE PTR [eax],al
>
>   
I have not tested it, but it looks like the GNU binutils objdump program
can do it. If you can get an image of the memory area you want to
disassemble into a file try something like:

objdump --target=binary --architecture=i8086 --disassemble-all
memory_image_filename

David Daney



More information about the Gdb mailing list