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

Tom Tromey tom@tromey.com
Mon Aug 28 14:11:03 GMT 2023


>>>>> "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.

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

Tom


More information about the Gdb-patches mailing list