[Lldb-commits] [PATCH] D137098: [lldb] Support simplified template names in the manual index
Arthur Eubanks via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 31 11:20:21 PDT 2022
aeubanks created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This makes setting breakpoints work with -gsimple-template-names.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137098
Files:
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
Index: lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
===================================================================
--- lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
+++ lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
@@ -12,7 +12,16 @@
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
def test(self):
- self.build()
+ self.do_test(dict())
+
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
+ @skipIf(compiler=no_match("clang"))
+ @skipIf(compiler_version=["<", "15.0"])
+ def test_simple_template_names(self):
+ self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names"))
+
+ def do_test(self, debug_flags):
+ self.build(dictionary=debug_flags)
self.breakpoint_id_tests()
def verify_breakpoint_locations(self, target, bp_dict):
@@ -57,7 +66,11 @@
# Template cases
{'name': 'func<float>', 'loc_names': []},
+ {'name': 'Foo::func<float>', 'loc_names': []},
+ {'name': 'ns::Foo::func<float>', 'loc_names': []},
{'name': 'func<int>', 'loc_names': ['auto ns::Foo<double>::func<int>()']},
+ {'name': 'Foo<double>::func<int>', 'loc_names': ['auto ns::Foo<double>::func<int>()']},
+ {'name': 'ns::Foo<double>::func<int>', 'loc_names': ['auto ns::Foo<double>::func<int>()']},
{'name': 'func', 'loc_names': ['auto ns::Foo<double>::func<int>()',
'auto ns::Foo<double>::func<ns::Foo<int>>()']},
Index: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -464,6 +464,17 @@
if (!m_set.function_methods.Find(
name, DIERefCallback(callback, name.GetStringRef())))
return;
+ // With -gsimple-template-names, the die name may not contain template
+ // parameters. Try stripping the template parameters and try again.
+ const llvm::StringRef name_ref = name.AsCString();
+ auto it = name_ref.find('<');
+ if (it != llvm::StringRef::npos) {
+ const llvm::StringRef name_no_template_params = name_ref.slice(0, it);
+ if (!m_set.function_methods.Find(
+ ConstString(name_no_template_params),
+ DIERefCallback(callback, name_no_template_params)))
+ return;
+ }
}
if (name_type_mask & eFunctionNameTypeSelector &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137098.472081.patch
Type: text/x-patch
Size: 2635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221031/fce6ff3e/attachment.bin>
More information about the lldb-commits
mailing list