[Home]
[Search]
[CTG]
[RTL]
[IDDE]
Last update Jun 3, 2003
OBJ2ASM: Object File Disassembler
OBJ2ASM disassembles object (.obj) files in Intel OMF, Microsoft
COFF format, or linux ELF format.
(DMC++ generates Intel OMF format object files.)
Looking at the assembly language output of the compiler is highly useful
for:
- Understanding how various language constructs are compiled.
- Trying various ways of expressing an algorithm to see which
ones produce faster code.
- If a particular function needs to be rewritten in inline
assembly and hand optimized for maximum speed, the
OBJ2ASM output forms a good starting point.
- Due to the large number of function calling conventions
supported, sometimes it is necessary to verify that the
correct convention is being used.
- Verifying correct code generation.
- Comparing output with other compilers.
- Learning assembly language.
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.