From: Eric Christopher Date: Tue, 5 Feb 2013 07:31:55 +0000 (+0000) Subject: Add support for emitting a stub DW_AT_GNU_dwo_id as part of the X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a2cdf798b3d3c83c979205bfe92b5562d034932;p=platform%2Fupstream%2Fllvm.git Add support for emitting a stub DW_AT_GNU_dwo_id as part of the DWARF5 split dwarf proposal. llvm-svn: 174350 --- diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 13ad353..6b19c5a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/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/llvm/test/DebugInfo/X86/fission-cu.ll b/llvm/test/DebugInfo/X86/fission-cu.ll index 853eb6c..fd2fedd 100644 --- a/llvm/test/DebugInfo/X86/fission-cu.ll +++ b/llvm/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)