We don't require users to type out the full context of a function, for
authorJim Ingham <jingham@apple.com>
Thu, 12 May 2022 18:00:18 +0000 (11:00 -0700)
committerJim Ingham <jingham@apple.com>
Thu, 12 May 2022 19:39:28 +0000 (12:39 -0700)
commit3339000e0bda696c2e29173d15958c0a4978a143
tree2e2518f4b781f6fff5b0600f6a092d64113d6b83
parentf8da28f5228857e905eedb248ac82c939777f9df
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).

Differential Revision: https://reviews.llvm.org/D124579
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/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp