[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 4 01:09:07 PDT 2024


Michael137 wrote:

> > You can repro this by running ./bin/lldb-dotest -p TestConstStaticIntegralMember.py --dwarf-version 5
> > Could you take a look @ZequanWu ?
> 
> It should be fixed by the following diff. We just need to skip the declaration DIEs that are struct/class/union. This failure you see is caused by skipping a declaration DIE `DW_TAG_variable`.
> 
> ```
> diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
> index 56717bab1ecd..6330470b970e 100644
> --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
> +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
> @@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry(
>      return true;
>    // Clang erroneously emits index entries for declaration DIEs in case when the
>    // definition is in a type unit (llvm.org/pr77696). Weed those out.
> -  if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0))
> +  if (die.IsStructUnionOrClass() &&
> +      die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0))
>      return true;
>    return callback(die);
>  }
> ```
> 
> Can you (or anyone with commit access) commit above fix for me? I somehow cannot pull/push from github.

Ah right, I remember encountering these `DW_AT_declaration`s in the index for DWARFv5 static member variables. Technically this isn't standard conforming right? I thought anything `DW_AT_declaration` shouldn't be indexed (though in the case of these static variables it's very useful that they do, because we don't emit definitions for these constants that the debugger could look for instead). @dwblaikie @felipepiovezan Should we allow such entries in the index? And does this warrant rephrasing in the DWARF spec?

https://github.com/llvm/llvm-project/pull/92328


More information about the lldb-commits mailing list