<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 16, 2015 at 3:37 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2015-Apr-16, at 14:21, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
><br>
>><br>
>> On 2015-Apr-16, at 11:41, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>> (from IRC discussion)<br>
>><br>
>> Looks like this might've caused the GDB buildbot regression seen here: <a href="http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/21390" target="_blank">http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/21390</a><br>
>><br>
>> Specifically, in the below program<br>
>><br>
>> int *g;<br>
>><br>
>> static __attribute__((always_inline)) int f(int a) {<br>
>>  int l;<br>
>>  g = &l;<br>
>>  return a;<br>
>> }<br>
>><br>
>> int main(void) {<br>
>>  f(0);<br>
>>  f(0);<br>
>>  return 0;<br>
>> }<br>
>><br>
>> The inlined_subroutine for 'f' in 'main' has no DW_TAG_formal_parameter (for 'a')<br>
><br>
> I've tracked this down -- UserValue::match() needed to be updated.<br>
<br>
</span>r235140<br>
<span class=""><br>
><br>
> I fixed what might be an unrelated bug in DebugLocEntry.  I'll have<br>
> to separate out the two changes to see if this testcase provides any<br>
> coverage for `DebugLocEntry`; if not I'll maybe need some help from<br>
> you or Adrian coming up with a good testcase for that one.<br>
<br>
</span>This turned out to be unrelated.<br>
<br>
Looking at the code, I'm not even sure what the variables are doing in<br>
`DebugLocEntry` -- they're only used to prevent adjacent locations from<br>
coalescing.  I guess the main problem is I don't know what this table is<br>
for (well, `.debug_loc`, but I don't know what that is either).<br></blockquote><div><br>.debug_loc is for variables that don't reside in just a single location for their entire lifetime (much like debug_ranges discussed earlier) - if a variable resides in a single place for its entire scope, then DW_AT_location will have a dwarf expression describing that location, otherwise it'll have a sec_offset/data4 giving the offset in debug_loc that describes the various locations and ranges for the variable.<br><br>You might look for existing test cases that produce debug_loc sections? But I don't have a canonical way to produce one off-hand. I imagine if one is produced for two distinct inlined variables (from distinct inlined calls to the same function) then their location lists might end up accidentally shared (they'd end up with the same location list (possibly combining both variable location lists), rather than distinct ones)?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
By inspection, r235050 caused a behaviour change here (and the attached<br>
patch would revert the behaviour change), but I honestly have no idea<br>
what to test.<br>
<br>
Adrian, you seem to have touched this code most recently.  Any ideas?<br>
<br>
</blockquote></div><br></div></div>