[PATCH] DWARFv5: Handle location list for split dwarf.

Simon Marchi simark@simark.ca
Fri Mar 20 03:20:14 GMT 2020


On 2020-03-18 10:15 a.m., nitachra wrote:
> 
> Hi Simon,
> 
> Thanks for the review.
> 
>> @@ -332,7 +337,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
>>        enum debug_loc_kind kind;
>>        const gdb_byte *new_ptr = NULL; /* init for gcc -Wall */
>>
>> -      if (baton->from_dwo)
>> +      if (baton->per_cu->version () < 5 && baton->from_dwo)
> 
>> Can you please explain the rationale of this change?  It's hard to tell whether it is correct or not without an explanation (and I prefer not having to guess your intentions).
> 
> I made this change because clang and gcc are not generating the DW_LLE_GNU* entries with DWARFv5 and -gsplit-dwarf.
> Instead they are generating DW_LLE_start* or DW_LLE_offset_pair with DW_LLE_base_addressx.

Thanks.  This is the kind of information that is useful to include in the
commit message, that explains why you needed to do such and such change.

> if (baton->from_dwo && kind != DEBUG_LOC_OFFSET_PAIR)
> 	{
> 	  low += base_offset;
> 	  high += base_offset;
> 	}
>       else
> 	{
> 	  low += base_address;
> 	  high += base_address;
> 	}
> 
> 
> I made the above change because clang is emitting DW_LLE_offset_pair and DW_LLE_base_addressx for DWARFv5 and -gsplit-dwarf.
> So we need to add the base address in the case of dwo also, otherwise the low and high address will be incorrect
> and gdb will give <optimized out> when printing the variable values.
> 
> These two changes combined will print the correct variable values. Overall the intent for this patch was to support the location
> list for split dwarf and print the correct variable values.

Hmm, all I get is <optimized out>.  I checked the generated binary a bit closer (test.out and
test.dwo), am I supposed to see a .debug_loclists or .debug_loclists.dwo section in there?
Because I don't see any... Again, this is with this clang version, take from apt.llvm.org:

    clang version 10.0.0-++20200317072632+135744ce689-1~exp1~20200317063228.125

> 
>> I am not able to reproduce to get this error message, there must be something else to trigger this bug:
> 
> To reproduce you have to apply the patch at https://sourceware.org/pipermail/gdb-patches/2020-January/164841.html
> I updated the patch right now. Reapply the patch if you have already applied. You will be able to regenerate the error then.

Ok.

Note that if you have multiple closely related patches (and even more importantly if
they have interdependencies), you can send them as a series, it then becomes much easier
to track them.

Also, please version your patches (if you look at other patches on the list, you'll see
the subject may start with "[PATCH v2]").  That makes it much easier to know which one
is the latest, especially if you start a new thread.

Simon


More information about the Gdb-patches mailing list