Skip to content

[lldb] Preserve original symbol of Mangled function names #152201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
6 changes: 4 additions & 2 deletions lldb/test/API/lang/cpp/extern_c/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ extern "C"

int foo()
{
puts("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[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# RUN: %lldb %t -o "image lookup -a 0x48000 -v" -o exit | FileCheck %s

# CHECK: CompileUnit: id = {0x00000001}, file = "/tmp/a.cc", language = "c++"
# CHECK: Function: id = {0x0000006a}, name = "::_start({{.*}})", range = [0x0000000000048000-0x000000000004800c)
# CHECK: Function: id = {0x0000006a}, name = "::_start({{.*}})", mangled = "_start", range = [0x0000000000048000-0x000000000004800c)
# CHECK: LineEntry: [0x0000000000048000-0x000000000004800a): /tmp/a.cc:4
# CHECK: Symbol: id = {0x00000002}, range = [0x0000000000048000-0x000000000004800c), name="_start"
# CHECK: Variable: id = {0x00000075}, name = "v1", {{.*}} decl = a.cc:4
Expand Down
Loading