summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-02-27 23:21:02 +0000
committerManman Ren <mren@apple.com>2013-02-27 23:21:02 +0000
commit584e4c0eda8f7f3cff9daf68efd294e238accedf (patch)
tree46469ab7aa6e8828823eadddedf95a588eb69d8c /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parentc29095fb50550c402ed351cfbeb645fed14558d8 (diff)
downloadbcm5719-llvm-584e4c0eda8f7f3cff9daf68efd294e238accedf.tar.gz
bcm5719-llvm-584e4c0eda8f7f3cff9daf68efd294e238accedf.zip
Debug Info: for static member variables, always put AT_MIPS_linkage_name to the
definition DIE (TAG_variable), and put AT_MIPS_linkage_name to TAG_member when DarwinGDBCompat is true. Darwin GDB needs AT_MIPS_linkage_name at both places to work. Follow-up patch to r176143. rdar://problem/13291234 llvm-svn: 176220
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 59e433b70b1..00b91e70c79 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1349,12 +1349,19 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
// Add linkage name.
StringRef LinkageName = GV.getLinkageName();
if (!LinkageName.empty() && isGlobalVariable) {
- addString(VariableDIE, dwarf::DW_AT_MIPS_linkage_name,
+ // From dwarf-4: DIE to which DW_AT_linkage_name may apply include:
+ // TAG_commono_block, TAG_constant, TAG_entry_point, TAG_subporgram and
+ // TAG_variable. For static member variables, gcc 4.7 puts
+ // MIPS_linkage_name on the definition DIE only, but Darwin gdb needs
+ // MIPS_linkage_name at both places.
+ // Per discussion with Eric, for static member variables, we put
+ // MIPS_linkage_name on the definition DIE (TAG_variable) and conditionaly
+ // put MIPS_linkage_name on TAG_member when DarwinGDBCompat is on.
+ addString(IsStaticMember && VariableSpecDIE ?
+ VariableSpecDIE : 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,
+ if (IsStaticMember && VariableSpecDIE && DD->useDarwinGDBCompat())
+ addString(VariableDIE, dwarf::DW_AT_MIPS_linkage_name,
getRealLinkageName(LinkageName));
}
} else if (const ConstantInt *CI =
OpenPOWER on IntegriCloud