aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-04-04 00:22:54 +0000
committerManman Ren <mren@apple.com>2013-04-04 00:22:54 +0000
commite3d75ee2a1c8ea11fd01fc49055d08f2da7f5668 (patch)
tree1917974353321b66c1fc013783533a6c8f465258 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent296ffab5625fe83d804f1dd5d5517954082b6622 (diff)
Debug Info: according to DWARF 2, FORM_ref_addr the same size as an address on
the target system. It was hard-coded to 4 bytes before. I can't get llvm to generate a ref_addr on a reasonably sized testing case. rdar://problem/13559431 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index d3cb4f9c1c..b6b0bb1237 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1791,7 +1791,14 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
DwarfUnits &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
Addr += Holder.getCUOffset(Origin->getCompileUnit());
}
- Asm->EmitInt32(Addr);
+ // DWARF4: References that use the attribute form DW_FORM_ref_addr are
+ // specified to be four bytes in the DWARF 32-bit format and eight bytes
+ // in the DWARF 64-bit format, while DWARF Version 2 specifies that such
+ // references have the same size as an address on the target system.
+ // Our current version is version 2.
+ Asm->OutStreamer.EmitIntValue(Addr,
+ Form == dwarf::DW_FORM_ref_addr ?
+ Asm->getDataLayout().getPointerSize() : 4);
break;
}
case dwarf::DW_AT_ranges: {