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

Tom de Vries tdevries@suse.de
Mon Sep 4 11:47:08 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.
> 
> Anyway, seems fine.  If we're ever worried about chains of inheritance
> that form loops, we can do some kind of tortoise/hare thing.

FTR, filed as https://sourceware.org/bugzilla/show_bug.cgi?id=30822 .

Thanks,
- Tom



More information about the Gdb-patches mailing list