Debugging DOS as a 32-bit x86 build program

Many of you may recall the old DOS debugging program. Despite being outdated in many respects, one of the nice things is that you could easily find the byte sequence for a given instruction without having to go through the steps of writing a program, compiling, disassembling, examining the contents of a file, ... Enter a command, and then enter the address of the instruction . "debug", unfortunately, does not execute 32-bit instructions.

Does anyone know a tool that does something similar for x86 32-bit instructions? I do not want to go through the whole compilation process; I just need to be able to enter a few instructions and output the length of the instruction and its byte sequence.

+6
assembly debugging
source share
2 answers

DOS debug was an interactive assembler as well as a debugger, introducing assembly code, which led to the fact that this line is immediately converted to machine code - this is what you dumped.

So, all you need to do is automate your favorite assembler with a script or batch file.

Here's the bash function that I came with in a minute or two using the popular nasm assembler:

 opcode() { echo $* > tmp.S && nasm tmp.S -o tmp.o && od -x tmp.o rm -f tmp.o tmp.S } 

takes less than a second. The call is as follows:

 $ opcode mov eax, [ebx] 0000000 6667 038b 0000004 $ opcode fadd st0,st1 0000000 c1d8 0000002 

Not brilliant, but you can tweak the command line for better output. This idea should work with any command line assembler while you tell it to use a simple binary output format.

+4
source share

There are some simple, 32-bit command line debuggers. Based on your description, OllyDbg may well suit your needs. At least some versions of Microsoft Debugging Tools for Windows include one of the named CDBs that stands for Commandline DeBugger (although I have not yet confirmed that the associated version includes it ...)

+1
source share

All Articles