Consider it an opportunity to refactor the code. Chances are that at
some time while you were writing the code originally you thought of a
way to make it better/simpler or faster, and if you're looking for the
source you probably want to change it anyway, so re-write.
I know it sounds harsh, but I have been there all too often..and there
are disassemblers that will get you back to assembly code and even
some decompilers but what you get back will NEVER be your code. Any
comments you included will be completely lost and your loops will
quite possibly be of a diffferent form than you wrote and any nice
numbers #defines would be now expanded though out your code and any
numerical computations which could have been done at compile time was
already done and won't be undone so if you had:
#define MIN_PER_YEAR =3D 365 * 24 + 60
...
...
/* iteratorate though the year in seconds */
for ( i =3D 0 ; i < MIN_PER_YEAR * 60 ; i++ )
do_x_with_y(i);
You could possibly end up with=20
i =3D 31536000 ;
while ( i )=20
do_x_with_y(i--);
Or possibly much less readable... did I mention that while you should
be able to get global and static variables names back due to the
linking creating references to them...any and all local variable names
WILL be lost as they are all translated into internal address offsets.
So, save yourself the heart ache and re-write, unless you wanted to
learn assembly.
-Robert
On 6/28/05, Tim Whitehouse <TJW...@bl...> wrote:
> I was "experimenting" with options with my g++ compiler when I accidenta=
lly
> have lost my .cc file. I have the .o file. Is there any way to turn the
> object code back into the source code?
|