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)); diff --git a/lldb/test/API/lang/cpp/extern_c/main.cpp b/lldb/test/API/lang/cpp/extern_c/main.cpp index 727ea9255ca7f..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"); - 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[]) diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-address-ranges.s b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-address-ranges.s index 8b3b0e9d56956..792555d99d7b7 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-address-ranges.s +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-address-ranges.s @@ -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