cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/14/16:34:42

Message-ID: <3304CFDE.1632@pobox.oleane.com>
Date: Fri, 14 Feb 1997 21:49:34 +0100
From: Francois Charton <deef AT pobox DOT oleane DOT com>
Organization: CCMSA
MIME-Version: 1.0
To: Alan Wilson <alan DOT wilson AT wilshire DOT com>
CC: djgpp AT delorie DOT com
Subject: Re: Quake Editing Utilites
References: <2 DOT 2 DOT 32 DOT 19970214182748 DOT 006b01bc AT delilah>

Alan Wilson wrote:
> 
> 
> It's not possible to take the files you have now and decompile them back to
> the source???  Or once it is compiled and linked, there's no way to get back
> the source?
> 

Going back to the source is theoretically feasible for some part: you can 
get from machine code to ASM, and then to C; but you will lose some 
information, like function/variable names which are destroyed during 
compilation. Also, the code->source correspondance is not one to one: 
several C programs will yield the same machine code. 

However, it is always possible to write some C program, which compiles 
into the same code (provided you use the same compiler).

A few years ago, I did that for Wolfenstein-3d, and decompiled a large 
part of the executable. When Id relased the source to it, I was able to 
cross check it and see my decompiled C code was basically right.

However, this was pretty easy because it was compiled with BorlandC, 
which is a dumb, not much optimising, compiler... Just looking at the 
asm, guessing the C behind was fairly easy : there was one simple wat the 
compiler coded "for()" loops, another on for switch(), still another for 
do while, etc...

With djgpp, I suspect this would be a bit harder, because it uses much 
more elaborate optimisation schemes (try compiling some large program 
with the "dump" options of gcc to see how complex it can be...). On the 
other hand, the source is available, so it can help reversing the 
compilation process.

Moreover, decompiling by hand is a tedious task... And on large 
executables, it can be a *very* long job. What would be interesting would 
be to develop tools for this. I don't know any good programs for this. If 
anyone wants to start such a project, I'd be very happy to contribute.

Francois

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019