BoomerangDecompiler / boomerang

Boomerang Decompiler - Fighting the code-rot :)
Other
372 stars 59 forks source link

Is Boomerang Output Compilable #223

Open humanitiesclinic opened 5 years ago

humanitiesclinic commented 5 years ago

Is Boomerang Output Compilable? If no, is the output still standard C, and which version of the standard does it follow, if yes? Also, how can I manually make the decompiled code compilable and make sure the new executable does the same thing as the original one (not necessarily make it exactly the same binary, just perform the same thing / have the same effect, maybe with some performance differences.)

Will be nice if there was a tutorial for this, which will also be useful for someone who is not really interested in compiling back the decompiled code, as they can use it to understand the differences between compilable C and the decompiled code.

humanitiesclinic commented 5 years ago

Any suggestions?

ceeac commented 5 years ago

No, the output of Boomerang is generally not compilable, except for some trivial corner cases. You can have a look at the output of Boomerang for some simple programs in the tests/regression-tests/expected-outputs/ directory. Think of it as pseudo-code that happens to be close to C (for some definition of "close").

As for correctness, this is currently not extensively tested. The best way to approach this is using a disassembly viewer and the decompiler output side-by-side and refactoring the decompiler output into compilable C while watching out for semantic differences between disassembly and decompiler output. Boomerang currently does not have a disassembly viewer so you have to use external tools for that. In any case, lots of manual labour will be required.