Re: need ideas on how to debug code generator

Nils <n.pipenbrinck@cubic.org>
Tue, 26 Feb 2008 02:55:34 +0100

          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: Nils <n.pipenbrinck@cubic.org>
Newsgroups: comp.compilers
Date: Tue, 26 Feb 2008 02:55:34 +0100
Organization: Compilers Central
References: 08-02-079
Keywords: debug
Posted-Date: 25 Feb 2008 23:00:40 EST

Ram Bhamidipaty schrieb:
>
> What are some techniques that people have used for debugging code
> generators?


I did a codegenerator for the MIPS4 architecture a year ago. What I
did for debugging was to write a simple emulator for the instruction
set. For MIPS this was easy to do because the instructions are
trivial to decode and simulate. With a bit of work the same can be
done for x86 as well.


My debugging jobs have always been easy because my generated code was
"only" executing rendering loops for graphics. The readable and
writeable memory regions were well defined, so catching page-faults
has been easy.


If you write such a simple emulator, set aside some memory and record
the CPU state for each instruction. This makes it easy to trace back
in time and _exactly_ find out the conditions that caused the page
fault.


Best debugging tool I ever had. The Watcom Debugger that I used 10
years ago had a similar feature. I wonder why we don't have such
useful things built in our tools anymore...


Nils


Post a followup to this message

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