|
Any decompiler experts out there? |
Bob Keane
Member #7,342
June 2006
|
I was curious about decompilers, so I got this from github: After fumbling around I thought I figured it out. So I wrote a simple "Hello World" project, compiled and decompiled it. I assumed I would get something similar to this: #include <stdio.h> #include <stdlib.h> int main() { printf("Hello world!\n"); return 0; } but got the attached, too long for code tags. Are my expectations wrong or is this over my head? By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
jmasterx
Member #11,410
October 2009
|
Well if you think your computer is executing 4 lines of code to print text to the screen you're mistaken hahah. You're going to get a disassembly of all the statically linked machine code in the executable. This includes a bunch of stuff that's inline from the c standard library. Probably if you play with the compiler optimization flags and other stuff you can significantly thin down your output. But you're going to get all the static linked symbols too, and all the crap needed to enter your main function using winapi. Agui GUI API -> https://github.com/jmasterx/Agui |
bamccaig
Member #7,536
July 2006
|
Are you particularly attached to Reko? It sounds like there are better alternatives (but there are limitations to decompiling C). There is no pure decompiled C, like you're suggesting. It's not like compiled Java or .NET, where the original code can be pulled out. P-Code is the best you're going to get, and IDA's Hexrays is the best at it. But, for a cost. Hopper's p-code is decent, usable, but makes some really weird guesses. RetDec and Snowman are the other two. RetDec has a plugin for Binary Ninja. And there are many Snowman plugins, including for x64dbg. You'll sometimes have to switch between RetDec and Snowman to get the better results, but IDA's are almost always the best.
-- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Bob Keane
Member #7,342
June 2006
|
JMasterx said: Well if you think your computer is executing 4 lines of code to print text to the screen you're mistaken hahah. I expected a lot of unfamiliar code knowing something about how the precompiler works with #include. However, the only statement I recognized was the return at the end. Bamccaig said: Are you particularly attached to Reko? It sounds like there are better alternatives (but there are limitations to decompiling C). I'm just trying out decompilers for fun, I'm not attached to any yet. By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
jmasterx
Member #11,410
October 2009
|
Maybe look into what they used https://github.com/n64decomp/sm64 Agui GUI API -> https://github.com/jmasterx/Agui |
Chris Katko
Member #1,881
January 2002
|
-----sig: |
Edgar Reynaldo
Major Reynaldo
May 2007
|
If you want to learn how to decompile code go the other way around. Compile simple C++ code into assembly, and then study the assembly. You will learn to recognize basic constructs almost immediately. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Chris Katko
Member #1,881
January 2002
|
yeah, by clicking my link -----sig: |
Simon Parzer
Member #3,330
March 2003
|
Use IDA Pro. |
|