Is there a C++ decompiler?

C++Reverse EngineeringDecompiling

C++ Problem Overview


I have a program in which I've lost the C++ source code. Are there any good C++ decompilers out there?

I've already ran across Boomerang.

C++ Solutions


Solution 1 - C++

You can use IDA Pro by Hex-Rays. You will usually not get good C++ out of a binary unless you compiled in debugging information. Prepare to spend a lot of manual labor reversing the code.

If you didn't strip the binaries there is some hope as IDA Pro can produce C-alike code for you to work with. Usually it is very rough though, at least when I used it a couple of years ago.

Solution 2 - C++

information is discarded in the compiling process. Even if a decompiler could produce the logical equivalent code with classes and everything (it probably can't), the self-documenting part is gone in optimized release code. No variable names, no routine names, no class names - just addresses.

Solution 3 - C++

Yes, but none of them will manage to produce readable enough code to worth the effort. You will spend more time trying to read the decompiled source with assembler blocks inside, than rewriting your old app from scratch.

Solution 4 - C++

I haven't seen any decompilers that generate C++ code. I've seen a few experimental ones that make a reasonable attempt at generating C code, but they tended to be dependent on matching the code-generation patterns of a particular compiler (that may have changed, it's been awhile since I last looked into this). Of course any symbolic information will be gone. Google for "decompiler".

Solution 5 - C++

Depending on how large and how well-written the original code was, it might be worth starting again in your favourite language (which might still be C++) and learning from any mistakes made in the last version. Didn't someone once say about writing one to throw away?

n.b. Clearly if this is a huge product, then it may not be worth the time.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBryan DennyView Question on Stackoverflow
Solution 1 - C++David HolmView Answer on Stackoverflow
Solution 2 - C++Dustin GetzView Answer on Stackoverflow
Solution 3 - C++m_pGladiatorView Answer on Stackoverflow
Solution 4 - C++FerruccioView Answer on Stackoverflow
Solution 5 - C++harriyottView Answer on Stackoverflow