[cfe-dev] Line numbers in debug info for range based for

Robinson, Paul Paul_Robinson at playstation.sony.com
Fri May 2 15:46:34 PDT 2014


> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu]
> On Behalf Of Justin Bogner
> David Blaikie <dblaikie at gmail.com> writes:
> >> That commit message is specifically about functions, so it's not
> clear
> >> if the change to artificial variables was intentional.
> >>
> >> Should these variables have line information? On the one hand,
> they're
> >> artificial, but on the other, they do have a pretty obvious source
> >> location they correspond to.
> >>
> >> Thoughts?
> >
> > Off-hand thought: do you have a debug info consumer that would benefit
> > from this information? (if so, I'd be curious to hear what the
> > consumer is/how it's using this information)
> 
> Not really. I only noticed this because it exposed a bug in llvm-cov,
> and I wasn't sure if it was intentional.

Actually I think our debugger shows them even though they're artificial.
I don't know that our debugger deeply cares whether there is source
location info--I'll ask--but we don't ignore the variables completely.
(In fact we were thinking about ways to unique the names; currently all
of these get the same name, even in nested loops, IIRC.)
--paulr

> 
> > And the usual retort: GCC does the same thing:
> >
> > 0x0000008c:         DW_TAG_variable [5]
> >                       DW_AT_name [DW_FORM_strp] (
> > .debug_str[0x00000019] = "__for_range")
> >                       DW_AT_type [DW_FORM_ref4] (cu + 0x00d1 =>
> {0x000000d1})
> >                       DW_AT_artificial [DW_FORM_flag_present]   (true)
> >                       DW_AT_location [DW_FORM_exprloc]  (<0x2> 91 58 )
> >
> > 0x00000098:         DW_TAG_variable [5]
> >                       DW_AT_name [DW_FORM_strp] (
> > .debug_str[0x00000025] = "__for_begin")
> >                       DW_AT_type [DW_FORM_ref4] (cu + 0x00d7 =>
> {0x000000d7})
> >                       DW_AT_artificial [DW_FORM_flag_present]   (true)
> >                       DW_AT_location [DW_FORM_exprloc]  (<0x2> 91 60 )
> >
> > 0x000000a4:         DW_TAG_variable [5]
> >                       DW_AT_name [DW_FORM_strp] (
> > .debug_str[0x00000031] = "__for_end")
> >                       DW_AT_type [DW_FORM_ref4] (cu + 0x00d7 =>
> {0x000000d7})
> >                       DW_AT_artificial [DW_FORM_flag_present]   (true)
> >                       DW_AT_location [DW_FORM_exprloc]  (<0x2> 91 50 )
> 
> Good enough for me. Thanks!
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev






More information about the cfe-dev mailing list