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
This commit is contained in:
Eric Christopher 2013-02-05 07:31:55 +00:00
parent ae510f3936
commit 208cc6f489
2 changed files with 11 additions and 2 deletions

View File

@ -685,6 +685,11 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
if (!FirstCU) if (!FirstCU)
FirstCU = NewCU; 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) if (useSplitDwarf() && !SkeletonCU)
SkeletonCU = constructSkeletonCU(N); SkeletonCU = constructSkeletonCU(N);
@ -2450,7 +2455,8 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
StringRef FN = sys::path::filename(T); StringRef FN = sys::path::filename(T);
NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name, FN); 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, // FIXME: The addr base should be relative for each compile unit, however,
// this one is going to be 0 anyhow. // this one is going to be 0 anyhow.

View File

@ -20,6 +20,7 @@
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_compile_unit ; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo") ; 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_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) ; 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_low_pc DW_FORM_GNU_addr_index
; CHECK: DW_AT_stmt_list DW_FORM_data4 ; CHECK: DW_AT_stmt_list DW_FORM_data4
; CHECK: DW_AT_comp_dir DW_FORM_GNU_str_index ; 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: [2] DW_TAG_base_type DW_CHILDREN_no
; CHECK: DW_AT_name DW_FORM_GNU_str_index ; CHECK: DW_AT_name DW_FORM_GNU_str_index
@ -60,11 +62,12 @@
; CHECK: DW_AT_language [DW_FORM_data2] (0x000c) ; 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_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_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_TAG_base_type
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "int") ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "int")
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "a") ; 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_external [DW_FORM_flag_present] (true)
; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01) ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01) ; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01)