From: | Walter Banks <walter@bytecraft.com> |
Newsgroups: | comp.compilers |
Date: | Sat, 14 Feb 2009 09:15:13 -0500 |
Organization: | Aioe.org NNTP Server |
References: | 09-02-021 09-02-025 09-02-031 09-02-038 09-02-048 |
Keywords: | C, debug |
Posted-Date: | 14 Feb 2009 16:48:32 EST |
Marco van de Voort wrote:
> > Yes, C is a little too high-level for that job, but it's still the
> > best portable assembly language we have. One can work around most of
> > these issues as you point out, though.
>
> (to all the people that might have tried C as backend):
>
> How do you insert debug metadata on the HLL level into your binary in such
> setup ? It seems to me your debuginfo will contain C linenumbers, typedata
> etc. IOW, how do you debug in your HLL this way?
I have used C as a back end in several compiler projects.
In general we use #line directives to refer back to the original
source file and line number. This isn't perfect but works quite
well for most code at tying debug references back to the original
source.
We did implemented a simple approach for removing the intermediate
C source from listing files that embed source and generated code.
At the end of each generated C line we add a // followed by current
original source if any. We then strip the source part of the listing file
until after // and retain the remainder. We added a pragma to our
C compilers which will strip the C intermediate. For other compilers
a simple filter program can process the listing file to accomplish the
same thing.
Regards,
--
Walter Banks
Byte Craft Limited
http://www.bytecraft.com
Return to the
comp.compilers page.
Search the
comp.compilers archives again.