[PATCHv2] gdb: fix parsing of DIEs with both low/high pc AND ranges attributes
Tom Tromey
tromey@adacore.com
Wed Dec 4 18:07:18 GMT 2024
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
Andrew> In v2:
Andrew> - Added a DWARF assembler test.
Andrew> Given this patch is fixing a regression (on older distributions) I do
Andrew> plan to merge this fix later this week unless someone jumps in with
Andrew> any concerns. As always, I'm happy to address issues after I commit,
Andrew> if nobody wants to review ahead of time.
We encountered this assertion failure on various builds after importing
gdb-head this week. E.g., many internal tests fail on Ubuntu 18.
I tested this patch and can confirm it fixes the problems we are seeing.
Thank you.
Approved-By: Tom Tromey <tom@tromey.com>
Andrew> 1. Prevent loading certain attributes from an abstract instance.
Andrew> Section 3.3.8.1 of the DWARF-5 spec talks about which attributes are
Andrew> appropriate to place in an abstract instance. Any attribute that
Andrew> might vary between instances should not appear in an abstract
Andrew> instance. DW_AT_ranges is included as an example in the
Andrew> non-exhaustive list of attributes that should not appear in an
Andrew> abstract instance.
Andrew> Currently in dwarf2_attr (dwarf2/read.c), when we see a
Andrew> DW_AT_abstract_origin attribute, we always follow this to try and find
Andrew> the attribute we are looking for. But we could change this function
Andrew> so that we prevent this following for attributes that we know should
Andrew> not be looked up in an abstract instance. This would solve the
Andrew> problem in this case by preventing us finding the DW_AT_ranges in the
Andrew> incorrect abstract instance.
Andrew> However, I do wonder if in the future we might want to explore
Andrew> solution #1 as an additional safety feature.
Yeah, I wonder this as well.
Or perhaps this particular spot should be changed to explicitly not
follow links to an abstract origin, rather than making it conditional on
the particular attribute? I am not sure if that's better or worse.
Tom
More information about the Gdb-patches
mailing list