|
| 1 | +// Verify that the .loc_label instruction resets the line sequence and generates |
| 2 | +// the requested label at the correct position in the line stream |
| 3 | + |
| 4 | +// RUN: llvm-mc -filetype obj -triple x86_64-linux-elf %s -o %t.o |
| 5 | +// RUN: llvm-objdump -d %t.o | FileCheck %s --check-prefix=CHECK-ASM |
| 6 | +// RUN: llvm-dwarfdump -v --debug-line %t.o | FileCheck %s --check-prefix=CHECK-LINE-TABLE |
| 7 | + |
| 8 | +# CHECK-ASM: <foo>: |
| 9 | +# CHECK-ASM-NEXT: movq %rdx, 0x33 |
| 10 | +# CHECK-ASM-NEXT: movq %rax, 0x3b |
| 11 | +# CHECK-ASM-NEXT: movq %rbx, 0x4e |
| 12 | +# CHECK-ASM-NEXT: movq %rcx, 0x60 |
| 13 | +# CHECK-ASM-NEXT: retq |
| 14 | + |
| 15 | +# CHECK-LINE-TABLE: Address Line Column File ISA Discriminator OpIndex Flags |
| 16 | +# CHECK-LINE-TABLE-NEXT: ------------------ ------ ------ ------ --- ------------- ------- ------------- |
| 17 | +# CHECK-LINE-TABLE-NEXT: 0x00000028: 05 DW_LNS_set_column (1) |
| 18 | +# CHECK-LINE-TABLE-NEXT: 0x0000002a: 00 DW_LNE_set_address (0x0000000000000000) |
| 19 | +# CHECK-LINE-TABLE-NEXT: 0x00000035: 01 DW_LNS_copy |
| 20 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000000 1 1 1 0 0 0 is_stmt |
| 21 | +# CHECK-LINE-TABLE-NEXT: 0x00000036: 02 DW_LNS_advance_pc (addr += 33, op-index += 0) |
| 22 | +# CHECK-LINE-TABLE-NEXT: 0x00000038: 00 DW_LNE_end_sequence |
| 23 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000021 1 1 1 0 0 0 is_stmt end_sequence |
| 24 | +# CHECK-LINE-TABLE-NEXT: 0x0000003b: 05 DW_LNS_set_column (2) |
| 25 | +# CHECK-LINE-TABLE-NEXT: 0x0000003d: 00 DW_LNE_set_address (0x0000000000000008) |
| 26 | +# CHECK-LINE-TABLE-NEXT: 0x00000048: 01 DW_LNS_copy |
| 27 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000008 1 2 1 0 0 0 is_stmt |
| 28 | +# CHECK-LINE-TABLE-NEXT: 0x00000049: 02 DW_LNS_advance_pc (addr += 25, op-index += 0) |
| 29 | +# CHECK-LINE-TABLE-NEXT: 0x0000004b: 00 DW_LNE_end_sequence |
| 30 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000021 1 2 1 0 0 0 is_stmt end_sequence |
| 31 | +# CHECK-LINE-TABLE-NEXT: 0x0000004e: 05 DW_LNS_set_column (3) |
| 32 | +# CHECK-LINE-TABLE-NEXT: 0x00000050: 00 DW_LNE_set_address (0x0000000000000010) |
| 33 | +# CHECK-LINE-TABLE-NEXT: 0x0000005b: 01 DW_LNS_copy |
| 34 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000010 1 3 1 0 0 0 is_stmt |
| 35 | +# CHECK-LINE-TABLE-NEXT: 0x0000005c: 08 DW_LNS_const_add_pc (addr += 0x0000000000000011, op-index += 0) |
| 36 | +# CHECK-LINE-TABLE-NEXT: 0x0000005d: 00 DW_LNE_end_sequence |
| 37 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000021 1 3 1 0 0 0 is_stmt end_sequence |
| 38 | +# CHECK-LINE-TABLE-NEXT: 0x00000060: 05 DW_LNS_set_column (4) |
| 39 | +# CHECK-LINE-TABLE-NEXT: 0x00000062: 00 DW_LNE_set_address (0x0000000000000018) |
| 40 | +# CHECK-LINE-TABLE-NEXT: 0x0000006d: 01 DW_LNS_copy |
| 41 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 4 1 0 0 0 is_stmt |
| 42 | +# CHECK-LINE-TABLE-NEXT: 0x0000006e: 05 DW_LNS_set_column (5) |
| 43 | +# CHECK-LINE-TABLE-NEXT: 0x00000070: 01 DW_LNS_copy |
| 44 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 5 1 0 0 0 is_stmt |
| 45 | +# CHECK-LINE-TABLE-NEXT: 0x00000071: 02 DW_LNS_advance_pc (addr += 9, op-index += 0) |
| 46 | +# CHECK-LINE-TABLE-NEXT: 0x00000073: 00 DW_LNE_end_sequence |
| 47 | +# CHECK-LINE-TABLE-NEXT: 0x0000000000000021 1 5 1 0 0 0 is_stmt end_sequence |
| 48 | + .text |
| 49 | + .file "test.c" |
| 50 | + .globl foo |
| 51 | + .align 16, 0x90 |
| 52 | + .type foo,@function |
| 53 | +foo: |
| 54 | +.Lfunc_begin0: |
| 55 | + .file 1 "test.c" |
| 56 | + .cfi_startproc |
| 57 | + .loc 1 1 1 |
| 58 | + mov %rdx, 0x33 |
| 59 | + .loc_label my_label_02 |
| 60 | + .loc 1 1 2 |
| 61 | + movq %rax, my_label_02-.Lline_table_start0 |
| 62 | + .loc 1 1 3 |
| 63 | + .loc_label my_label_03 |
| 64 | + .loc_label my_label_03.1 |
| 65 | + movq %rbx, my_label_03-.Lline_table_start0 |
| 66 | + .loc 1 1 4 |
| 67 | + .loc_label my_label_05 |
| 68 | + .loc 1 1 5 |
| 69 | + movq %rcx, my_label_05-.Lline_table_start0 |
| 70 | + ret |
| 71 | + .cfi_endproc |
| 72 | + |
| 73 | + .section .debug_line,"",@progbits |
| 74 | +.Lline_table_start0: |
0 commit comments