Skip to content

Commit 0497c77

Browse files
[lldb] Print mangled names with verbose break list (llvm#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.
1 parent 4258b0e commit 0497c77

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lldb/source/Breakpoint/BreakpointLocation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,12 @@ void BreakpointLocation::GetDescription(Stream *s,
524524
s->EOL();
525525
s->Indent("function = ");
526526
s->PutCString(sc.function->GetName().AsCString("<unknown>"));
527+
if (ConstString mangled_name =
528+
sc.function->GetMangled().GetMangledName()) {
529+
s->EOL();
530+
s->Indent("mangled function = ");
531+
s->PutCString(mangled_name.AsCString());
532+
}
527533
}
528534

529535
if (sc.line_entry.line > 0) {

lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,25 @@ def breakpoint_options_language_test(self):
8282
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
8383

8484
# This should create a breakpoint with 1 locations.
85-
lldbutil.run_break_set_by_symbol(
85+
bp_id = lldbutil.run_break_set_by_symbol(
8686
self,
8787
"ns::func",
8888
sym_exact=False,
8989
extra_options="-L c++",
9090
num_expected_locations=1,
9191
)
9292

93+
location = self.target().FindBreakpointByID(bp_id).GetLocationAtIndex(0)
94+
function = location.GetAddress().GetFunction()
95+
self.expect(
96+
"breakpoint list -v",
97+
"Verbose breakpoint list contains mangled names",
98+
substrs=[
99+
"function = ns::func",
100+
f"mangled function = {function.GetMangledName()}",
101+
],
102+
)
103+
93104
# This should create a breakpoint with 0 locations.
94105
lldbutil.run_break_set_by_symbol(
95106
self,

0 commit comments

Comments
 (0)