[all-commits] [llvm/llvm-project] 5153a9: [lldb][DWARF] Change GetAttributes to always visit...
Michael Buch via All-commits
all-commits at lists.llvm.org
Fri Jan 17 05:10:14 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5153a90453e692b834e38eec247a0c88a0678bfa
https://github.com/llvm/llvm-project/commit/5153a90453e692b834e38eec247a0c88a0678bfa
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2025-01-17 (Fri, 17 Jan 2025)
Changed paths:
M lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
M lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
M lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp
Log Message:
-----------
[lldb][DWARF] Change GetAttributes to always visit current DIE before recursing (#123261)
`GetAttributes` returns all attributes on a given DIE, including any
attributes that the DIE references via `DW_AT_abstract_origin` and
`DW_AT_specification`. However, if an attribute exists on both the
referring DIE and the referenced DIE, the first one encountered will be
the one that takes precendence when querying the returned
`DWARFAttributes`. But there was no guarantee in which order those
attributes get visited. That means there's no convenient way of ensuring
that an attribute of a definition doesn't get shadowed by one found on
the declaration. One use-case where we don't want this to happen is for
`DW_AT_object_pointer` (which can exist on both definitions and
declarations, see https://github.com/llvm/llvm-project/pull/123089).
This patch makes sure we visit the current DIE's attributes before
following DIE references. I tried keeping as much of the original
`GetAttributes` unchanged and just add an outer `GetAttributes` that
keeps track of the DIEs we need to visit next.
There's precendent for this iteration order in
`llvm::DWARFDie::findRecursively` and also
`lldb_private::ElaboratingDIEIterator`. We could use the latter to
implement `GetAttributes`, though it also follows `DW_AT_signature` so I
decided to leave it for follow-up.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list