[Dwarf-discuss] dwarf information for mutiple statements at thesame line.
Nettleton, Brian
brian.nettleton
Thu Jul 13 01:15:02 GMT 2006
Debug formats I've worked with before supported this with a scheme for
inner and outer line numbers defining a hierarchy of line numbers. I
agree with Michael that if you've only got one number then the "outer"
(non-macro) line number is better than an "inner" line number.
Line number hierarchies are definitely something to put on the list for
consideration in the next DWARF revision.
-Brian Nettleton
Wind River Systems
> -----Original Message-----
> From: dwarf-discuss-bounces at lists.freestandards.org
> [mailto:dwarf-discuss-bounces at lists.freestandards.org] On
> Behalf Of Michael Eager
> Sent: Wednesday, July 12, 2006 5:50 PM
> To: Jim Blandy
> Cc: dwarf-discuss at lists.freestandards.org; Keith Walker
> Subject: Re: [Dwarf-discuss] dwarf information for mutiple
> statements at thesame line.
>
> Jim Blandy wrote:
> > On 7/11/06, Ron Brender <ron.brender at charter.net> wrote:
> >> I believe Michael is correct. Basically, just treat every
> token in the
> >> macro expansion as though it occurred at the location of the macro
> >> invocation
>
> > In other words, the source for Keith's call to f1 is on the line
> > defining the macro --- why shouldn't the debug info say so? Why is
> > the post-processed program the "real" program, and the code as it
> > exists in the user's file not? It seems more useful to put it the
> > other way around.
>
> I think that the problem is that macros have two distinct and
> disparate uses: one is as a simple form of inlined function,
> like Keith's example. In that case, giving the location of the
> macro definition is reasonable (although I'm not fully convinced).
>
> The other use is as a source unit, for example, a call to any of
> the functions defined as macros in stdio.h.
>
> Consider this small piece of code:
>
> 1: #include <stdio.h>
> 2: int foo()
> 3: {
> 4: int c;
> 5: c = getc(stdin);
> 6: return c;
> 7: }
>
> The "function call" on line 5 is actually a macro defined in
> stdio.h. (In GCC, this actually defined as a call to
> _IO_getc(), but I've seen multi-line implementations.)
>
> What is the best description for the source location of instruction
> that is generated by this call? foo.c:5 or stdio.h:459?
>
> The policy has been to assign line coordinates based on the
> user's source code. If this were changed for macro expansions,
> and instead the line coordinates of the macro definition were
> used, I'm not sure that there would be any way for a debugger to
> find the user's source for this call instruction. If foo:5 never
> appears in the line table, how would a debugger place a
> breakpoint on it? Certainly you could place a breakpoint at
> stdio.h:459, but is that really what you wanted to do?
>
> I think it would be desirable to have a mapping between
> the instructions generated in a macro expansion, but I think
> that it is not as simple as replacing the user source location
> with the macro definition location in the line table.
>
> --
> Michael Eager eager at eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
>
> _______________________________________________
> Dwarf-discuss mailing list
> Dwarf-discuss at lists.freestandards.org
> http://lists.freestandards.org/mailman/listinfo/dwarf-discuss
>
More information about the Dwarf-discuss
mailing list