Monday, January 5, 2009

Re-creating source code, Part 5

So, looking at the previous example, it's obvious that decompiling is a lot harder than disassembly.

So, it would be stupid (or really masochistic) to try to decompile a big program. Like a compiler.

But, before I got the source code to DeSmet C, I tried just that. Ran the compiler (at least the 1st pass of the compiler) through a disassembler, and went in and started decompiling.

This took me a few months of spare time. In the end, I had a decompiled compiler, but there was too much ambiguity (like unknown variable names -- even badly named variables are much better documentation than no names at all) to be of any use. Oh, well...

Fortunately, I did track down the source code sometime later, and had the toy I wanted. Almost...

I had the source code to a later version of the compiler. And later means more features and bug fixes. This is good.

But, I've also learned that you don't change compilers (or even compiler versions) unless you have a good reason to do so.

Most of my early code was in an earlier version, and since it worked, I kept on using it. And this was not the version I had the source to. This is not so good.

But then I had an idea. I'll talk about it next time.

No comments: