aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe de Azevedo Piovezan <fpiovezan@apple.com>2024-03-06 16:25:22 -0800
committerGitHub <noreply@github.com>2024-03-06 16:25:22 -0800
commit0497c77e9e02f0dcccd42a6afd65d0356a5dbb57 (patch)
treed50778a372896658dbc04cb3574b6728f5019dcc
parent4258b0e13ff8eced081f3344677f02373ea88127 (diff)
downloadllvm-0497c77e9e02f0dcccd42a6afd65d0356a5dbb57.zip
llvm-0497c77e9e02f0dcccd42a6afd65d0356a5dbb57.tar.gz
llvm-0497c77e9e02f0dcccd42a6afd65d0356a5dbb57.tar.bz2
[lldb] Print mangled names with verbose break list (#84071)
When debugging LLDB itself, it can often be useful to know the mangled name of the function where a breakpoint is set. Since the `--verbose` setting of `break --list` is aimed at debugging LLDB, this patch makes it so that the mangled name is also printed in that mode. Note about testing: since mangling is not the same on Windows and Linux, the test refrains from hardcoding mangled names.
-rw-r--r--lldb/source/Breakpoint/BreakpointLocation.cpp6
-rw-r--r--lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py13
2 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index f7b8ca1..b48ec13 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -524,6 +524,12 @@ void BreakpointLocation::GetDescription(Stream *s,
s->EOL();
s->Indent("function = ");
s->PutCString(sc.function->GetName().AsCString("<unknown>"));
+ if (ConstString mangled_name =
+ sc.function->GetMangled().GetMangledName()) {
+ s->EOL();
+ s->Indent("mangled function = ");
+ s->PutCString(mangled_name.AsCString());
+ }
}
if (sc.line_entry.line > 0) {
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
index 1292909..5179ffe 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
@@ -82,7 +82,7 @@ class BreakpointOptionsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 locations.
- lldbutil.run_break_set_by_symbol(
+ bp_id = lldbutil.run_break_set_by_symbol(
self,
"ns::func",
sym_exact=False,
@@ -90,6 +90,17 @@ class BreakpointOptionsTestCase(TestBase):
num_expected_locations=1,
)
+ location = self.target().FindBreakpointByID(bp_id).GetLocationAtIndex(0)
+ function = location.GetAddress().GetFunction()
+ self.expect(
+ "breakpoint list -v",
+ "Verbose breakpoint list contains mangled names",
+ substrs=[
+ "function = ns::func",
+ f"mangled function = {function.GetMangledName()}",
+ ],
+ )
+
# This should create a breakpoint with 0 locations.
lldbutil.run_break_set_by_symbol(
self,