Live data from Hacker News

Snowman native code to C/C++ decompiler for x86/x86_64/ARM

github.com

1–10 of 40 posts

Re: Snowman native code to C/C++ decompiler for x86/x86_64/ARM

#3
post #2

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?

I would guess that writing a decompiler that gets c semantics 100% correct is also really hard. Think about inline assembly, memory barriers, etc.

I don't think this would work, unless the c file just contains inline assembly.

Re: Snowman native code to C/C++ decompiler for x86/x86_64/ARM

#8
post #2

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?

Some architectural/program assumptions may not be encoded in assembly or preserved in the asm -> C -> asm roundtrip, especially if the assemblers are for different architectures. The obvious example is pointer word size and memory model.

Re: Snowman native code to C/C++ decompiler for x86/x86_64/ARM

#9
post #8
post #2

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?

Some architectural/program assumptions may not be encoded in assembly or preserved in the asm -> C -> asm roundtrip, especially if the assemblers are for different architectures. The obvious example is pointer word size and memory model.

Rust might work reasonably well though, given its compiled with llvm. If not, I'm sure whatever asm structures llvm outputs for rust all have C equivalents.

I'd be curious to see the output! It'd be funny decompiling the rust compiler to C, then running it on another platform that way. (Though it would still be, for example, an x86 rust compiler running on arm).

Re: Snowman native code to C/C++ decompiler for x86/x86_64/ARM

#10
post #7

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.
Post reply on HN