If we would write some code in rust, compile it to, for example, x86_64. And then de-compile it to C. It would be perfectly memory-safe C code, right?
As Rust is llvm based, you don't need to compile it to C. Just write a backend that translates LLVM IR to C instead of x86_64. The IR is very C looking, it's probably overly complex.
Compiling down to asm, lot of information is lost regarding memory layout etc, so it's not the best source for generating code.
If we would write some code in rust, compile it to, for example, x86_64. And then de-compile it to C. It would be perfectly memory-safe C code, right?
As Rust is llvm based, you don't need to compile it to C. Just write a backend that translates LLVM IR to C instead of x86_64. The IR is very C looking, it's probably overly complex. Compiling down to asm, lot of information is lost regarding memory layout etc, so it's not the best source for generating code.
How about this for an idea: a decompiler that uses Machine Learning to name the decompiled variables and functions. Would be nice even if it worked only sometimes.
Something very similar: a "decompiler" that decompiles minified javascript and guesses variables and functions: http://www.jsnice.org/
How about this for an idea: a decompiler that uses Machine Learning to name the decompiled variables and functions. Would be nice even if it worked only sometimes.
It's also something that could be somewhat easy to get a lot of learning material for.
Yes, but the problem is learning through the graph data. I.e., it is not a well-structured problem like an image which will always have a certain size in pixels. Coming from a compiler background I am genuinely excited about the research on learning how to label nodes and edges in graphs, but I know little about the challenges in the ML side to bring this kind of technology into reality.
The main website seems to be dead, and there are no examples of its output.
A shame. My understanding is this was state of the art, for a free and open source decompiler. Of course, times change and AFAICT Ghidra has taken up that mantle.
I'm surprised to hear that, I thought retdec was pretty well regarded.
If we would write some code in rust, compile it to, for example, x86_64. And then de-compile it to C. It would be perfectly memory-safe C code, right?
As Rust is llvm based, you don't need to compile it to C. Just write a backend that translates LLVM IR to C instead of x86_64. The IR is very C looking, it's probably overly complex. Compiling down to asm, lot of information is lost regarding memory layout etc, so it's not the best source for generating code.
A shame. My understanding is this was state of the art, for a free and open source decompiler. Of course, times change and AFAICT Ghidra has taken up that mantle.
I'm surprised to hear that, I thought retdec was pretty well regarded.
Good point. I don't mean this as a slight against retdec. Simply, retdec was proprietary for quite a while, and it escaped my mind.
retdec haven't tagged (or built) a release in a couple years, unfortunately, but there is recent activity on their repo.
How about this for an idea: a decompiler that uses Machine Learning to name the decompiled variables and functions. Would be nice even if it worked only sometimes.
It's certainly possible - Compile all the C projects on github with `gcc -O0`. Map statements, blocks, or functions to ASM output. Put everything in a giant SQL. Repeat for all of gcc's compiler flags.
Wait, did I say it was possible? I'm curious what a neural netted compiler would produce. Probably your average CRUD software.