Author: Felipe de Azevedo Piovezan Date: 2024-03-06T16:25:22-08:00 New Revision: 0497c77e9e02f0dcccd42a6afd65d0356a5dbb57
URL: https://github.com/llvm/llvm-project/commit/0497c77e9e02f0dcccd42a6afd65d0356a5dbb57 DIFF: https://github.com/llvm/llvm-project/commit/0497c77e9e02f0dcccd42a6afd65d0356a5dbb57.diff LOG: [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. Added: Modified: lldb/source/Breakpoint/BreakpointLocation.cpp lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py Removed: ################################################################################ diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index f7b8ca1f5506f3..b48ec1398d63e8 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 129290909029a1..5179ffe730b9a0 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 @@ def breakpoint_options_language_test(self): 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 @@ def breakpoint_options_language_test(self): 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, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits