java - Decompile C code with debug info? -
java , python byte code relatively easy decompile compiled machine code generated c/c++ compiler.
i unable find convincing answer why information -g option insufficient de-compilation, sufficient debugging? stuff contained in python/java byte code, makes decompilation easy?
i unable find convincing answer why information -g option insufficient de-compilation, sufficient debugging?
the debugging information contains mapping between addresses in generated code , source files line numbers. debugger not need decompile code - shows original sources. if source files missing, debugger won't magically show them.
that said, presence of debugging info make decompilation easier. if debug info includes layout of used types , function prototypes, decompiler can use , provide more precise decompilation. in many cases, however, still different original source.
for example, here's function decompiled hex-rays decompiler without using debug info:
int __stdcall sub_4050a0(int a1) { int result; // eax@1 result = a1; if ( *(_byte *)(a1 + 12) ) { result = sub_404600(*(_dword *)a1); *(_byte *)(a1 + 12) = 0; } return result; }
since not know type of a1
, accesses fields represented additions , casts.
and here's same function after symbol file has been loaded:
void __thiscall mytree::write_page(mytree *this, page *src) { if ( src->ischanged ) { cache::set_changed(this->cache, src->baseaddr); src->ischanged = 0; } }
you can see it's been improved quite lot.
as why decompiling bytecode easier, in addition npe's answer check this.
Comments
Post a Comment