Re: need ideas on how to debug code generator

"Bartc" <bc@freeuk.com>
Wed, 27 Feb 2008 18:07:17 GMT

          From comp.compilers

Related articles
need ideas on how to debug code generator rambham@gmail.com (Ram Bhamidipaty) (2008-02-24)
Re: need ideas on how to debug code generator thomas@povtal.org (Thomas Have) (2008-02-25)
Re: need ideas on how to debug code generator n.pipenbrinck@cubic.org (Nils) (2008-02-26)
Re: need ideas on how to debug code generator bc@freeuk.com (Bartc) (2008-02-27)
Re: need ideas on how to debug code generator bisqwit@iki.fi (Joel Yliluoma) (2008-02-28)
| List of all articles for this month |

From: "Bartc" <bc@freeuk.com>
Newsgroups: comp.compilers
Date: Wed, 27 Feb 2008 18:07:17 GMT
Organization: Compilers Central
References: 08-02-079
Keywords: debug
Posted-Date: 27 Feb 2008 21:58:31 EST

Ram Bhamidipaty wrote:
> 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.


Do you have a listing of the x86 output? Then just debug as though it
was of piece of assembly code.


The correctness of individual instructions does not stop you having a
memory fault which can be due to incorrect contents of registers or
memory.


So look carefully at data allocations too. And double-check a
disassembly of your code to see if that's what you had in mind. Are
you sure your debugger can't tell which instruction it's failing on?


--
Bart


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.