[Lldb-commits] [lldb] [lldb] Preserve original symbol of Mangled function names (PR #152201)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 5 14:39:00 PDT 2025
https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/152201
>From 90eaf547090690c6250fa36937c0f07b170eb8bb Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Tue, 5 Aug 2025 13:34:50 -0700
Subject: [PATCH 1/3] [lldb] Preserve original symbol of Mangled function names
---
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 4c6c3054ba179..a429ea848b7f7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2509,7 +2509,9 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
// If the mangled name is not present in the DWARF, generate the
// demangled name using the decl context. We skip if the function is
// "main" as its name is never mangled.
- func_name.SetValue(ConstructDemangledNameFromDWARF(die));
+ func_name.SetDemangledName(ConstructDemangledNameFromDWARF(die));
+ // Ensure symbol is preserved (as the mangled name).
+ func_name.SetMangledName(ConstString(name));
} else
func_name.SetValue(ConstString(name));
>From da515bf657ceb49b51f3d5eca3513f12e8d38807 Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Tue, 5 Aug 2025 14:24:50 -0700
Subject: [PATCH 2/3] Add test
---
lldb/test/API/lang/cpp/extern_c/main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/test/API/lang/cpp/extern_c/main.cpp b/lldb/test/API/lang/cpp/extern_c/main.cpp
index 727ea9255ca7f..0fe262c86ff3c 100644
--- a/lldb/test/API/lang/cpp/extern_c/main.cpp
+++ b/lldb/test/API/lang/cpp/extern_c/main.cpp
@@ -8,7 +8,7 @@ extern "C"
int foo()
{
- puts("foo");
+ puts("foo"); //% self.expect("image lookup -v -a $pc", substrs=['mangled = "foo"'])
return 2;
}
>From adcba52addbca946d6a77195b5da793edbb4c680 Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Tue, 5 Aug 2025 14:38:42 -0700
Subject: [PATCH 3/3] Test formatting
---
lldb/test/API/lang/cpp/extern_c/main.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lldb/test/API/lang/cpp/extern_c/main.cpp b/lldb/test/API/lang/cpp/extern_c/main.cpp
index 0fe262c86ff3c..7017c745be178 100644
--- a/lldb/test/API/lang/cpp/extern_c/main.cpp
+++ b/lldb/test/API/lang/cpp/extern_c/main.cpp
@@ -8,8 +8,10 @@ extern "C"
int foo()
{
- puts("foo"); //% self.expect("image lookup -v -a $pc", substrs=['mangled = "foo"'])
- return 2;
+ puts("foo"); //% self.expect("image lookup -va $pc",
+ //% substrs=[' name = "::foo()"',
+ //% ' mangled = "foo"'])
+ return 2;
}
int main (int argc, char const *argv[], char const *envp[])
More information about the lldb-commits
mailing list