[PATCH] [gdb/symtab] Handle self-reference DIE

Tom Tromey tom@tromey.com
Wed Aug 16 18:51:22 GMT 2023


>>>>> Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:

> Fix this by inhibiting the scan_attributes self-recursion for self-references.

Makes sense, thanks.

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

> Note that this doesn't fix the same problems for the more complicated case of:
> ...
>  <1><be>: Abbrev Number: 3 (DW_TAG_class_type)
>     <bf>   DW_AT_name        : c1
>     <c2>   DW_AT_specification: <0xc6>
>  <1><c6>: Abbrev Number: 4 (DW_TAG_class_type)
>     <c7>   DW_AT_name        : c2
>     <ca>   DW_AT_specification: <0xbe>
> ...
> but the approach for deciding whether to fix pathological dwarf cases is as
> per PR27981 comment 3:
> ...
> yes if it is cheap/obvious, and no if it is something complicated or expensive.
> ...
> and at this point I'm not sure whether fixing this will fall in the first
> category.

I suspect full recursion detection would be too expensive.

However, one idea would be to limit the number of specifications that
would be followed.  A small limit like 4 or 5 is probably more than
enough for all actually-existing DWARF.

I filed a dwarflint bug for this:

https://sourceware.org/bugzilla/show_bug.cgi?id=30772

Tom


More information about the Gdb-patches mailing list