有 C++ 反编译器吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/205059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a C++ decompiler?
提问by Bryan Denny
采纳答案by David Holm
You can use IDA Proby Hex-Rays. You will usually not get good C++ out of a binary unless you compiled in debugging information. Prepare to spend a lotof manual labor reversing the code.
您可以通过Hex-Rays使用IDA Pro。除非您在调试信息中进行编译,否则您通常不会从二进制文件中获得好的 C++。准备花费大量的体力来逆向代码。
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.
如果您没有剥离二进制文件,那么 IDA Pro 可以生成类似 C 的代码供您使用,这是有希望的。但通常它非常粗糙,至少当我几年前使用它时。
回答by Dustin Getz
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.
信息在编译过程中被丢弃。即使反编译器可以生成具有类和所有内容的逻辑等效代码(它可能不能),自文档部分在优化的发布代码中消失了。没有变量名,没有例程名,没有类名——只有地址。
回答by m_pGladiator
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.
是的,但他们都不会设法产生足够可读的代码来值得付出努力。与从头开始重写旧应用程序相比,您将花费更多时间尝试读取带有汇编程序块的反编译源代码。
回答by Ferruccio
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".
我还没有看到任何生成 C++ 代码的反编译器。我见过一些实验性的,它们对生成 C 代码进行了合理的尝试,但它们往往依赖于匹配特定编译器的代码生成模式(这可能已经改变,自从我上次研究这个已经有一段时间了)。当然,任何符号信息都会消失。谷歌搜索“反编译器”。
回答by harriyott
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?
根据原始代码的大小和编写得有多好,可能值得用您最喜欢的语言(可能仍然是 C++)重新开始,并从上一版本中的任何错误中吸取教训。不是有人说过要写一个扔掉吗?
n.b. Clearly if this is a huge product, then it may not be worth the time.
nb 显然,如果这是一个巨大的产品,那么它可能不值得花时间。