Wednesday, August 24, 2011

Dragonslaying in the bowels of Tunguska

It all started with a very small patch I committed to the Tunguska CVS a few days ago, it moved some stuff off the heap onto the stack (these are small objects, so no, it's not what you're thinking) and made a few other very minor changes. It ran fine... then, and I was arguably a bit sloppy with the sanity checking as I thought it was all so small. But as it is with memory errors, they occasionally hide and pop up in the nastiest of places later.

Today I found several bugs that have been festering in the code base since the dawn of time (since I've been working on the project highly intermittently, and some of the code started out being C rather than C++, some of the older code is quite dubious). I've mostly fixed the bugs now, except one particularly vexing bug in the assembler.

The assembler uses yacc and lex to parse the source files. If you weren't aware, yacc takes a special file format and generates a Lovecraftian horror in source-code form. If there's a hell for programmers are sent to hell, I imagine it involves debugging yacc output with gdb.

--edit--

I just committed and checked-out the source code. This fixed the assembler. I made a copy of the old source directory for reference. diff agrees the files are 100% the same. The clean routine in my makefile generates all generated code, objects, and binaries.

It's stuff like this...

Anyway, I think this highlights just how much Tunguska is in need of a design overhaul.

No comments:

Post a Comment