It's been a difficult last couple of weeks.

Just as I was getting ready to install Visual C++ I decided to have 
one last go at CodeWarrior, but under NT this time.  Everyone says 
NT is a better system for development, and I didn't doubt it, but had 
hesitated to install it because I thought it would be hard - Compaq 
doesn't support NT on my Presario 1800T.

But I did get it installed, and found drivers scattered hither and yon 
so I even have video and ethernet.

Anyway, my debugger crashes stopped happening under NT.  
Instead, I would get consistent complaints of "illegal instruction at 
BAADF00D".

I recognized that as a bogus value placed in unitialized memory to 
make programs crash quicker - at Apple we used DEADBEEF.

It was hard to debug because the problem would occur when a 
certain class was constructed, eventually narrowing it down to the 
DTDValidator.  The DTDValidator contains an XMLStringPool as a 
whole (non-pointer) member.  A further problem was that _using_ 
the debugger would often make the crash go away.  

I made my own "FooValidator" that had stub functions for 
everything and all the data members, and saw that making one 
would cause the crash if the XMLStringPool was a member but not 
if it wasn't; however, simply making an XMLStringPool on its own 
didn't cause the crash - so the bug wasn't really stable; very 
troublesome.

Commenting off the memset in the XMLStringPool constructor fixed 
the crash, as did replacing it with a simple for loop to zero out the 
buffer.  But crashes still persisted, just at other places.

So I tried #defining memset in my compiler-specific header file to 
MyMemSet, and used just a simple for loop there.  The memset 
that comes with codewarrior is a bunch of tricky x86 assembly 
code designed to squeeze the best performance out of the routine; 
mine was brain dead simple.

But mine doesn't crash to machine!  Hallelujah!

I can parse XML files now.

I've written this up and reported it to metrowerks.  I can't fathom 
how this could have gotten by.  I still have the feeling I must be 
wrong somehow because such a whopping bug surely would have 
been noticed before

BTW - if you have a Presario 1800 and want to install NT, BeOS or 
Linux on it, see my page at http://www.goingware.com/laptop - I'll 
be writing up the NT saga shortly.


Mike Crawford
GoingWare - Expert Software Development and Consulting
http://www.goingware.com
[EMAIL PROTECTED]

Reply via email to