[Lldb-commits] [PATCH] D151940: Fix regex & startsWith name lookup in SBTarget::FindGlobalVariables
Jim Ingham via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 1 14:21:34 PDT 2023
jingham created this revision.
jingham added reviewers: aprantl, jasonmolenda, mib, JDevlieghere.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
There were two bugs here.
1. eMatchTypeStartsWith searched for "symbol_name" by adding ".*" to the end of the symbol name and treating that as a regex, which isn't actually a regex for "starts with". The ".*" is in fact a no-op.
2. When we finally get to comparing the name, we compare against whatever form of the name was in the accelerator table. But for C++ that might be the mangled name. We should also try demangled names here, since most users are going the see demangled not mangled names.
I fixed these two bugs and added a bunch of tests for FindGlobalVariables.
This change is in the DWARF parser code, so there may be a similar bug in PDB, but the test for this was already skipped for Windows, so I don't know about this.
You might theoretically need to do this Mangled comparison in
DWARFMappedHash::MemoryTable::FindByName
except when we have names we always chop them before looking them up so I couldn't see any code paths that fail without that change. So I didn't add that to this patch.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151940
Files:
lldb/source/API/SBTarget.cpp
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
lldb/test/API/lang/cpp/class_static/main.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151940.527606.patch
Type: text/x-patch
Size: 8246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230601/2f37791c/attachment.bin>
More information about the lldb-commits
mailing list