1 ; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
2 ; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
3 ; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s
5 @a = common global i32 0, align 4
8 !llvm.module.flags = !{!9}
10 !0 = metadata !{i32 786449, metadata !8, i32 12, metadata !"clang version 3.3 (trunk 169021) (llvm/trunk 169020)", i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !1, metadata !3, metadata !3, metadata !"baz.dwo"} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/baz.c] [DW_LANG_C99]
11 !1 = metadata !{i32 0}
12 !3 = metadata !{metadata !5}
13 !5 = metadata !{i32 786484, i32 0, null, metadata !"a", metadata !"a", metadata !"", metadata !6, i32 1, metadata !7, i32 0, i32 1, i32* @a, null} ; [ DW_TAG_variable ] [a] [line 1] [def]
14 !6 = metadata !{i32 786473, metadata !8} ; [ DW_TAG_file_type ]
15 !7 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
16 !8 = metadata !{metadata !"baz.c", metadata !"/usr/local/google/home/echristo/tmp"}
18 ; Check that the skeleton compile unit contains the proper attributes:
19 ; This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list,
20 ; DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id,
21 ; DW_AT_ranges_base, DW_AT_addr_base.
23 ; CHECK: .debug_abbrev contents:
24 ; CHECK: Abbrev table for offset: 0x00000000
25 ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
26 ; CHECK: DW_AT_GNU_dwo_name DW_FORM_strp
27 ; CHECK: DW_AT_GNU_addr_base DW_FORM_sec_offset
28 ; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
29 ; CHECK: DW_AT_comp_dir DW_FORM_strp
30 ; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
31 ; CHECK: DW_AT_low_pc DW_FORM_addr
33 ; CHECK: .debug_info contents:
34 ; CHECK: DW_TAG_compile_unit
35 ; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
36 ; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
37 ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
38 ; CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")
39 ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
40 ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
42 ; CHECK: .debug_str contents:
43 ; CHECK: 0x00000000: "baz.dwo"
44 ; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
46 ; Check that we're using the right forms.
47 ; CHECK: .debug_abbrev.dwo contents:
48 ; CHECK: Abbrev table for offset: 0x00000000
49 ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes
50 ; CHECK: DW_AT_producer DW_FORM_GNU_str_index
51 ; CHECK: DW_AT_language DW_FORM_data2
52 ; CHECK: DW_AT_name DW_FORM_GNU_str_index
53 ; CHECK-NOT: DW_AT_low_pc
54 ; CHECK-NOT: DW_AT_stmt_list
55 ; CHECK-NOT: DW_AT_comp_dir
56 ; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
58 ; CHECK: [2] DW_TAG_variable DW_CHILDREN_no
59 ; CHECK: DW_AT_name DW_FORM_GNU_str_index
60 ; CHECK: DW_AT_type DW_FORM_ref4
61 ; CHECK: DW_AT_external DW_FORM_flag_present
62 ; CHECK: DW_AT_decl_file DW_FORM_data1
63 ; CHECK: DW_AT_decl_line DW_FORM_data1
64 ; CHECK: DW_AT_location DW_FORM_block1
66 ; CHECK: [3] DW_TAG_base_type DW_CHILDREN_no
67 ; CHECK: DW_AT_name DW_FORM_GNU_str_index
68 ; CHECK: DW_AT_encoding DW_FORM_data1
69 ; CHECK: DW_AT_byte_size DW_FORM_data1
71 ; Check that the rest of the compile units have information.
72 ; CHECK: .debug_info.dwo contents:
73 ; CHECK: DW_TAG_compile_unit
74 ; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
75 ; CHECK: DW_AT_language [DW_FORM_data2] (0x000c)
76 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c")
77 ; CHECK-NOT: DW_AT_low_pc
78 ; CHECK-NOT: DW_AT_stmt_list
79 ; CHECK-NOT: DW_AT_comp_dir
80 ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
81 ; CHECK: DW_TAG_variable
82 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000002) string = "a")
83 ; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]})
84 ; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
85 ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
86 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01)
87 ; CHECK: DW_AT_location [DW_FORM_block1] (<0x02> fb 00 )
88 ; CHECK: [[TYPE]]: DW_TAG_base_type
89 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "int")
92 ; CHECK: .debug_str.dwo contents:
93 ; CHECK: 0x00000000: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
94 ; CHECK: 0x00000035: "baz.c"
95 ; CHECK: 0x0000003b: "a"
96 ; CHECK: 0x0000003d: "int"
98 ; CHECK: .debug_str_offsets.dwo contents:
99 ; CHECK: 0x00000000: 00000000
100 ; CHECK: 0x00000004: 00000035
101 ; CHECK: 0x00000008: 0000003b
102 ; CHECK: 0x0000000c: 0000003d
105 ; For x86-64-linux we should have this set of relocations for the debug info section
108 ; OBJ-NEXT: R_X86_64_32 .debug_abbrev
109 ; OBJ-NEXT: R_X86_64_32 .debug_str
110 ; OBJ-NEXT: R_X86_64_32 .debug_addr
111 ; OBJ-NEXT: R_X86_64_32 .debug_line
112 ; OBJ-NEXT: R_X86_64_32 .debug_str
114 ; OBJ: .debug_aranges
115 ; OBJ-NEXT: R_X86_64_32 .debug_info 0x0
117 !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}