aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-02-05 07:31:55 +0000
committerEric Christopher <echristo@gmail.com>2013-02-05 07:31:55 +0000
commit208cc6f48975320da1a71cf7f7eff497f4f43b75 (patch)
tree7b0ad2417f1ab4959fffded3c7eb3e0b8cdfd22e
parentae510f3936f2510cebff86ea38536b30fdf2a30c (diff)
Add support for emitting a stub DW_AT_GNU_dwo_id as part of the
DWARF5 split dwarf proposal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174350 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp8
-rw-r--r--test/DebugInfo/X86/fission-cu.ll5
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 13ad353be2..6b19c5a751 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -685,6 +685,11 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
if (!FirstCU)
FirstCU = NewCU;
+
+ // This should be a unique identifier when we want to build .dwp files.
+ if (useSplitDwarf())
+ NewCU->addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8, 0);
+
if (useSplitDwarf() && !SkeletonCU)
SkeletonCU = constructSkeletonCU(N);
@@ -2450,7 +2455,8 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
StringRef FN = sys::path::filename(T);
NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name, FN);
- // FIXME: We also need DW_AT_dwo_id.
+ // This should be a unique identifier when we want to build .dwp files.
+ NewCU->addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8, 0);
// FIXME: The addr base should be relative for each compile unit, however,
// this one is going to be 0 anyhow.
diff --git a/test/DebugInfo/X86/fission-cu.ll b/test/DebugInfo/X86/fission-cu.ll
index 853eb6c727..fd2fedd7a8 100644
--- a/test/DebugInfo/X86/fission-cu.ll
+++ b/test/DebugInfo/X86/fission-cu.ll
@@ -20,6 +20,7 @@
; CHECK: .debug_info contents:
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
+; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
@@ -39,6 +40,7 @@
; CHECK: DW_AT_low_pc DW_FORM_GNU_addr_index
; CHECK: DW_AT_stmt_list DW_FORM_data4
; CHECK: DW_AT_comp_dir DW_FORM_GNU_str_index
+; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
; CHECK: [2] DW_TAG_base_type DW_CHILDREN_no
; CHECK: DW_AT_name DW_FORM_GNU_str_index
@@ -60,11 +62,12 @@
; CHECK: DW_AT_language [DW_FORM_data2] (0x000c)
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c")
; CHECK: DW_AT_low_pc [DW_FORM_GNU_addr_index] ( indexed (00000000) address = 0x0000000000000000)
+; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
; CHECK: DW_TAG_base_type
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "int")
; CHECK: DW_TAG_variable
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "a")
-; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0016 => {0x00000016})
+; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x001e => {0x0000001e})
; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01)