![]() |
binary to C (gcc GNU/Linux compiled machine code)
Hi groupies,
Any program for GNU out there that basically converts the machine code generated by GCC back to C? Tried searching the group, could not find anything. Basically, in a nutshell, I wrote a C program under GNU/Linux a few years ago using standard C libraries to boot. And compiled it, but lost the source code to the program. Now, all I have left is a Fedora 5 binary! I want my source code back because it was during deep hacking on the code that I found the solution to the problem, and I do not think I could write the source again. Its impossible. I just need my original C code back. Any help? |
Re: binary to C (gcc GNU/Linux compiled machine code)
On 01/ 9/11 05:08 PM, catcalls wrote:
> Hi groupies, > > Any program for GNU out there that basically converts the machine code > generated by GCC back to C? No. There isn't a two way translation between executables and C. > I just need my original C code back. > > Any help? Backups! -- Ian Collins |
Re: binary to C (gcc GNU/Linux compiled machine code)
On Jan 9, 4:14*am, Ian Collins <ian-n...@hotmail.com> wrote:
> On 01/ 9/11 05:08 PM, catcalls wrote: > > > Hi groupies, > > > Any program for GNU out there that basically converts the machine code > > generated by GCC back to C? > > No. There isn't a two way translation between executables and C. > > > I just need my original C code back. > > > Any help? > > Backups! > > -- > Ian Collins Oh, I was taking regular backups to my website. But, shortly after finishing the code and releasing the binaries on-line, my computer crashed hard. It was a nightmare. Just thankful that I have working binaries after all these years. Btw...I also have a Windows binary if there is a program for Windows that converts machine code to C? It's standard C so I thought that it wouldn't be a problem converting back? |
Re: binary to C (gcc GNU/Linux compiled machine code)
On Jan 9, 4:23*am, catcalls <obrzut.a...@gmail.com> wrote:
> On Jan 9, 4:14*am, Ian Collins <ian-n...@hotmail.com> wrote: > > > > > On 01/ 9/11 05:08 PM, catcalls wrote: > > > > Hi groupies, > > > > Any program for GNU out there that basically converts the machine code > > > generated by GCC back to C? > > > No. There isn't a two way translation between executables and C. > > > > I just need my original C code back. > > > > Any help? > > > Backups! > > > -- > > Ian Collins > > Oh, I was taking regular backups to my website. But, shortly after > finishing the code and releasing the binaries on-line, my computer > crashed hard. It was a nightmare. Just thankful that I have working > binaries after all these years. > > Btw...I also have a Windows binary if there is a program for Windows > that converts machine code to C? It's standard C so I thought that it > wouldn't be a problem converting back? http://www.hex-rays.com/decompiler.shtml See, I found this program. But, I was wondering if there is a GNU version? For GCC compiled code? |
Re: binary to C (gcc GNU/Linux compiled machine code)
On 2011-01-09, catcalls <obrzut.alex@gmail.com> wrote:
> Any program for GNU out there that basically converts the machine code > generated by GCC back to C? Short answer: Yes. Equally good short answer: No. > Tried searching the group, could not find anything. That's because gcc-specifically, it's not topical here. Generically, it's mostly not possible. > I want my source code back because it was during deep hacking on the > code that I found the solution to the problem, and I do not think I > could write the source again. Its impossible. I'd guess you could. > I just need my original C code back. If you didn't compile with full debugging symbols, you are probably screwed. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! I am not speaking for my employer, although they do rent some of my opinions. |
Re: binary to C (gcc GNU/Linux compiled machine code)
On 1/8/2011 9:27 PM, catcalls wrote:
> http://www.hex-rays.com/decompiler.shtml > > See, I found this program. But, I was wondering if there is a GNU > version? For GCC compiled code? If there is one, I'd like to see how it works on the average K&R2 problem, as shown on the wiki. -- Uno |
Re: binary to C (gcc GNU/Linux compiled machine code)
On Sun, 2011-01-09, Ian Collins wrote:
> On 01/ 9/11 05:08 PM, catcalls wrote: >> Hi groupies, >> >> Any program for GNU out there that basically converts the machine code >> generated by GCC back to C? > > No. There isn't a two way translation between executables and C. Well, there *is*, but the C code wouldn't look anything like what he originally wrote. It would look more like the source for an x86 (or whatever architecture he used) emulator. There might exist such a program ... but the audience would be very small and so would the benefits. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Re: binary to C (gcc GNU/Linux compiled machine code)
catcalls <obrzut.alex@gmail.com> writes:
> Any program for GNU out there that basically converts the machine code > generated by GCC back to C? > > Tried searching the group, could not find anything. > > Basically, in a nutshell, I wrote a C program under GNU/Linux a few > years ago using standard C libraries to boot. And compiled it, but > lost the source code to the program. Now, all I have left is a Fedora > 5 binary! > > I want my source code back because it was during deep hacking on the > code that I found the solution to the problem, and I do not think I > could write the source again. Its impossible. > > I just need my original C code back. Too much information is lost during compilation for it to be possible, even theoretically, to get your original C code back from an executable. (Well, a compiler could maintain enough information in the generated executable to allow this, but in practice they don't.) For example, compilation (and linking) will almost certainly lose the names of any identifiers that aren't externally visible, and may lose the externally visible ones as well. A for loop and a while loop might result in identical machine code; there's no way to tell which one was originally written. And if the code was compiled with optimization, it's likely to be mangled beyond recognition. It's like reconstructing a raw egg from an omelette. It's certainly possible, given an executable, to generate a C program that has the same behavior, but it's not at all likely to be legible or maintainable. -- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" |
Re: binary to C (gcc GNU/Linux compiled machine code)
In message <a8205ee1-e2b0-4745-8ace-d555413bb564@s9g2000vby.googlegroups
..com>, catcalls <obrzut.alex@gmail.com> writes >Hi groupies, > >Any program for GNU out there that basically converts the machine code >generated by GCC back to C? > >Tried searching the group, could not find anything. > >Basically, in a nutshell, I wrote a C program under GNU/Linux a few >years ago using standard C libraries to boot. And compiled it, but >lost the source code to the program. Now, all I have left is a Fedora >5 binary! > >I want my source code back because it was during deep hacking on the >code that I found the solution to the problem, and I do not think I >could write the source again. Its impossible. > >I just need my original C code back. > >Any help? You don't say what the target MCU/CPU is or if it runs on an OS/RTOS There are tools that help automate the process but nothing that is fully automatic. Unless you had all the debug information compiled in you will have to manually name all the variables. Due to optimisation etc within the compiler and linker you will never get back to the original source code. Especially as GCC is not ISO-C I have tools that can do some of the work but it is only a semi automatic process. It is probably far better to start again. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
Re: binary to C (gcc GNU/Linux compiled machine code)
On Jan 9, 9:54*am, Chris H <ch...@phaedsys.org> wrote:
> In message <a8205ee1-e2b0-4745-8ace-d555413bb...@s9g2000vby.googlegroups > .com>, catcalls <obrzut.a...@gmail.com> writes > > > > >Hi groupies, > > >Any program for GNU out there that basically converts the machine code > >generated by GCC back to C? > > >Tried searching the group, could not find anything. > > >Basically, in a nutshell, I wrote a C program under GNU/Linux a few > >years ago using standard C libraries to boot. And compiled it, but > >lost the source code to the program. Now, all I have left is a Fedora > >5 binary! > > >I want my source code back because it was during deep hacking on the > >code that I found the solution to the problem, and I do not think I > >could write the source again. Its impossible. > > >I just need my original C code back. > > >Any help? > > You don't say what the target MCU/CPU is or if it runs on an OS/RTOS > > There are tools that help automate the process but nothing that is fully > automatic. > > Unless you had all the debug information compiled in you will have to > manually name all the variables. > > Due to optimisation etc within the compiler and linker you will never > get back to *the original source code. Especially as GCC is not ISO-C > > I have tools that can do some of the work but it is only a semi > automatic process. *It is probably far better to start again. > > -- > \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ > \/\/\/\/\ Chris Hills *Staffs *England * * /\/\/\/\/ > \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Thanks for all the replies. I guess I should just be thankful that I have working binaries for Windows and GNU. At least I can use the programs as I intended them to be used ~ but ~ for how long? |
| All times are GMT. The time now is 11:08 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.