CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2003
    Posts
    13

    Unhappy compiled code --> source code???

    hi,
    i accidentally erased a rather important source code file (simple text file created with vi on a linux machine) but luckily compiled it beforehand.

    is it possible to take a compiled program and get back the original (or nearly original) source code text?

    thanks!

    -R.G.

  2. #2
    Join Date
    Apr 2003
    Posts
    13

    addendum

    i'm using the "cc" compiler in linux to compile my programs.
    -R.G.

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Take a look at this thread...

  4. #4
    Join Date
    Apr 2003
    Posts
    13

    ok

    hi,
    thanks for the link to that thread. i did read it and found it interesting. so are you recommending that i get that program "ice" or whatever it's called?
    -R.G.

  5. #5
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443

    Re: ok

    Originally posted by robgramer
    hi,
    thanks for the link to that thread. i did read it and found it interesting. so are you recommending that i get that program "ice" or whatever it's called?
    -R.G.
    Before spending your money on SoftIce, take the time and read that thread. It is not possible to reverse engineer a C++ program. No tool on this planet is able to take a compiled file and to re-create the C++ code for it.

    In your case, it is much less expensive to re-write the code than to try to reverse engineer the image.
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  6. #6
    Join Date
    Apr 2003
    Posts
    13

    thanks

    ok, thanks. i'm writing in just C actually, but it seems that what you've said applies to C as well. yeah, i'm definitely not going to buy a program like softice. i am just a beginning programmer who made a mistake of deleting a file and was curious if there was an easy fix to getting my source code back.
    thanks again for the help.
    -R.G.

  7. #7
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443

    Re: thanks

    Originally posted by robgramer
    ok, thanks. i'm writing in just C actually, but it seems that what you've said applies to C as well. yeah, i'm definitely not going to buy a program like softice. i am just a beginning programmer who made a mistake of deleting a file and was curious if there was an easy fix to getting my source code back.
    thanks again for the help.
    -R.G.
    I've heard that there are some tools that reverse images to C, but I've also heard that the produced code is practically un-readable. In other words, not worth the effort. For the sake of completeness, I must say that I never used such a tool, so my information is not "first hand".

    Sorry that you've lost the code, I know how frustrating that is. I wish you good luck in re-writing it
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  8. #8
    Join Date
    Apr 1999
    Posts
    27,449

    Re: thanks

    Originally posted by robgramer
    ok, thanks. i'm writing in just C actually, but it seems that what you've said applies to C as well. yeah, i'm definitely not going to buy a program like softice. i am just a beginning programmer who made a mistake of deleting a file and was curious if there was an easy fix to getting my source code back.
    thanks again for the help.
    -R.G.
    Maybe when you rewrite it, the program will be better than the first version

    Regards,

    Paul McKenzie

  9. #9
    Join Date
    Apr 1999
    Location
    Altrincham, England
    Posts
    4,470
    Doesn't linux have a recycle bin that you can retrieve accidentally deleted files from?
    <sarcasm>And there was me believing all that stuff about how Linux does everything so much better than Windows </sarcasm>
    Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
    --
    Sutter and Alexandrescu, C++ Coding Standards

    Programs must be written for people to read, and only incidentally for machines to execute.

    --
    Harold Abelson and Gerald Jay Sussman

    The cheapest, fastest and most reliable components of a computer system are those that aren't there.
    -- Gordon Bell


  10. #10
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725
    Well, I use gnome on my Linux boxes, and if I
    delete using the window manager, it goes to
    my trash folder. If I remove from a terminal it
    doesn't (but I don't think Windows does either).

    And with daily/weekly backups from my raid 5 system
    to another raid 5 system located about 75 miles
    away, its pretty difficult for me to lose much data !

  11. #11
    Join Date
    Apr 2003
    Posts
    13

    deleting files

    unfortunately i deleted the file from the command prompt in linux so it's deleted in the full sense of the word i think.
    if i had done this in windows (even in DOS), the file wouldn't have been erased, only its reference in the File Allocation Table if I remember correctly. And there are many programs that can "un-delete" files (you simply lose the first character of the file name for some reason).

    -R.G.

  12. #12
    Join Date
    Apr 2003
    Location
    Morelia, Mexico
    Posts
    40
    I've heard of an undelete tool for Linux, try searching freshmeat.net
    int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
    o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured