<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 1:10 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Oct 29, 2013 at 1:06 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br>
On Oct 29, 2013, at 11:51, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
<br>
><br>
><br>
><br>
> On Tue, Oct 29, 2013 at 11:41 AM, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>> wrote:<br>
> Hi Eric and David,<br>
><br>
> On Oct 21, 2013, at 17:07, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:<br>
> Cool deal. I've got some ideas on how to refactor/rewrite some of our<br>
> > loc handling anyhow, but it's going to be a few days before it's<br>
> > ready.<br>
><br>
><br>
> I had some time to look into this some more and I learned a couple of interesting things:<br>
> - The ##DEBUG_VALUE: comments in the asm output are really just comments do not necessarily show up in the DWARF. This is maybe not surprising, but what was surprising to me are the circumstances under which a DBG_VALUE makes it into the location list of a local variable:<br>


> - dbg.declare and dbg.value intrinsics are mutually exclusive; the presence of a dbg.declare will shadow any dbg.values that refer to the same variable. As soon as there is an entry in the MMI map (FunctionLowering::set() in FunctionLowering.cpp:134), the dbg.values will be ignored by DwarfDebug::collectVariableInfo (DwarfDebug.cpp::1366).<br>


> - Simply disabling that check will result in two separate DIEs for the same variable.<br>
><br>
> This means that while my patch was correct based on how DwarfDebug currently behaves, that behavior is broken and I should instead allow for dbg.values and dbg.declares to be coalesced into a single location list.<br>


><br>
> Before I dive into this I’d be curious to hear more about your ideas for location handling that you mentioned in your last mail, so we don’t accidentally evolve the code into two different directions.<br>
><br>
><br>
> I also found a second, related issue that I’d like to tackle.<br>
><br>
> This example:<br>
><br>
> > foo(int map)<br>
> > {<br>
> >   lookup(&map);<br>
> >   if (!verify(map)) {  }<br>
> > }<br>
> ><br>
><br>
> results in the following DWARF:<br>
><br>
> > 0x00000027:     TAG_subprogram [2] *<br>
> >                  AT_name( "foo” )<br>
> >                  AT_low_pc( 0x0000000000000000 )<br>
> >                  AT_high_pc( 0x0000000000000026 )<br>
> >               ...<br>
> > 0x00000046:         TAG_formal_parameter [3]<br>
> >                      AT_name( "map” )<br>
> >                      AT_type( {0x00000075} ( int ) )<br>
> >                      AT_location( fbreg -4 )<br>
> ><br>
> > 0x00000054:         TAG_lexical_block [4] *<br>
> >                      AT_low_pc( 0x0000000000000016 )<br>
> >                      AT_high_pc( 0x0000000000000020 )<br>
> ><br>
> > 0x00000065:             TAG_formal_parameter [3]<br>
> >                          AT_name( "map" )<br>
> >                          AT_type( {0x00000075} ( int ) )<br>
> >                          AT_location( fbreg -4 )<br>
><br>
> I would like teach DWARFDebug::constructScopeDIE() to recognize if a variable DIE describes a “subset" of a DIE in one of its parent lexical blocks.<br>
><br>
> To be clear, this just looks buggy - we shouldn't have two formal parameters here... there is only one formal parameter to 'foo'. If we create two DIEs that's a bug, we shouldn't do that.<br>
><br>
<br>
</div></div>That would be a fairly trivial fix in DWARFDebug::createScopeChildrenDIE(). I’m wondering: Should there ever be more than one DIE describing a variable in different lexical scopes or should there be only ever a single DIE with multiple entries in the DW_AT_location list?</blockquote>

<div><br></div></div></div><div>The latter, I'm fairly sure. </div></div></div></div>
</blockquote></div><br></div><div class="gmail_extra">Yes.</div><div class="gmail_extra"><br></div><div class="gmail_extra">-eric</div></div>