need ideas on how to debug code generator



Hi,

I have a small code generator - for 32 bit x86 machines, unfortunately it
has some bugs :-(. My problem is that the generated code fails
"once in a while" sometimes it can go for 20-40 iterations before failing.

I have a collection of test cases where I verify the correctness of
various simple constructs -- things like load, store, add, sub, etc.
Those all pass.

The test case in question generates a code sequence of about 400 bytes. It
fails by seg faulting, unfortunately gdb is unable to print out a
useful stack trace.

What are some techniques that people have used for debugging code
generators?

-Ram
.



Relevant Pages

  • Re: need ideas on how to debug code generator
    ... I have a small code generator - for 32 bit x86 machines, ... My problem is that the generated code fails ... GDB can do generated code debugging tolerably, ... When the program segfaults, you'll get the address and the exact ...
    (comp.compilers)
  • Re: We need Grasshopper for Delphi!!
    ... > If you're implying a code generator that generates code for different ... > platforms from the same "source", then I think that's a great idea. ... Features and bugs: http://qc.borland.com ...
    (borland.public.delphi.non-technical)
  • Re: [PHP] Broken compatibility with escaping { in php 5.2
    ... It was a part of code generator, ... But the complaint is that whichever is "correct" version, it cannot be much more correct than the other, and certainly not worth breaking existing functionality. ... Mine was easy to fix, but this might introduce weird bugs somewhere else. ...
    (php.general)