[Lldb-commits] [PATCH] D124579: Make partial function name matching match on context boundaries

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 27 17:33:07 PDT 2022


jingham created this revision.
jingham added reviewers: JDevlieghere, labath, clayborg, shafik.
Herald added a subscriber: mgorny.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We don't require users to type out the full context of a function, for symbol name matches.  Instead, we extract the incoming path's base name, look up all the symbols with that base name, and then compare the rest of the context that the user provided to make sure it matches.  However, we do this comparison using just a strstr.  So for instance:

break set -n foo::bar

will match not only "a::foo::bar" but "notherfoo::bar".  The former is pretty clearly the user's intent, but I don't think the latter is, and results in breakpoints picking up too many matches.

This change adds a Language::DemangledNameContainsPath API which can do a language aware match against the path provided.  If the language doesn't provide this we fall back to the strstr (though that's changed to StringRef::contains in the patch).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124579

Files:
  lldb/include/lldb/Target/Language.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  lldb/source/Target/Language.cpp
  lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
  lldb/test/API/functionalities/breakpoint/cpp/main.cpp
  lldb/test/API/functionalities/return-value/TestReturnValue.py
  lldb/test/API/macosx/indirect_symbol/TestIndirectSymbols.py
  lldb/tools/CMakeLists.txt
  lldb/tools/lldb-instr/CMakeLists.txt
  lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124579.425658.patch
Type: text/x-patch
Size: 14064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220428/28f2a3c9/attachment-0001.bin>


More information about the lldb-commits mailing list