[PATCH] [gdb/symtab] Handle self-reference in inherit_abstract_dies

Tom de Vries tdevries@suse.de
Mon Aug 28 14:32:42 GMT 2023


On 8/28/23 16:11, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Tom> Building gdb with gcc 7.5.0 and -flto -O2 -flto-partition=one generates a
> Tom> self-referencing DIE:
> Tom> ...
> Tom>  <2><91dace>: Abbrev Number: 405 (DW_TAG_label)
> Tom>     <91dad0>   DW_AT_abstract_origin: <0x91dace>
> Tom> ...
> 
> Tom> When encountering the self-reference DIE in inherit_abstract_dies we loop
> Tom> following the abstract origin, effectively hanging gdb.
> 
> Tom> Fix this by handling self-referencing DIEs in the loop in
> Tom> inherit_abstract_dies.
> 
> I wonder if these have ever happened from compiler bugs, or only from
> hand-made tests.
> 

The reported instance is from a compiler bug, manifesting while building 
gdb.

> Anyway, seems fine.  If we're ever worried about chains of inheritance
> that form loops, we can do some kind of tortoise/hare thing.
> 

Ack.

Thanks for the review, committed.

Thanks,
- Tom

> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Tom



More information about the Gdb-patches mailing list