Why i cant convert executable file back to C source code?
Why i cant convert executable file back to C source code?
Other urls found in this thread:
because fuck you, learn how compiling works
because multiple C codes can produce the same executable
Why i can't fly by flapping with my arms?
There are no symbols in compiled code.
If you don't have them enabled for debugging, any way.
A single C program can become different executables too...
to a big degree you can, debug symbols are magic
>There are no symbols in compiled code.
dwarfstd.org
please read to the end of the post next time
A lot of information (like non external variable names and type info) is discarded unless compiled with debugging symbols enalbed and not all transformations done in optimization passes in the compiler are reversable.
no
>why cant I covert poo back into curry, sir
Converting disassembly into IDA C-like pseuodcode is the best you will get. Read some papers on decompilation and understand why binary code analysis is a hard problem.
because the process is reversible, technically, mathematically, but the information needed to reverse it is usually not preserved. learn to use compiler flags and then you might preserve that information
How? When compiled for different CPUs or there are other instances when compiled on the same machine?
When compiled with different compilers, or even the same compiler with different flags.
That still doesn't prevent decompilation. It just won't be very readable output.
That's not the point, it seems OP is asking about recovering the original source code from an executable.
Why can't I convert digested nutrients back into the source food?
>Why i cant convert executable file back to C source code?
Was the question. A lack of symbols does not really affect this, only the legibility. That's a separate question.
Still not the original code, you seemed to have missed the "back" part. Also, not the same user btw
That doesn't imply the same source. There isn't a 1:1 mapping in either direction. When you say "I want my money back!" you're not implying the exact same bills and coins.
>How?
Do you know what "optimization" is?
Even if you don't, just sprinkel some NOP's in there and the resulting machine code instructions will be different.
I'll add that this doesn't take into account undefined behavior in the source code, which will obviously be implementation specific.
Why can't I reduce a cake back to it's ingredients?
>food analogy
this
Your compiler is not injective. You might be able to recover the logic of the code but you will never recover variable names or comments.
IMAGINE BEING AT COMPUTERS
food analogies are perfect, as are poop ones, because everyone needs to eat and poop
don't let your hateboner for inflation man tell you otherwise
very deep and profound sir. now i understand
You can but it's gonna be hard to read since you don't have symbols names, comment and original control flow
>everyone needs to eat
Stars don't eat, and they are far larger, far more complex, and live much much longer than you or any organic life ever will.
Organic life sucks dick.
because you fuckwit dont know shit about computers
>, far more complex,
No
Seconding Tons of computer stuff is metaphors
>codes
hi rajeem
There are decompilation tools, but they are far from perfect, and they will always generate unreadable slop that is almost guaranteed to not be the same as the code as the executable was compiled with. It is also possible that that same code, when recompiled, will not produce the same binary. It's just that when executed, it will produce the same inputs, and same outputs (unless it had a race condition, of course).
Compilation removes a lot of useful information, like comments, macros, variable names, and what files everything belonged to. Optimization can remove even more useful information, such as even how many variables were used in a function (why touch the stack when you can just re-use registers?), or it might generate instructions that don't quite have a proper analog in C (like rotating shifts or floating point vector operations). It may inline code that was originally a function on its own.
We can also say that compilation is a mapping of:
>One or more source code files
>A linker script (maybe)
>A compiler and its configuration flags
to
>A single executable
While de-compilation is a mapping of:
>An executable
to
>A single source file
So some information is guaranteed to be lost, all else considered.
You can