Anatoly Trosinenko | a5bd75a | 2020-06-22 13:14:02 +0300 | [diff] [blame] | 1 | ; RUN: llc --filetype=obj -o %t < %s |
| 2 | ; RUN: llvm-dwarfdump --debug-info %t | FileCheck %s |
| 3 | ; RUN: llvm-dwarfdump --verify %t |
| 4 | |
| 5 | ; This file was based on output of |
| 6 | ; |
| 7 | ; clang -target msp430 -S -emit-llvm -gdwarf-3 -Os dwarf-basics.c |
| 8 | ; |
| 9 | ; for the following dwarf-basics.c |
| 10 | ; |
| 11 | ; struct X { |
| 12 | ; void *a; |
| 13 | ; }; |
| 14 | ; |
| 15 | ; int f(long y, struct X *p) |
| 16 | ; { |
| 17 | ; return 42; |
| 18 | ; } |
| 19 | ; |
| 20 | |
| 21 | ; CHECK: file format elf32-msp430 |
| 22 | |
| 23 | ; CHECK: .debug_info contents: |
| 24 | ; CHECK: Compile Unit: length = 0x{{.*}}, format = DWARF32, version = 0x0003, abbr_offset = 0x0000, addr_size = 0x02 (next unit at 0x{{.*}}) |
| 25 | |
| 26 | ; CHECK: DW_TAG_compile_unit |
| 27 | ; CHECK: DW_AT_producer ("clang version 11.0.0 (git@...)") |
| 28 | ; CHECK: DW_AT_language (DW_LANG_C99) |
| 29 | ; CHECK: DW_AT_name ("dwarf-basics.c") |
| 30 | ; CHECK: DW_AT_stmt_list (0x{{.*}}) |
| 31 | ; CHECK: DW_AT_comp_dir ("/tmp") |
| 32 | ; CHECK: DW_AT_low_pc (0x{{.*}}) |
| 33 | ; CHECK: DW_AT_high_pc (0x{{.*}}) |
| 34 | |
| 35 | ; CHECK: DW_TAG_subprogram |
| 36 | ; CHECK: DW_AT_low_pc (0x{{.*}}) |
| 37 | ; CHECK: DW_AT_high_pc (0x{{.*}}) |
| 38 | ; CHECK: DW_AT_frame_base (DW_OP_reg1 SPB) |
| 39 | ; CHECK: DW_AT_name ("f") |
Anton Korobeynikov | 16cc759 | 2020-06-22 14:29:32 +0300 | [diff] [blame] | 40 | ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c") |
Anatoly Trosinenko | a5bd75a | 2020-06-22 13:14:02 +0300 | [diff] [blame] | 41 | ; CHECK: DW_AT_decl_line (5) |
| 42 | ; CHECK: DW_AT_prototyped (0x01) |
| 43 | ; CHECK: DW_AT_type (0x{{.*}} "int") |
| 44 | ; CHECK: DW_AT_external (0x01) |
| 45 | |
| 46 | ; CHECK: DW_TAG_formal_parameter |
| 47 | ; CHECK: DW_AT_location (0x{{.*}}: |
| 48 | ; CHECK: [0x0000, 0x0004): DW_OP_reg12 R12B) |
| 49 | ; CHECK: DW_AT_name ("y") |
Anton Korobeynikov | 16cc759 | 2020-06-22 14:29:32 +0300 | [diff] [blame] | 50 | ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c") |
Anatoly Trosinenko | a5bd75a | 2020-06-22 13:14:02 +0300 | [diff] [blame] | 51 | ; CHECK: DW_AT_decl_line (5) |
| 52 | ; CHECK: DW_AT_type (0x{{.*}} "long int") |
| 53 | |
| 54 | ; CHECK: DW_TAG_formal_parameter |
| 55 | ; CHECK: DW_AT_location (DW_OP_reg14 R14B) |
| 56 | ; CHECK: DW_AT_name ("p") |
Anton Korobeynikov | 16cc759 | 2020-06-22 14:29:32 +0300 | [diff] [blame] | 57 | ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c") |
Anatoly Trosinenko | a5bd75a | 2020-06-22 13:14:02 +0300 | [diff] [blame] | 58 | ; CHECK: DW_AT_decl_line (5) |
| 59 | ; CHECK: DW_AT_type (0x{{.*}} "X*") |
| 60 | |
| 61 | ; CHECK: NULL |
| 62 | |
| 63 | ; CHECK: DW_TAG_base_type |
| 64 | ; CHECK: DW_AT_name ("int") |
| 65 | ; CHECK: DW_AT_encoding (DW_ATE_signed) |
| 66 | ; CHECK: DW_AT_byte_size (0x02) |
| 67 | |
| 68 | ; CHECK: DW_TAG_base_type |
| 69 | ; CHECK: DW_AT_name ("long int") |
| 70 | ; CHECK: DW_AT_encoding (DW_ATE_signed) |
| 71 | ; CHECK: DW_AT_byte_size (0x04) |
| 72 | |
| 73 | ; CHECK: DW_TAG_pointer_type |
| 74 | ; CHECK: DW_AT_type (0x{{.*}} "X") |
| 75 | |
| 76 | ; CHECK: DW_TAG_structure_type |
| 77 | ; CHECK: DW_AT_name ("X") |
| 78 | ; CHECK: DW_AT_byte_size (0x02) |
Anton Korobeynikov | 16cc759 | 2020-06-22 14:29:32 +0300 | [diff] [blame] | 79 | ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c") |
Anatoly Trosinenko | a5bd75a | 2020-06-22 13:14:02 +0300 | [diff] [blame] | 80 | ; CHECK: DW_AT_decl_line (1) |
| 81 | |
| 82 | ; CHECK: DW_TAG_member |
| 83 | ; CHECK: DW_AT_name ("a") |
| 84 | ; CHECK: DW_AT_type (0x{{.*}} "*") |
Anton Korobeynikov | 16cc759 | 2020-06-22 14:29:32 +0300 | [diff] [blame] | 85 | ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c") |
Anatoly Trosinenko | a5bd75a | 2020-06-22 13:14:02 +0300 | [diff] [blame] | 86 | ; CHECK: DW_AT_decl_line (2) |
| 87 | ; CHECK: DW_AT_data_member_location (0x00) |
| 88 | |
| 89 | ; CHECK: NULL |
| 90 | |
| 91 | ; CHECK: DW_TAG_pointer_type |
| 92 | |
| 93 | ; CHECK: NULL |
| 94 | |
| 95 | |
| 96 | source_filename = "dwarf-basics.c" |
| 97 | target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16" |
| 98 | target triple = "msp430" |
| 99 | |
| 100 | %struct.X = type { i8* } |
| 101 | |
| 102 | define i16 @f(i32 %y, %struct.X* %p) !dbg !7 { |
| 103 | entry: |
| 104 | call void @llvm.dbg.value(metadata i32 %y, metadata !18, metadata !DIExpression()), !dbg !20 |
| 105 | call void @llvm.dbg.value(metadata %struct.X* %p, metadata !19, metadata !DIExpression()), !dbg !20 |
| 106 | ret i16 42, !dbg !21 |
| 107 | } |
| 108 | |
| 109 | declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 110 | |
| 111 | !llvm.dbg.cu = !{!0} |
| 112 | !llvm.module.flags = !{!3, !4, !5} |
| 113 | !llvm.ident = !{!6} |
| 114 | |
| 115 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (git@...)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) |
| 116 | !1 = !DIFile(filename: "dwarf-basics.c", directory: "/tmp") |
| 117 | !2 = !{} |
| 118 | !3 = !{i32 7, !"Dwarf Version", i32 3} |
| 119 | !4 = !{i32 2, !"Debug Info Version", i32 3} |
| 120 | !5 = !{i32 1, !"wchar_size", i32 2} |
| 121 | !6 = !{!"clang version 11.0.0 (git@...)"} |
| 122 | !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 5, type: !8, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17) |
| 123 | !8 = !DISubroutineType(types: !9) |
| 124 | !9 = !{!10, !11, !12} |
| 125 | !10 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed) |
| 126 | !11 = !DIBasicType(name: "long int", size: 32, encoding: DW_ATE_signed) |
| 127 | !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 16) |
| 128 | !13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "X", file: !1, line: 1, size: 16, elements: !14) |
| 129 | !14 = !{!15} |
| 130 | !15 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !13, file: !1, line: 2, baseType: !16, size: 16) |
| 131 | !16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 16) |
| 132 | !17 = !{!18, !19} |
| 133 | !18 = !DILocalVariable(name: "y", arg: 1, scope: !7, file: !1, line: 5, type: !11) |
| 134 | !19 = !DILocalVariable(name: "p", arg: 2, scope: !7, file: !1, line: 5, type: !12) |
| 135 | !20 = !DILocation(line: 0, scope: !7) |
| 136 | !21 = !DILocation(line: 7, column: 3, scope: !7) |