digitalmars.com                        
Last update Sun Sep 8 21:42:02 2013

OBJ2ASM: Object File Disassembler

obj2asm disassembles object (.obj) files in Intel OMF, Microsoft COFF format, Linux ELF or Mac OS X Mach-O format, and writes out the corresponding assembler source code. (dmc++ generates Intel OMF format object files.)

Both 16 and 32 bit Intel x86 instruction sets are supported.

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.

Syntax

obj2asm commands have the following format:

obj2asm [-l -o -x] objectfile[.obj] [sourcefile] [-coutfile[.cod]]
Obj2asm Arguments
Arguments Description
objectfile the object file to disassemble. The extension defaults to .obj
sourcefile 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 generated. 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 write 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:

dmc -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.

File Formats Supported

Getting Obj2asm

obj2asm comes as part of the C/C++ Development System or the Extended Utility Package.

Home | Runtime Library | IDDE Reference | STL | Search | Download | Forums