| 1 |
// RUN: llvm-mc %s -defsym ALIGN_4=1 -save-temp-labels -filetype obj -triple arm-none-eabi -o %t.o |
| 2 |
// RUN: llvm-nm %t.o | FileCheck %s --check-prefix=L4 |
| 3 |
// RUN: llvm-dwarfdump -debug-line %t.o 2>&1 | FileCheck %s --implicit-check-not='warning:' --check-prefix=MULT4 |
| 4 |
|
| 5 |
// RUN: llvm-mc %s -defsym ALIGN_8=1 -save-temp-labels -filetype obj -triple arm-none-eabi -o %t.o |
| 6 |
// RUN: llvm-nm %t.o | FileCheck %s --check-prefix=L8 |
| 7 |
// RUN: llvm-dwarfdump -debug-line %t.o 2>&1 | FileCheck %s --implicit-check-not='warning:' --check-prefix=MULT8 |
| 8 |
|
| 9 |
// RUN: llvm-mc %s -defsym UNALIGNED_PADDING=1 -save-temp-labels -filetype obj -triple arm-none-eabi -o %t.o |
| 10 |
// RUN: llvm-nm %t.o | FileCheck %s --check-prefix=LUNALIGN |
| 11 |
// RUN: llvm-dwarfdump -debug-line %t.o 2>&1 | FileCheck %s --check-prefix=UNALIGN |
| 12 |
|
| 13 |
/// This test is based on a real example from ARM C/C++ Compiler. |
| 14 |
/// It verifies llvm-dwarfdump is able to dump line tables even if they've been |
| 15 |
/// placed at aligned offsets. |
| 16 |
|
| 17 |
// L4: 0000002b N .Ltable0_end |
| 18 |
// MULT4: Address Line Column File ISA Discriminator OpIndex Flags |
| 19 |
// MULT4-NEXT: ------------------ ------ ------ ------ --- ------------- ------- ------------- |
| 20 |
// MULT4-NEXT: 0x0000000000000000 1 0 1 0 0 0 is_stmt end_sequence |
| 21 |
// MULT4-EMPTY: |
| 22 |
// MULT4-NEXT: debug_line[0x0000002c] |
| 23 |
// MULT4-NEXT: Line table prologue: |
| 24 |
// MULT4-NEXT: total_length: 0x0000003a{{$}} |
| 25 |
// MULT4-NEXT: format: DWARF32 |
| 26 |
// MULT4-NEXT: version: 2{{$}} |
| 27 |
// MULT4-NEXT: prologue_length: 0x0000001a |
| 28 |
// MULT4-NEXT: min_inst_length: 2 |
| 29 |
// MULT4-NEXT: default_is_stmt: 1 |
| 30 |
|
| 31 |
// L8: 00000027 N .Ltable0_end |
| 32 |
// MULT8: Address Line Column File ISA Discriminator OpIndex Flags |
| 33 |
// MULT8-NEXT: ------------------ ------ ------ ------ --- ------------- ------- ------------- |
| 34 |
// MULT8-NEXT: 0x0000000000000000 1 0 1 0 0 0 is_stmt end_sequence |
| 35 |
// MULT8-EMPTY: |
| 36 |
// MULT8-NEXT: debug_line[0x00000028] |
| 37 |
// MULT8-NEXT: Line table prologue: |
| 38 |
// MULT8-NEXT: total_length: 0x0000003a{{$}} |
| 39 |
// MULT8-NEXT: format: DWARF32 |
| 40 |
// MULT8-NEXT: version: 2{{$}} |
| 41 |
// MULT8-NEXT: prologue_length: 0x0000001a |
| 42 |
// MULT8-NEXT: min_inst_length: 2 |
| 43 |
// MULT8-NEXT: default_is_stmt: 1 |
| 44 |
|
| 45 |
/// This should fail to dump: |
| 46 |
// LUNALIGN: 00000027 N .Ltable0_end |
| 47 |
// UNALIGN: warning: parsing line table prologue at offset 0x00000027: unsupported version |
| 48 |
|
| 49 |
.section .debug_line |
| 50 |
/// First line table |
| 51 |
/// Unit total length: |
| 52 |
.long .Ltable0_end - .Ltable0_start |
| 53 |
.Ltable0_start: |
| 54 |
.short 2 /// Version |
| 55 |
/// Header length: |
| 56 |
.long .Ltable0_header_end - .Ltable0_header_start |
| 57 |
.Ltable0_header_start: |
| 58 |
.byte 4 /// Min instruction length |
| 59 |
.byte 1 /// Max operations per instruction |
| 60 |
.byte 0 /// Default is statement |
| 61 |
.byte 6 /// Line range |
| 62 |
.byte 10 /// Opcode base |
| 63 |
.byte 0 /// standard_opcode_lengths[DW_LNS_copy] = 0 |
| 64 |
.byte 1 /// standard_opcode_lengths[DW_LNS_advance_pc] = 1 |
| 65 |
.byte 1 /// standard_opcode_lengths[DW_LNS_advance_line] = 1 |
| 66 |
.byte 1 /// standard_opcode_lengths[DW_LNS_set_file] = 1 |
| 67 |
.byte 1 /// standard_opcode_lengths[DW_LNS_set_column] = 1 |
| 68 |
.byte 0 /// standard_opcode_lengths[DW_LNS_negate_stmt] = 0 |
| 69 |
.byte 0 /// standard_opcode_lengths[DW_LNS_set_basic_block] = 0 |
| 70 |
.byte 0 /// standard_opcode_lengths[DW_LNS_const_add_pc] = 0 |
| 71 |
.byte 0 /// standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 0 |
| 72 |
.byte 0 /// No include directories |
| 73 |
/// File name: |
| 74 |
.ifdef ALIGN_4 |
| 75 |
/// Pad out filename so next 4 byte aligned offset is a multiple of 4 and not 8. |
| 76 |
.asciz "foobar.cpp" |
| 77 |
.else |
| 78 |
.asciz "test.c" |
| 79 |
.endif |
| 80 |
.byte 0 /// Dir idx |
| 81 |
.byte 0 /// Mod time |
| 82 |
.byte 0 /// Length |
| 83 |
.byte 0 /// End files |
| 84 |
.Ltable0_header_end: |
| 85 |
/// Line table operations |
| 86 |
.byte 0 /// Extended opcode |
| 87 |
.byte 1 /// Length 1 |
| 88 |
.byte 1 /// DW_LNE_end_sequence |
| 89 |
.Ltable0_end: |
| 90 |
/// End first line table |
| 91 |
/// Padding: |
| 92 |
.ifdef UNALIGNED_PADDING |
| 93 |
.short 0 |
| 94 |
.else |
| 95 |
.byte 0 |
| 96 |
.endif |
| 97 |
/// Second line table |
| 98 |
/// Unit total length: |
| 99 |
.long .Ltable1_end - .Ltable1_start |
| 100 |
.Ltable1_start: |
| 101 |
.short 2 /// Version |
| 102 |
/// Header length: |
| 103 |
.long .Ltable1_header_end - .Ltable1_header_start |
| 104 |
.Ltable1_header_start: |
| 105 |
.byte 2 /// Min instruction length |
| 106 |
.byte 1 /// Max operations per instruction |
| 107 |
.byte 0 /// Default is statement |
| 108 |
.byte 6 /// Line range |
| 109 |
.byte 10 /// Opcode base |
| 110 |
.byte 0 /// standard_opcode_lengths[DW_LNS_copy] = 0 |
| 111 |
.byte 1 /// standard_opcode_lengths[DW_LNS_advance_pc] = 1 |
| 112 |
.byte 1 /// standard_opcode_lengths[DW_LNS_advance_line] = 1 |
| 113 |
.byte 1 /// standard_opcode_lengths[DW_LNS_set_file] = 1 |
| 114 |
.byte 1 /// standard_opcode_lengths[DW_LNS_set_column] = 1 |
| 115 |
.byte 0 /// standard_opcode_lengths[DW_LNS_negate_stmt] = 0 |
| 116 |
.byte 0 /// standard_opcode_lengths[DW_LNS_set_basic_block] = 0 |
| 117 |
.byte 0 /// standard_opcode_lengths[DW_LNS_const_add_pc] = 0 |
| 118 |
.byte 0 /// standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 0 |
| 119 |
.byte 0 /// No include directories |
| 120 |
.asciz "test.c" /// File name |
| 121 |
.byte 0 /// Dir idx |
| 122 |
.byte 0 /// Mod time |
| 123 |
.byte 0 /// Length |
| 124 |
.byte 0 /// End files |
| 125 |
.Ltable1_header_end: |
| 126 |
/// Line table operations |
| 127 |
.byte 4 /// DW_LNS_set_file |
| 128 |
.byte 1 /// File 1 |
| 129 |
.byte 5 /// DW_LNS_set_column |
| 130 |
.byte 1 /// Column 1 |
| 131 |
.byte 0 /// Extended opcode |
| 132 |
.byte 5 /// Length 5 |
| 133 |
.byte 2 /// DW_LNE_set_address |
| 134 |
.long 32896 /// Address = 0x00008080 |
| 135 |
.byte 3 /// DW_LNS_advance_line |
| 136 |
.byte 6 /// Line += 6 |
| 137 |
.byte 1 /// DW_LNS_copy |
| 138 |
.byte 5 /// DW_LNS_set_column |
| 139 |
.byte 2 /// Column 2 |
| 140 |
.byte 12 /// Special opcode (address += 0, line += 2) |
| 141 |
.byte 30 /// Special opcode (address += 6, line += 2) |
| 142 |
.byte 5 /// DW_LNS_set_column |
| 143 |
.byte 1 /// Column 1 |
| 144 |
.byte 17 /// Special opcode (address += 2, line += 1) |
| 145 |
.byte 2 /// DW_LNS_advance_pc |
| 146 |
.byte 4 /// += (4 * min instruction length) |
| 147 |
.byte 0 /// Extended opcode |
| 148 |
.byte 1 /// Length 1 |
| 149 |
.byte 1 /// DW_LNE_end_sequence |
| 150 |
.Ltable1_end: |
| 151 |
/// End second line table |
| 152 |
.short 0 /// Padding (to make section a word multiple) |