blob: 96bb6e227bc8319b97971839a779c07639f5f585 [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
Adrian Prantl75819ae2016-04-15 15:57:41 +000011!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)", isOptimized: false, splitDebugFilename: "baz.dwo", emissionKind: FullDebug, file: !8, enums: !1, retainedTypes: !1, globals: !3, imports: !1)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000012!1 = !{}
13!3 = !{!5}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000014!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i32* @a)
15!6 = !DIFile(filename: "baz.c", directory: "/usr/local/google/home/echristo/tmp")
16!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
17!8 = !DIFile(filename: "baz.c", directory: "/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
David Blaikie0b214e42016-03-24 18:37:08 +000036; CHECK: DW_AT_GNU_dwo_name DW_FORM_GNU_str_index
Eric Christopher962c9082013-01-15 23:56:56 +000037; CHECK: DW_AT_producer DW_FORM_GNU_str_index
38; CHECK: DW_AT_language DW_FORM_data2
39; CHECK: DW_AT_name DW_FORM_GNU_str_index
Eric Christopher52ce7182013-04-09 19:23:15 +000040; CHECK-NOT: DW_AT_low_pc
41; CHECK-NOT: DW_AT_stmt_list
42; CHECK-NOT: DW_AT_comp_dir
Eric Christopher7a2cdf72013-02-05 07:31:55 +000043; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
Eric Christopher962c9082013-01-15 23:56:56 +000044
Manman Renf6b936b2013-10-29 05:49:41 +000045; CHECK: [2] DW_TAG_variable DW_CHILDREN_no
Eric Christopher962c9082013-01-15 23:56:56 +000046; CHECK: DW_AT_name DW_FORM_GNU_str_index
47; CHECK: DW_AT_type DW_FORM_ref4
48; CHECK: DW_AT_external DW_FORM_flag_present
49; CHECK: DW_AT_decl_file DW_FORM_data1
50; CHECK: DW_AT_decl_line DW_FORM_data1
Eric Christopher4a741042014-02-16 08:46:55 +000051; CHECK: DW_AT_location DW_FORM_exprloc
Eric Christopher962c9082013-01-15 23:56:56 +000052
Manman Renf6b936b2013-10-29 05:49:41 +000053; CHECK: [3] DW_TAG_base_type DW_CHILDREN_no
54; CHECK: DW_AT_name DW_FORM_GNU_str_index
55; CHECK: DW_AT_encoding DW_FORM_data1
56; CHECK: DW_AT_byte_size DW_FORM_data1
57
David Blaikie622dce42014-01-08 23:29:59 +000058; CHECK: .debug_info contents:
59; CHECK: DW_TAG_compile_unit
David Blaikie96dea052014-03-24 21:31:35 +000060; CHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
61; CHECK-NEXT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
62; 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 +000063; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
David Blaikie622dce42014-01-08 23:29:59 +000064
Eric Christopherda4b2192013-01-02 23:52:13 +000065; Check that the rest of the compile units have information.
Eric Christopherda4b2192013-01-02 23:52:13 +000066; CHECK: .debug_info.dwo contents:
67; CHECK: DW_TAG_compile_unit
David Blaikie0b214e42016-03-24 18:37:08 +000068; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] ( indexed (00000000) string = "baz.dwo")
69; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000001) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
Frederic Riss878065b2014-09-04 19:39:20 +000070; CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99)
David Blaikie0b214e42016-03-24 18:37:08 +000071; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000002) string = "baz.c")
Eric Christopher52ce7182013-04-09 19:23:15 +000072; CHECK-NOT: DW_AT_low_pc
73; CHECK-NOT: DW_AT_stmt_list
74; CHECK-NOT: DW_AT_comp_dir
Eric Christopher420569b2014-02-20 02:50:45 +000075; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
Eric Christopherda4b2192013-01-02 23:52:13 +000076; CHECK: DW_TAG_variable
David Blaikie0b214e42016-03-24 18:37:08 +000077; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "a")
Manman Renf6b936b2013-10-29 05:49:41 +000078; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]})
Eric Christophere9ec2452013-01-18 22:11:33 +000079; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
80; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
Frederic Riss0982e692014-09-05 07:21:50 +000081; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
Eric Christopher4a741042014-02-16 08:46:55 +000082; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 )
Manman Renf6b936b2013-10-29 05:49:41 +000083; CHECK: [[TYPE]]: DW_TAG_base_type
David Blaikie0b214e42016-03-24 18:37:08 +000084; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "int")
Eric Christophere9ec2452013-01-18 22:11:33 +000085
David Blaikie622dce42014-01-08 23:29:59 +000086; CHECK: .debug_str contents:
87; CHECK: 0x00000000: "baz.dwo"
88; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
Eric Christopher962c9082013-01-15 23:56:56 +000089
90; CHECK: .debug_str.dwo contents:
David Blaikie0b214e42016-03-24 18:37:08 +000091; CHECK: 0x00000000: "baz.dwo"
92; CHECK: 0x00000008: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
93; CHECK: 0x0000003d: "baz.c"
94; CHECK: 0x00000043: "a"
95; CHECK: 0x00000045: "int"
Eric Christopher962c9082013-01-15 23:56:56 +000096
97; CHECK: .debug_str_offsets.dwo contents:
98; CHECK: 0x00000000: 00000000
David Blaikie0b214e42016-03-24 18:37:08 +000099; CHECK: 0x00000004: 00000008
100; CHECK: 0x00000008: 0000003d
101; CHECK: 0x0000000c: 00000043
102; CHECK: 0x00000010: 00000045
Eric Christopher55863be2013-04-07 03:43:09 +0000103
104; Object file checks
105; For x86-64-linux we should have this set of relocations for the debug info section
106;
107; OBJ: .debug_info
108; OBJ-NEXT: R_X86_64_32 .debug_abbrev
David Blaikie38fe6342014-01-09 04:28:46 +0000109; OBJ-NEXT: R_X86_64_32 .debug_line
Eric Christopher55863be2013-04-07 03:43:09 +0000110; OBJ-NEXT: R_X86_64_32 .debug_str
Eric Christopher55863be2013-04-07 03:43:09 +0000111; OBJ-NEXT: R_X86_64_32 .debug_str
David Blaikie330ec972014-03-21 20:27:21 +0000112; OBJ-NEXT: R_X86_64_32 .debug_addr
Eric Christopher55863be2013-04-07 03:43:09 +0000113; OBJ-NEXT: }
Eric Christopherd8667202013-12-30 17:22:27 +0000114
David Blaikie20474102014-02-25 22:46:44 +0000115; HDR-NOT: .debug_aranges
David Blaikie3c9a3cc2014-03-24 20:53:02 +0000116; HDR-NOT: .rela.{{.*}}.dwo
David Blaikie20474102014-02-25 22:46:44 +0000117
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000118!9 = !{i32 1, !"Debug Info Version", i32 3}