[llvm] r176143 - Debug Info: for static member variables, add AT_MIPS_linkage_name to the
Manman Ren
mren at apple.com
Tue Feb 26 16:02:32 PST 2013
Author: mren
Date: Tue Feb 26 18:02:32 2013
New Revision: 176143
URL: http://llvm.org/viewvc/llvm-project?rev=176143&view=rev
Log:
Debug Info: for static member variables, add AT_MIPS_linkage_name to the
definition DIE, to make old GDB happy.
We have a regression for old GDB when Clang uses DW_TAG_member to declare
static members inside a class, instead of DW_TAG_variable. This patch will fix
this regression.
rdar://problem/13291234
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=176143&r1=176142&r2=176143&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Feb 26 18:02:32 2013
@@ -1348,9 +1348,15 @@ void CompileUnit::createGlobalVariableDI
}
// Add linkage name.
StringRef LinkageName = GV.getLinkageName();
- if (!LinkageName.empty() && isGlobalVariable)
+ if (!LinkageName.empty() && isGlobalVariable) {
addString(VariableDIE, dwarf::DW_AT_MIPS_linkage_name,
getRealLinkageName(LinkageName));
+ // To make old GDB happy, for static member variables, we add
+ // AT_MIPS_linkage_name to the definition DIE as well.
+ if (IsStaticMember && VariableSpecDIE)
+ addString(VariableSpecDIE, dwarf::DW_AT_MIPS_linkage_name,
+ getRealLinkageName(LinkageName));
+ }
} else if (const ConstantInt *CI =
dyn_cast_or_null<ConstantInt>(GV.getConstant())) {
// AT_const_value was added when the static memeber was created. To avoid
Modified: llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll?rev=176143&r1=176142&r2=176143&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll Tue Feb 26 18:02:32 2013
@@ -131,12 +131,15 @@ declare void @llvm.dbg.declare(metadata,
; PRESENT: DW_TAG_variable
; PRESENT-NEXT: DW_AT_specification {{.*}} {0x[[DECL_A]]}
; PRESENT-NEXT: DW_AT_location
+; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1aE"
; PRESENT: DW_TAG_variable
; PRESENT-NEXT: DW_AT_specification {{.*}} {0x[[DECL_B]]}
; PRESENT-NEXT: DW_AT_location
+; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1bE"
; PRESENT: DW_TAG_variable
; PRESENT-NEXT: DW_AT_specification {{.*}} {0x[[DECL_C]]}
; PRESENT-NEXT: DW_AT_location
+; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE"
; ABSENT verifies that static member declarations do not have either
; DW_AT_location or DW_AT_data_member_location; also, variables do not
More information about the llvm-commits
mailing list