Is there a C++ decompiler? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
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.

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.

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.

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.

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".

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.

Related

What are the compromises with using Xojo for cross platform development? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Much of the cross-platform development topics on SO seems to be 6 to 9 years old. Anyone have recent experience with Xojo? Can it be used to quickly deploy UI on top of C++ generated linked libraries on macOS and Windows? How does that work on iOS? What are the limitations of this tool?
I have no experience with iOS deployment with Xojo but used Xojo for quite a few x-platform projects (Mac/Win/Linux) where I also access self-written C code, in iBored for instance.
Overall, I like Xojo better than Qt or Java for designing and deploying apps with a GUI. Xojo adheres closer to the UI specifics, IMHO. You'll have a harder time finding help, however, since the community is rather small.
To access C++ code you need to write yourself a C-level layer because Xojo does not provide an easy way to link to and use C++ objects. But interfacing plain function in any library (.dylib, .dll, .so) is super easy, and mainly involves writing the Xojo equivalent of a function declaration, and possibly add some structure definitions as well. You can pass all the simple datatypes (Int in all sizes, float, double, C and Pascal strings, even access raw memory via pointers) but will have to provide accessor functions for more complex data structures (array, dicts etc.) as Xojo's object manangement does not mix with that of C++ or other runtimes.
Xojo has been around for nearly 20 years now (formerly known as REALbasic) and is decent enough to rely on it.
OTOH, Xojo is closed source, and the company is rather slow (or even unable / unwilling) to fix issues - and you can't fix them yourselves, obviously. I had more than one case where I figured out how to fix a bug in their binary code, and they wanted to prohibit me from doing that, threatening to invalidate my license, while also not committing to providing a fix. If that worries you, I advise you to stay away from Xojo.

Options for hot deployment [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
My requirement is to seamlessly hot deploy code update to a running service without losing the current status, including collection data. Is there any c++ framework out there I can use to develop such a solution?
You probably should read some research papers on dynamic software updating, e.g. on Kitsune (which you might use)
There is a major issue about updating the call stack (and instances in local variables); read also about continuations; and you might have some special case (if your application is event loop driven like most GUI applications are, you probably want to update the code outside of event handlers).
You certainly should think of dynamic software update very early in your design. Perhaps some terminology and concepts from garbage collection & persistence & serialization techniques are relevant.
Your requirement (to seamlessly hot deploy code update to a running service without losing the current status) is very hard and will need a lot of work (probably years) and is still a difficult & interesting research topic (definitely it is a good PhD subject).
You might want to use your own meta-programming techniques, that is generate most of the relevant C+++ support code by your own code generators.
If you already have a significant code base, you could consider customizing a recent GCC compiler with MELT (e.g. to query the compiler's internal representations and generate some code from them) -but even that means a lot of work-
PS. Coding in something better than C++, like Erlang or Common Lisp, would make your goal less difficult.

How can I make C++ in C? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Well, i was learning, again, a little bit of c and was with a little curious about how did the C++ inventor made it. And some facts lead me to the information, that he created it using pure C(obviously), so i was thinking if there is any source or anything that could help me to do things in C, that i can do in C++, like templates, namespace, class, reference and others it doesn't matter how difficult it is, i want to at least have more notion, so if anyone know a reliable source and well written i would be glad.
Yes, many, many years back, the first C++ compiler, by Bjarne Stroustrup was a "frontend for a C compiler".
Today, it certainly isn't anywhere like that. Modern C++ compilers generate code directly from C++ constructs in intermediate form for the backend to process into machine code for the target. This allows the compiler to do a more direct job, and not rely on the C compiler "understanding" what is going on.
This page contains some reference material on the cfront:
http://www.softwarepreservation.org/projects/c_plus_plus/index.html#cfront
That page also has links for the 3.0.3 archived sources as unpacked and compressed form.
Note however that this release is 21.5 years old, and would thus, if it was a person be able to order alcohol in a US Bar after showing ID. This is NOT the modern standard C++ by any measure (and it may or may not generate code that is suitable for a modern C compiler, I have no idea)
With this quote to go with the 3.0 release from 1991:
Bjarne Stroustrup notes, "A warning that Cfront 3 is pre-standard and
emphatically not recommended for use or further development might be
in place."
Edit:
I did download the code in the (compressed) link above. It certainly doesn't compile on Linux without effort. More effort than I am willing to spend, really. One of the problems is that it's pre-ANSI C, so the compile complains about various functions not being declared (for example strcpy, strcat, etc), and there are OS choices, none of which is Linux.
I also don't think it is necessarily the best place to start learning compiler techniques.

What tool can decompile a DLL into C++ source code? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have an old DLL that stopped working (log2vis.dll) and I want to look inside it to see what objects it uses.
The DLL was written in C++ (not .NET). Is there a tool that will decompile/disassemble C++ files?
This might be impossible or at least very hard. The DLL's contents don't depend (a lot) on it being written in C++; it's all machine code. That code might have been optimized so a lot of information that was present in the original source code is simply gone.
That said, here is one article that goes through a lot of material about doing this.
Hex-Rays decompiler is probably the best in this field !!!
I think a C++ DLL is a machine code file. Therefore decompiling will only result in assembler code. If you can read that and create C++ from that you're good to go.
There are no decompilers which I know about.
W32dasm is good Win32 disassembler.
There really isn't any way of doing this as most of the useful information is discarded in the compilation process. However, you may want to take a look at this
site to see if you can find some way of extracting something from the DLL.
The closest you will ever get to doing such thing is a dissasembler, or debug info (Log2Vis.pdb).

Exception analysis tool for C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I've been looking for a tool to extract exception information from a C++ program. The most wanted feature I'm looking for: I want to know all the exceptions that can be thrown from a function (which would include all the function that is called from that function recursively).
I've always thought that documenting errors and exceptions in particular is very hard (and takes a lot of effort to keep up to date). But if there is some way to automate that, it would be very helpful.
A tool for windows and Visual Studio would be preferred but not necessary, I could always work around that.
PC-Lint claims to do static exception analysis of C++ code.
Coverity is another static C++ code analysis tool that apparently informs you of unhandled exceptions.
AQtime claims to have exception tracing as part of its code analysis. Plus, they advertise Visual Studio integration.
Here is a list of several static code analysis tools.
DISCLAIMER: Working on this tool is my day job.
Its hard for me to write this without it looking like a sales pitch, so I apologise in advance.
As well as other analysis, QA C++ outputs the list of types that are thrown from the body of functions and the call tree. I believe that this would be all the information that you require.
EDoC++ (http://edoc.sourceforge.net) is another alternative.