开发者

Is it possible to convert PPC Assembly to C?

i have some PPC code that i want to convert back into its original C code, is there a way to do this? Possibly a person (such as somebody who knows PPC to reconst开发者_JS百科ruct the C code?) or a program?


Yes and no.

It is possible in principle to translate a program in any language to any other language. The results will not be pretty.

If the existing code really is the result of a compilation without too much clever optimization, then it is likely that a fairly rote process can turn it back to C. This is often straightforward to do by hand for small amounts of code, but tedious and error prone for large code bases.

There are some reverse engineering tools out there in the wild that make claims about decompilation. It isn't an easy problem in the general case.

One approach to automating the problem is to create a PPC assembly (or even binary) front-end for a compiler that already supports a C language back-end. The result is a cross-compiler that reads PPC code and produces highly obfuscated C code. I know there is a C back-end for GCC, for instance.

Regardless of the approach you take, it will likely be critical that you have a good test suite (and the ability to run it) for the existing binary so that you have a means of proving that the translation is equivalent.

Edit: Note that you will never get the original comments back, and will only have access to original variable and function names that made it into a symbol table or similar debug information.


IDA Pro 6.95 includes PPC decompiler. But it is bit costy ($2350)


Boomerang claims to support PPC decompilation.


No. Not ever. Decompiling is not the same as getting c back. You can never get c back. You can try reverse engineer it, try to understand what it is doing, but some information is permanently lost.

This is from boomerang project:

However, a general decompiler does not attempt to reverse every action of the decompiler, rather it transforms the input program repeatedly until the result is high level source code. It therefore won't recreate the original source file; probably nothing like it.

So it creates some C code that could be (but will never know) the C source.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜