www.digitalmars.com [Home] [Search] [CTG] [RTL] [IDDE]

Last update Jan 29, 2003


OBJ2ASM: Object File Disassembler

OBJ2ASM disassembles object (.obj) files in Intel OMF or Microsoft COFF format. (DMC++ generates Intel OMF format object files.) Looking at the assembly language output of the compiler is highly useful for:

Compiling the file with the -gl option embeds line number information in the object file, enabling OBJ2ASM to match the source code up with the generated assembler instructions. Compiling the file with the -g option embeds debug records in the object file, which OBJ2ASM will format and output.

OBJ2ASM commands have the following format:

	obj2asm [-l -o -x] objectfile[.obj] [sourcefile] [-coutfile[.cod]]
objectfile is the object file to disassemble.
The extension defaults to .obj.
sourcefile is the file compiled to produce the object file.
Use this if the source file name embedded in the object file is missing or incorrect.
-l Omit code labels in the assembly language file it generates.
Useful when comparing two object files; helping highlight the differences between them.
-o Emit object code for each assembly language instruction.
-x Emit code segment offset for each instruction.
-coutfile Writes output to outfile instead of the standard output.
The default extension for outfile is .cod.
Example

To see the code generated by compiling test.cpp, use the following commands:

	sc -c -gl test
	obj2asm test
Note: Although the output of OBJ2ASM is in MASM format, it usually requires a little editting before MASM will accept it.
Copyright © 1995-2001 Digital Mars. All Rights Reserved.