[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 5 13:28:12 PST 2024


https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/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.

>From 0252a23a8a63acca1a51a9f838b6ace3f3b13cc1 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Thu, 29 Feb 2024 15:48:28 -0800
Subject: [PATCH] [lldb] Print mangled names with verbose break list

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            | 3 +++
 .../breakpoint_options/TestBreakpointOptions.py          | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index f7b8ca1f5506f3..045ed145cc7c49 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -524,6 +524,9 @@ void BreakpointLocation::GetDescription(Stream *s,
           s->EOL();
           s->Indent("function = ");
           s->PutCString(sc.function->GetName().AsCString("<unknown>"));
+          s->EOL();
+          s->Indent("mangled function = ");
+          s->PutCString(sc.function->GetMangled().GetMangledName().AsCString("<unknown>"));
         }
 
         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..c3b911145db3a6 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
@@ -90,6 +90,15 @@ def breakpoint_options_language_test(self):
             num_expected_locations=1,
         )
 
+        self.expect(
+            "breakpoint list -v",
+            "Verbose breakpoint list contains mangled names",
+            substrs=[
+                "function = ns::func"
+                "mangled function ="
+            ],
+        )
+
         # This should create a breakpoint with 0 locations.
         lldbutil.run_break_set_by_symbol(
             self,



More information about the lldb-commits mailing list