• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
5
6@a = common global i32 0, align 4
7
8!llvm.dbg.cu = !{!0}
9!llvm.module.flags = !{!9}
10
11!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)
12!1 = !{}
13!3 = !{!5}
14!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")
18
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
24; CHECK: .debug_abbrev contents:
25; CHECK: Abbrev table for offset: 0x00000000
26; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
27; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
28; CHECK: DW_AT_GNU_dwo_name      DW_FORM_strp
29; CHECK: DW_AT_comp_dir  DW_FORM_strp
30; CHECK: DW_AT_GNU_dwo_id        DW_FORM_data8
31
32; 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_GNU_dwo_name  DW_FORM_GNU_str_index
37; 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
40; CHECK-NOT: DW_AT_low_pc
41; CHECK-NOT: DW_AT_stmt_list
42; CHECK-NOT: DW_AT_comp_dir
43; CHECK: DW_AT_GNU_dwo_id        DW_FORM_data8
44
45; CHECK: [2] DW_TAG_variable     DW_CHILDREN_no
46; 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
51; CHECK: DW_AT_location  DW_FORM_exprloc
52
53; 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
58; CHECK: .debug_info contents:
59; CHECK: DW_TAG_compile_unit
60; 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")
63; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x1f1f859683d49324)
64
65; Check that the rest of the compile units have information.
66; CHECK: .debug_info.dwo contents:
67; CHECK: DW_TAG_compile_unit
68; 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)")
70; CHECK: DW_AT_language [DW_FORM_data2]        (DW_LANG_C99)
71; CHECK: DW_AT_name [DW_FORM_GNU_str_index]    ( indexed (00000002) string = "baz.c")
72; CHECK-NOT: DW_AT_low_pc
73; CHECK-NOT: DW_AT_stmt_list
74; CHECK-NOT: DW_AT_comp_dir
75; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x1f1f859683d49324)
76; CHECK: DW_TAG_variable
77; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000003) string = "a")
78; CHECK: DW_AT_type [DW_FORM_ref4]       (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]})
79; CHECK: DW_AT_external [DW_FORM_flag_present]   (true)
80; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
81; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
82; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 )
83; CHECK: [[TYPE]]: DW_TAG_base_type
84; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000004) string = "int")
85
86; CHECK: .debug_str contents:
87; CHECK: 0x00000000: "baz.dwo"
88; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
89
90; CHECK: .debug_str.dwo contents:
91; 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"
96
97; CHECK: .debug_str_offsets.dwo contents:
98; CHECK: 0x00000000: 00000000
99; CHECK: 0x00000004: 00000008
100; CHECK: 0x00000008: 0000003d
101; CHECK: 0x0000000c: 00000043
102; CHECK: 0x00000010: 00000045
103
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
109; OBJ-NEXT: R_X86_64_32 .debug_line
110; OBJ-NEXT: R_X86_64_32 .debug_str
111; OBJ-NEXT: R_X86_64_32 .debug_str
112; OBJ-NEXT: R_X86_64_32 .debug_addr
113; OBJ-NEXT: }
114
115; HDR-NOT: .debug_aranges
116; HDR-NOT: .rela.{{.*}}.dwo
117
118!9 = !{i32 1, !"Debug Info Version", i32 3}
119