From 0497c77e9e02f0dcccd42a6afd65d0356a5dbb57 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Wed, 6 Mar 2024 16:25:22 -0800 Subject: [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. --- lldb/source/Breakpoint/BreakpointLocation.cpp | 6 ++++++ .../breakpoint/breakpoint_options/TestBreakpointOptions.py | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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("")); + 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, -- cgit v1.1