This is an archive of the discontinued LLVM Phabricator instance.

Fix regex & startsWith name lookup in SBTarget::FindGlobalVariables
ClosedPublic

Authored by jingham on Jun 1 2023, 2:21 PM.

Details

Summary

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.
  1. 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.

Diff Detail

Event Timeline

jingham created this revision.Jun 1 2023, 2:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 2:21 PM
jingham requested review of this revision.Jun 1 2023, 2:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 2:21 PM
aprantl accepted this revision.Jun 1 2023, 2:27 PM
This revision is now accepted and ready to land.Jun 1 2023, 2:27 PM
bulbazord accepted this revision.Jun 1 2023, 2:35 PM
mib accepted this revision.Jun 1 2023, 3:12 PM

LGTM!

lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
182

typo ?