unable to disassemble to source

Ralf Corsepius corsepiu at faw.uni-ulm.de
Thu Jan 8 12:56:11 UTC 2004


On Thu, 2004-01-08 at 06:49, durai wrote:
> Hi ralf,
> Could you please tell me the reason why it cant be done?
I think there is a miscommunication. 

It depends on how to read your question.

If you mean "decompilation", i.e. generating code from an object file,
this in general is not possible, because object files do not contain
enough information to achieve this task. This is a general issue in CS
and can not be generally solved at all, it is just impossible, because
compilation is a "one-way"/unidirectional process, which loosed
information that would be required for "decompilation". This is the
topic I was referring to.

There exist some tools which can extract some "human readable" (c-) code
from some subset of specialized object-files using heuristics, however
the code these tools generate in 99% of all case has almost nothing in
common with the actual original code.

Normally disassembly generates human readable asm-instructions from the
actual binary machine-language contained inside of object files. This is
just a primitive 1-to-1 translation, and not a "sophisticated
interpretation"

What you seem to have in mind is a tool to expand "simple disassembly"
into some "annotated disassembly" by using the debug info contained in
object files, similar to what source level debuggers (gdb) do at run
time. AFAIK, this is what objdump -S does.
However, this requires the access to the sources and the object files to
be specially prepared (compiled with debugging information, unstripped),
and isn't actual "decompilation".

> This is built with -g option enabled.
> also when I tried
> "mips-rtems-objdump -S -g hello.exe"  it throws an error
> mips-rtems-objdump: hello.exe.img: no recognized debugging information
Well, this error is clear: objdump doesn't recognize the file type :)

It is hard to tell what actually goes wrong without knowing how
hello.exe has exactly been generated.
In general, I'd say objdump is in trouble identifying the file type and
might require additional options. However, objdump complaining about
"hello.exe.img" looks suspicious. This could indicate that hello.exe
might have been processed in way such that objdump might get confused.

Ralf





More information about the users mailing list