[Lldb-commits] [lldb] 032de3e - [lldb][DebugNamesDWARF] Also use mangled name when matching regex
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 6 14:16:01 PDT 2023
Author: Felipe de Azevedo Piovezan
Date: 2023-07-06T17:15:06-04:00
New Revision: 032de3ee0d3575557f999925fb2d78b9423f3f50
URL: https://github.com/llvm/llvm-project/commit/032de3ee0d3575557f999925fb2d78b9423f3f50
DIFF: https://github.com/llvm/llvm-project/commit/032de3ee0d3575557f999925fb2d78b9423f3f50.diff
LOG: [lldb][DebugNamesDWARF] Also use mangled name when matching regex
When LLDB queries the debug names index with a regex, we should use the
`Mangled` class wrapper, which attempts to match regex first against the mangled
name and then against the demangled name. It is important to do so, otherwise
queries like `frame var --regex A::` would never work. This is what is done for
the Apple index as well.
This fixes test/API/lang/cpp/class_static/main.cpp when compiled with DWARF 5.
Differential Revision: https://reviews.llvm.org/D154617
Added:
Modified:
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 879d6ce4686a72..1711a229443672 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -104,7 +104,8 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
llvm::function_ref<bool(DWARFDIE die)> callback) {
for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
for (DebugNames::NameTableEntry nte: ni) {
- if (!regex.Execute(nte.getString()))
+ Mangled mangled_name(nte.getString());
+ if (!mangled_name.NameMatches(regex))
continue;
uint64_t entry_offset = nte.getEntryOffset();
More information about the lldb-commits
mailing list