1 ; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
3 ; CHECK: .debug_info contents:
4 ; CHECK-NEXT: 0x00000000: Compile Unit: length = 0x00000066 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x0000006a)
6 ; CHECK: 0x0000000b: DW_TAG_compile_unit
7 ; CHECK-NEXT: DW_AT_producer ("clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)")
8 ; CHECK-NEXT: DW_AT_language (DW_LANG_C99)
9 ; CHECK-NEXT: DW_AT_name ("test.c")
10 ; CHECK-NEXT: DW_AT_stmt_list (0x00000000)
11 ; CHECK-NEXT: DW_AT_comp_dir ("/usr/local/google/home/sbc/dev/wasm/simple")
12 ; CHECK-NEXT: DW_AT_GNU_pubnames (true)
13 ; CHECK-NEXT: DW_AT_low_pc (0x0000000000000002)
14 ; CHECK-NEXT: DW_AT_high_pc (0x0000000000000004)
16 ; CHECK: 0x00000026: DW_TAG_variable
17 ; CHECK-NEXT: DW_AT_name ("foo")
18 ; CHECK-NEXT: DW_AT_type (0x00000037 "int*")
19 ; CHECK-NEXT: DW_AT_external (true)
20 ; CHECK-NEXT: DW_AT_decl_file ("/usr/local/google/home/sbc/dev/wasm/simple{{[/\\]}}test.c")
21 ; CHECK-NEXT: DW_AT_decl_line (4)
22 ; CHECK-NEXT: DW_AT_location (DW_OP_addr 0x0)
24 ; CHECK: 0x00000037: DW_TAG_pointer_type
25 ; CHECK-NEXT: DW_AT_type (0x0000003c "int")
27 ; CHECK: 0x0000003c: DW_TAG_base_type
28 ; CHECK-NEXT: DW_AT_name ("int")
29 ; CHECK-NEXT: DW_AT_encoding (DW_ATE_signed)
30 ; CHECK-NEXT: DW_AT_byte_size (0x04)
32 ; CHECK: 0x00000043: DW_TAG_variable
33 ; CHECK-NEXT: DW_AT_name ("ptr2")
34 ; CHECK-NEXT: DW_AT_type (0x00000054 "void()*")
35 ; CHECK-NEXT: DW_AT_external (true)
36 ; CHECK-NEXT: DW_AT_decl_file ("/usr/local/google/home/sbc/dev/wasm/simple{{[/\\]}}test.c")
37 ; CHECK-NEXT: DW_AT_decl_line (5)
38 ; CHECK-NEXT: DW_AT_location (DW_OP_addr 0x4)
40 ; CHECK: 0x00000054: DW_TAG_pointer_type
41 ; CHECK-NEXT: DW_AT_type (0x00000059 "void()")
43 ; CHECK: 0x00000059: DW_TAG_subroutine_type
44 ; CHECK-NEXT: DW_AT_prototyped (true)
46 ; CHECK: 0x0000005a: DW_TAG_subprogram
47 ; CHECK-NEXT: DW_AT_low_pc (0x0000000000000002)
48 ; CHECK-NEXT: DW_AT_high_pc (0x0000000000000004)
49 ; CHECK-NEXT: DW_AT_name ("f2")
50 ; CHECK-NEXT: DW_AT_decl_file ("/usr/local/google/home/sbc/dev/wasm/simple{{[/\\]}}test.c")
51 ; CHECK-NEXT: DW_AT_decl_line (2)
52 ; CHECK-NEXT: DW_AT_prototyped (true)
53 ; CHECK-NEXT: DW_AT_external (true)
55 ; CHECK: 0x00000069: NULL
57 target triple = "wasm32-unknown-unknown"
59 source_filename = "test.c"
61 @myextern = external global i32, align 4
62 @foo = hidden global i32* @myextern, align 4, !dbg !0
63 @ptr2 = hidden global void ()* @f2, align 4, !dbg !6
65 ; Function Attrs: noinline nounwind optnone
66 define hidden void @f2() #0 !dbg !17 {
71 attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
74 !llvm.module.flags = !{!13, !14, !15}
77 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
78 !1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true)
79 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
80 !3 = !DIFile(filename: "test.c", directory: "/usr/local/google/home/sbc/dev/wasm/simple")
83 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
84 !7 = distinct !DIGlobalVariable(name: "ptr2", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true)
85 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32)
86 !9 = !DISubroutineType(types: !10)
88 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32)
89 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
90 !13 = !{i32 2, !"Dwarf Version", i32 4}
91 !14 = !{i32 2, !"Debug Info Version", i32 3}
92 !15 = !{i32 1, !"wchar_size", i32 4}
93 !16 = !{!"clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)"}
94 !17 = distinct !DISubprogram(name: "f2", scope: !3, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
95 !18 = !DILocation(line: 2, column: 16, scope: !17)