blob: 80ee987f54780b7d4a709a35a657f07022090cf1 [file] [log] [blame]
Eric Christopher09d1c0f2014-03-14 21:20:07 +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
David Blaikie20474102014-02-25 22:46:44 +00004; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
Eric Christopher9c2ecd92012-11-30 23:59:06 +00005
6@a = common global i32 0, align 4
7
8!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +00009!llvm.module.flags = !{!9}
Eric Christopher9c2ecd92012-11-30 23:59:06 +000010
David Blaikie5e390e42014-02-04 01:23:52 +000011!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 !1, metadata !"baz.dwo"} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/baz.c] [DW_LANG_C99]
12!1 = metadata !{}
David Blaikie33111df2013-02-02 05:56:24 +000013!3 = metadata !{metadata !5}
David Blaikie47922fb2013-03-11 22:37:40 +000014!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 +000015!6 = metadata !{i32 786473, metadata !8} ; [ DW_TAG_file_type ]
16!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 +000017!8 = metadata !{metadata !"baz.c", metadata !"/usr/local/google/home/echristo/tmp"}
Eric Christopher9c2ecd92012-11-30 23:59:06 +000018
19; Check that the skeleton compile unit contains the proper attributes:
20; This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list,
21; DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id,
22; DW_AT_ranges_base, DW_AT_addr_base.
23
Eric Christopher6a421a92013-02-05 07:32:00 +000024; CHECK: .debug_abbrev contents:
25; CHECK: Abbrev table for offset: 0x00000000
26; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
David Blaikie38fe6342014-01-09 04:28:46 +000027; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
Eric Christopher6a421a92013-02-05 07:32:00 +000028; CHECK: DW_AT_GNU_dwo_name DW_FORM_strp
Eric Christopher6a421a92013-02-05 07:32:00 +000029; CHECK: DW_AT_comp_dir DW_FORM_strp
Eric Christopher60eb7692013-08-12 20:27:48 +000030; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
Eric Christopher6a421a92013-02-05 07:32:00 +000031
Eric Christopher962c9082013-01-15 23:56:56 +000032; Check that we're using the right forms.
33; CHECK: .debug_abbrev.dwo contents:
34; CHECK: Abbrev table for offset: 0x00000000
35; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes
36; CHECK: DW_AT_producer DW_FORM_GNU_str_index
37; CHECK: DW_AT_language DW_FORM_data2
38; CHECK: DW_AT_name DW_FORM_GNU_str_index
Eric Christopher52ce7182013-04-09 19:23:15 +000039; CHECK-NOT: DW_AT_low_pc
40; CHECK-NOT: DW_AT_stmt_list
41; CHECK-NOT: DW_AT_comp_dir
Eric Christopher7a2cdf72013-02-05 07:31:55 +000042; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
Eric Christopher962c9082013-01-15 23:56:56 +000043
Manman Renf6b936b2013-10-29 05:49:41 +000044; CHECK: [2] DW_TAG_variable DW_CHILDREN_no
Eric Christopher962c9082013-01-15 23:56:56 +000045; CHECK: DW_AT_name DW_FORM_GNU_str_index
46; CHECK: DW_AT_type DW_FORM_ref4
47; CHECK: DW_AT_external DW_FORM_flag_present
48; CHECK: DW_AT_decl_file DW_FORM_data1
49; CHECK: DW_AT_decl_line DW_FORM_data1
Eric Christopher4a741042014-02-16 08:46:55 +000050; CHECK: DW_AT_location DW_FORM_exprloc
Eric Christopher962c9082013-01-15 23:56:56 +000051
Manman Renf6b936b2013-10-29 05:49:41 +000052; CHECK: [3] DW_TAG_base_type DW_CHILDREN_no
53; CHECK: DW_AT_name DW_FORM_GNU_str_index
54; CHECK: DW_AT_encoding DW_FORM_data1
55; CHECK: DW_AT_byte_size DW_FORM_data1
56
David Blaikie622dce42014-01-08 23:29:59 +000057; CHECK: .debug_info contents:
58; CHECK: DW_TAG_compile_unit
David Blaikie96dea052014-03-24 21:31:35 +000059; CHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
60; CHECK-NEXT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
61; CHECK-NEXT: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")
David Blaikie96dea052014-03-24 21:31:35 +000062; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
David Blaikie622dce42014-01-08 23:29:59 +000063
Eric Christopherda4b2192013-01-02 23:52:13 +000064; Check that the rest of the compile units have information.
Eric Christopherda4b2192013-01-02 23:52:13 +000065; CHECK: .debug_info.dwo contents:
66; CHECK: DW_TAG_compile_unit
Eric Christopher2cbd5762013-01-07 19:32:41 +000067; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
Frederic Riss878065b2014-09-04 19:39:20 +000068; CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99)
Eric Christopher2cbd5762013-01-07 19:32:41 +000069; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c")
Eric Christopher52ce7182013-04-09 19:23:15 +000070; CHECK-NOT: DW_AT_low_pc
71; CHECK-NOT: DW_AT_stmt_list
72; CHECK-NOT: DW_AT_comp_dir
Eric Christopher420569b2014-02-20 02:50:45 +000073; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
Eric Christopherda4b2192013-01-02 23:52:13 +000074; CHECK: DW_TAG_variable
Eric Christopher52ce7182013-04-09 19:23:15 +000075; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000002) string = "a")
Manman Renf6b936b2013-10-29 05:49:41 +000076; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]})
Eric Christophere9ec2452013-01-18 22:11:33 +000077; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
78; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
Frederic Riss0982e692014-09-05 07:21:50 +000079; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
Eric Christopher4a741042014-02-16 08:46:55 +000080; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 )
Manman Renf6b936b2013-10-29 05:49:41 +000081; CHECK: [[TYPE]]: DW_TAG_base_type
82; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "int")
Eric Christophere9ec2452013-01-18 22:11:33 +000083
David Blaikie622dce42014-01-08 23:29:59 +000084; CHECK: .debug_str contents:
85; CHECK: 0x00000000: "baz.dwo"
86; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
Eric Christopher962c9082013-01-15 23:56:56 +000087
88; CHECK: .debug_str.dwo contents:
89; CHECK: 0x00000000: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
90; CHECK: 0x00000035: "baz.c"
Eric Christopher52ce7182013-04-09 19:23:15 +000091; CHECK: 0x0000003b: "a"
92; CHECK: 0x0000003d: "int"
Eric Christopher962c9082013-01-15 23:56:56 +000093
94; CHECK: .debug_str_offsets.dwo contents:
95; CHECK: 0x00000000: 00000000
96; CHECK: 0x00000004: 00000035
97; CHECK: 0x00000008: 0000003b
Eric Christopher52ce7182013-04-09 19:23:15 +000098; CHECK: 0x0000000c: 0000003d
Eric Christopher55863be2013-04-07 03:43:09 +000099
100; Object file checks
101; For x86-64-linux we should have this set of relocations for the debug info section
102;
103; OBJ: .debug_info
104; OBJ-NEXT: R_X86_64_32 .debug_abbrev
David Blaikie38fe6342014-01-09 04:28:46 +0000105; OBJ-NEXT: R_X86_64_32 .debug_line
Eric Christopher55863be2013-04-07 03:43:09 +0000106; OBJ-NEXT: R_X86_64_32 .debug_str
Eric Christopher55863be2013-04-07 03:43:09 +0000107; OBJ-NEXT: R_X86_64_32 .debug_str
David Blaikie330ec972014-03-21 20:27:21 +0000108; OBJ-NEXT: R_X86_64_32 .debug_addr
Eric Christopher55863be2013-04-07 03:43:09 +0000109; OBJ-NEXT: }
Eric Christopherd8667202013-12-30 17:22:27 +0000110
David Blaikie20474102014-02-25 22:46:44 +0000111; HDR-NOT: .debug_aranges
David Blaikie3c9a3cc2014-03-24 20:53:02 +0000112; HDR-NOT: .rela.{{.*}}.dwo
David Blaikie20474102014-02-25 22:46:44 +0000113
Manman Ren409558f2013-11-22 21:49:45 +0000114!9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}