Thursday, January 05, 2006

There Be Dragons

It's 4 AM, and the night is still and quiet. I'm sitting in front of my computer, lit by the pale light of the LCD screen, and I'm losing my mind.

My life for the past several days (excluding the New Year's) has been no different than tonight. Thinking, coding, debugging, debugging, debugging, ...

I'm working on an embedded environment project for my diploma thesis. I have infinite power over the computer, my software need not obey anyone's laws. Except my own, which I have to keep in my head at all times. Can't write them down, they're changing too swiftly. It's hard, and it's fun. The most challenging part is that I have to be aware of the entire picture, down to the every detail. From the overall design, down to the stack allocation and word width issues.

And it gets ugly. I'm using some 3rd party components (like libc), which aren't exactly bug-free. Just a few minutes ago, after a few hours of poking around in my code (debugger? what debugger? I'm lucky I have printf() :-) I've traced the error to strdup() and malloc() implementations. Great.. So, frustrated and tired, I just wiped out the entire malloc code and created my own, which leakes everything (no free()) but at least correctly produces usable blocks of memory. After I did this, I tried to remember what I was working on when the problem, who knows. I'm tired and I don't want to play any more...

It's hard, but it's fun. There's no hacking like kernel hacking.