1 ; RUN: llc -split-dwarf-file=baz.dwo -O0 %s -mtriple=wasm32-unknown-unknown -filetype=obj -o %t
2 ; RUN: llvm-dwarfdump -v -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
6 ; This test is derived from test/DebugInfo/X86/fission-cu.ll
8 source_filename = "test/DebugInfo/WebAssembly/fission-cu.ll"
10 @a = global i32 0, align 4, !dbg !0
13 !llvm.module.flags = !{!7}
15 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
16 !1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
17 !2 = !DIFile(filename: "baz.c", directory: "/usr/local/google/home/echristo/tmp")
18 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
19 !4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "baz.dwo", emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5)
21 ; Check that the skeleton compile unit contains the proper attributes:
22 ; This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list,
23 ; DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id,
24 ; DW_AT_ranges_base, DW_AT_addr_base.
26 ; CHECK: .debug_abbrev contents:
27 ; CHECK: Abbrev table for offset: 0x00000000
28 ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
29 ; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
30 ; CHECK: DW_AT_comp_dir DW_FORM_strp
31 ; CHECK: DW_AT_GNU_dwo_name DW_FORM_strp
32 ; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
34 ; Check that we're using the right forms.
35 ; CHECK: .debug_abbrev.dwo contents:
36 ; CHECK: Abbrev table for offset: 0x00000000
37 ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes
38 ; CHECK: DW_AT_producer DW_FORM_GNU_str_index
39 ; CHECK: DW_AT_language DW_FORM_data2
40 ; CHECK: DW_AT_name DW_FORM_GNU_str_index
41 ; CHECK: DW_AT_GNU_dwo_name DW_FORM_GNU_str_index
42 ; CHECK-NOT: DW_AT_low_pc
43 ; CHECK-NOT: DW_AT_stmt_list
44 ; CHECK-NOT: DW_AT_comp_dir
45 ; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
47 ; CHECK: [2] DW_TAG_variable DW_CHILDREN_no
48 ; CHECK: DW_AT_name DW_FORM_GNU_str_index
49 ; CHECK: DW_AT_type DW_FORM_ref4
50 ; CHECK: DW_AT_external DW_FORM_flag_present
51 ; CHECK: DW_AT_decl_file DW_FORM_data1
52 ; CHECK: DW_AT_decl_line DW_FORM_data1
53 ; CHECK: DW_AT_location DW_FORM_exprloc
55 ; CHECK: [3] DW_TAG_base_type DW_CHILDREN_no
56 ; CHECK: DW_AT_name DW_FORM_GNU_str_index
57 ; CHECK: DW_AT_encoding DW_FORM_data1
58 ; CHECK: DW_AT_byte_size DW_FORM_data1
60 ; CHECK: .debug_info contents:
61 ; CHECK: DW_TAG_compile_unit
62 ; CHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
63 ; CHECK-NEXT: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000000] = "/usr/local/google/home/echristo/tmp")
64 ; CHECK-NEXT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000024] = "baz.dwo")
65 ; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
67 ; Check that the rest of the compile units have information.
68 ; CHECK: .debug_info.dwo contents:
69 ; CHECK: DW_TAG_compile_unit
70 ; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] (indexed (00000002) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
71 ; CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99)
72 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000003) string = "baz.c")
73 ; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] (indexed (00000004) string = "baz.dwo")
74 ; CHECK-NOT: DW_AT_low_pc
75 ; CHECK-NOT: DW_AT_stmt_list
76 ; CHECK-NOT: DW_AT_comp_dir
77 ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
78 ; CHECK: DW_TAG_variable
79 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000000) string = "a")
80 ; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]}
81 ; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
82 ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
83 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
84 ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0)
85 ; CHECK: [[TYPE]]: DW_TAG_base_type
86 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000001) string = "int")
88 ; CHECK: .debug_str contents:
89 ; CHECK: 0x00000000: "/usr/local/google/home/echristo/tmp"
90 ; CHECK: 0x00000024: "baz.dwo"
92 ; CHECK: .debug_str.dwo contents:
93 ; CHECK: 0x00000000: "a"
94 ; CHECK: 0x00000002: "int"
95 ; CHECK: 0x00000006: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
96 ; CHECK: 0x0000003b: "baz.c"
97 ; CHECK: 0x00000041: "baz.dwo"
99 ; CHECK: .debug_str_offsets.dwo contents:
100 ; CHECK: 0x00000000: 00000000
101 ; CHECK: 0x00000004: 00000002
102 ; CHECK: 0x00000008: 00000006
103 ; CHECK: 0x0000000c: 0000003b
104 ; CHECK: 0x00000010: 00000041
107 ; For wasm we should have this set of relocations for the debug info section
110 ; OBJ-NEXT: R_WASM_SECTION_OFFSET_I32 .debug_abbrev 0
111 ; OBJ-NEXT: R_WASM_SECTION_OFFSET_I32 .debug_line 0
112 ; OBJ-NEXT: R_WASM_SECTION_OFFSET_I32 .debug_str 0
113 ; OBJ-NEXT: R_WASM_SECTION_OFFSET_I32 .debug_str 36
114 ; OBJ-NEXT: R_WASM_SECTION_OFFSET_I32 .debug_addr 0
117 ; HDR-NOT: .debug_aranges
118 ; HDR-NOT: .rela.{{.*}}.dwo
121 !7 = !{i32 1, !"Debug Info Version", i32 3}