blob: 71381cec11582cd5e47dac4ed91ffcc744132362 [file] [log] [blame]
Eric Christophercdf218d2012-12-10 19:51:21 +00001; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
Eli Benderskye6abe832013-01-25 21:44:53 +00002; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
Eric Christopher55863be2013-04-07 03:43:09 +00003; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s
Eric Christopher9c2ecd92012-11-30 23:59:06 +00004
5@a = common global i32 0, align 4
6
7!llvm.dbg.cu = !{!0}
8
David Blaikie5692e722013-03-28 02:44:59 +00009!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 !"baz.dwo"} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/baz.c] [DW_LANG_C99]
David Blaikie33111df2013-02-02 05:56:24 +000010!1 = metadata !{i32 0}
11!3 = metadata !{metadata !5}
David Blaikie47922fb2013-03-11 22:37:40 +000012!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]
David Blaikie5692e722013-03-28 02:44:59 +000013!6 = metadata !{i32 786473, metadata !8} ; [ DW_TAG_file_type ]
14!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]
David Blaikie8fb82242013-03-17 21:13:55 +000015!8 = metadata !{metadata !"baz.c", metadata !"/usr/local/google/home/echristo/tmp"}
Eric Christopher9c2ecd92012-11-30 23:59:06 +000016
17; Check that the skeleton compile unit contains the proper attributes:
18; This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list,
19; DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id,
20; DW_AT_ranges_base, DW_AT_addr_base.
21
Eric Christopher6a421a92013-02-05 07:32:00 +000022; CHECK: .debug_abbrev contents:
23; CHECK: Abbrev table for offset: 0x00000000
24; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
25; CHECK: DW_AT_GNU_dwo_name DW_FORM_strp
26; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
27; CHECK: DW_AT_GNU_addr_base DW_FORM_sec_offset
28; CHECK: DW_AT_low_pc DW_FORM_addr
29; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
30; CHECK: DW_AT_comp_dir DW_FORM_strp
31
Eric Christopherda4b2192013-01-02 23:52:13 +000032; CHECK: .debug_info contents:
Eric Christopherc8a310e2012-12-10 23:34:43 +000033; CHECK: DW_TAG_compile_unit
Eric Christopher4c7765f2013-01-17 03:00:04 +000034; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
Eric Christopher7a2cdf72013-02-05 07:31:55 +000035; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
Eric Christopher4c7765f2013-01-17 03:00:04 +000036; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
Eric Christopher9c2ecd92012-11-30 23:59:06 +000037; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
Eric Christopher4c7765f2013-01-17 03:00:04 +000038; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
39; CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")
40
41; CHECK: .debug_str contents:
42; CHECK: 0x00000000: "baz.dwo"
43; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
Eric Christopher3c5a1912012-12-19 22:02:53 +000044
Eric Christopher962c9082013-01-15 23:56:56 +000045; Check that we're using the right forms.
46; CHECK: .debug_abbrev.dwo contents:
47; CHECK: Abbrev table for offset: 0x00000000
48; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes
49; CHECK: DW_AT_producer DW_FORM_GNU_str_index
50; CHECK: DW_AT_language DW_FORM_data2
51; CHECK: DW_AT_name DW_FORM_GNU_str_index
Eric Christopher52ce7182013-04-09 19:23:15 +000052; CHECK-NOT: DW_AT_low_pc
53; CHECK-NOT: DW_AT_stmt_list
54; CHECK-NOT: DW_AT_comp_dir
Eric Christopher7a2cdf72013-02-05 07:31:55 +000055; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
Eric Christopher962c9082013-01-15 23:56:56 +000056
57; CHECK: [2] DW_TAG_base_type DW_CHILDREN_no
58; CHECK: DW_AT_name DW_FORM_GNU_str_index
59; CHECK: DW_AT_encoding DW_FORM_data1
60; CHECK: DW_AT_byte_size DW_FORM_data1
61
62; CHECK: [3] DW_TAG_variable DW_CHILDREN_no
63; CHECK: DW_AT_name DW_FORM_GNU_str_index
64; CHECK: DW_AT_type DW_FORM_ref4
65; CHECK: DW_AT_external DW_FORM_flag_present
66; CHECK: DW_AT_decl_file DW_FORM_data1
67; CHECK: DW_AT_decl_line DW_FORM_data1
68; CHECK: DW_AT_location DW_FORM_block1
69
Eric Christopherda4b2192013-01-02 23:52:13 +000070; Check that the rest of the compile units have information.
Eric Christopherda4b2192013-01-02 23:52:13 +000071; CHECK: .debug_info.dwo contents:
72; CHECK: DW_TAG_compile_unit
Eric Christopher2cbd5762013-01-07 19:32:41 +000073; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
Eric Christopherda4b2192013-01-02 23:52:13 +000074; CHECK: DW_AT_language [DW_FORM_data2] (0x000c)
Eric Christopher2cbd5762013-01-07 19:32:41 +000075; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c")
Eric Christopher52ce7182013-04-09 19:23:15 +000076; CHECK-NOT: DW_AT_low_pc
77; CHECK-NOT: DW_AT_stmt_list
78; CHECK-NOT: DW_AT_comp_dir
Eric Christopher7a2cdf72013-02-05 07:31:55 +000079; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
Eric Christopherda4b2192013-01-02 23:52:13 +000080; CHECK: DW_TAG_base_type
Eric Christopher52ce7182013-04-09 19:23:15 +000081; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "int")
Eric Christopherda4b2192013-01-02 23:52:13 +000082; CHECK: DW_TAG_variable
Eric Christopher52ce7182013-04-09 19:23:15 +000083; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000002) string = "a")
84; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0018 => {0x00000018})
Eric Christophere9ec2452013-01-18 22:11:33 +000085; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
86; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
87; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01)
Eric Christopher52ce7182013-04-09 19:23:15 +000088; CHECK: DW_AT_location [DW_FORM_block1] (<0x02> fb 00 )
Eric Christophere9ec2452013-01-18 22:11:33 +000089
Eric Christopher962c9082013-01-15 23:56:56 +000090
91; CHECK: .debug_str.dwo contents:
92; CHECK: 0x00000000: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
93; CHECK: 0x00000035: "baz.c"
Eric Christopher52ce7182013-04-09 19:23:15 +000094; CHECK: 0x0000003b: "a"
95; CHECK: 0x0000003d: "int"
Eric Christopher962c9082013-01-15 23:56:56 +000096
97; CHECK: .debug_str_offsets.dwo contents:
98; CHECK: 0x00000000: 00000000
99; CHECK: 0x00000004: 00000035
100; CHECK: 0x00000008: 0000003b
Eric Christopher52ce7182013-04-09 19:23:15 +0000101; CHECK: 0x0000000c: 0000003d
Eric Christopher55863be2013-04-07 03:43:09 +0000102
103; Object file checks
104; For x86-64-linux we should have this set of relocations for the debug info section
105;
106; OBJ: .debug_info
107; OBJ-NEXT: R_X86_64_32 .debug_abbrev
108; OBJ-NEXT: R_X86_64_32 .debug_str
109; OBJ-NEXT: R_X86_64_32 .debug_addr
110; OBJ-NEXT: R_X86_64_32 .debug_line
111; OBJ-NEXT: R_X86_64_32 .debug_str
112; OBJ-NEXT: }