106 lines · plain
1// Verify that the .loc_label instruction resets the line sequence and generates2// the requested label at the correct position in the line stream3 4// RUN: llvm-mc -filetype obj -triple x86_64 %s -o %t.o5// RUN: llvm-dwarfdump -v --debug-line %t.o | FileCheck %s --check-prefix=CHECK-LINE-TABLE6// RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM7// RUN: llvm-objdump -s -j .offsets %t.o | FileCheck %s --check-prefix=CHECK-OFFSETS8 9// RUN: not llvm-mc -filetype obj -triple x86_64 --defsym ERR=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:10// RUN: not llvm-mc -filetype obj -triple x86_64 --defsym ERR2=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2 --implicit-check-not=error:11 12 13 14# CHECK-LINE-TABLE: Address Line Column File ISA Discriminator OpIndex Flags15# CHECK-LINE-TABLE-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------16# CHECK-LINE-TABLE-NEXT: 0x00000028: 05 DW_LNS_set_column (1)17# CHECK-LINE-TABLE-NEXT: 0x0000002a: 00 DW_LNE_set_address (0x0000000000000000)18# CHECK-LINE-TABLE-NEXT: 0x00000035: 01 DW_LNS_copy19# CHECK-LINE-TABLE-NEXT: 0x0000000000000000 1 1 1 0 0 0 is_stmt20# CHECK-LINE-TABLE-NEXT: 0x00000036: 02 DW_LNS_advance_pc (addr += 8, op-index += 0)21# CHECK-LINE-TABLE-NEXT: 0x00000038: 00 DW_LNE_end_sequence22# CHECK-LINE-TABLE-NEXT: 0x0000000000000008 1 1 1 0 0 0 is_stmt end_sequence23# CHECK-LINE-TABLE-NEXT: 0x0000003b: 05 DW_LNS_set_column (2)24# CHECK-LINE-TABLE-NEXT: 0x0000003d: 00 DW_LNE_set_address (0x0000000000000008)25# CHECK-LINE-TABLE-NEXT: 0x00000048: 01 DW_LNS_copy26# CHECK-LINE-TABLE-NEXT: 0x0000000000000008 1 2 1 0 0 0 is_stmt27# CHECK-LINE-TABLE-NEXT: 0x00000049: 02 DW_LNS_advance_pc (addr += 8, op-index += 0)28# CHECK-LINE-TABLE-NEXT: 0x0000004b: 00 DW_LNE_end_sequence29# CHECK-LINE-TABLE-NEXT: 0x0000000000000010 1 2 1 0 0 0 is_stmt end_sequence30# CHECK-LINE-TABLE-NEXT: 0x0000004e: 05 DW_LNS_set_column (3)31# CHECK-LINE-TABLE-NEXT: 0x00000050: 00 DW_LNE_set_address (0x0000000000000010)32# CHECK-LINE-TABLE-NEXT: 0x0000005b: 01 DW_LNS_copy33# CHECK-LINE-TABLE-NEXT: 0x0000000000000010 1 3 1 0 0 0 is_stmt34# CHECK-LINE-TABLE-NEXT: 0x0000005c: 02 DW_LNS_advance_pc (addr += 8, op-index += 0)35# CHECK-LINE-TABLE-NEXT: 0x0000005e: 00 DW_LNE_end_sequence36# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 3 1 0 0 0 is_stmt end_sequence37# CHECK-LINE-TABLE-NEXT: 0x00000061: 05 DW_LNS_set_column (4)38# CHECK-LINE-TABLE-NEXT: 0x00000063: 00 DW_LNE_set_address (0x0000000000000018)39# CHECK-LINE-TABLE-NEXT: 0x0000006e: 01 DW_LNS_copy40# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 4 1 0 0 0 is_stmt41# CHECK-LINE-TABLE-NEXT: 0x0000006f: 05 DW_LNS_set_column (5)42# CHECK-LINE-TABLE-NEXT: 0x00000071: 01 DW_LNS_copy43# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 5 1 0 0 0 is_stmt44# CHECK-LINE-TABLE-NEXT: 0x00000072: 02 DW_LNS_advance_pc (addr += 8, op-index += 0)45# CHECK-LINE-TABLE-NEXT: 0x00000074: 00 DW_LNE_end_sequence46# CHECK-LINE-TABLE-NEXT: 0x0000000000000020 1 5 1 0 0 0 is_stmt end_sequence47 48# CHECK-SYM: Symbol table '.symtab' contains 9 entries:49# CHECK-SYM-NEXT: Num: Value Size Type Bind Vis Ndx Name50# CHECK-SYM-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND51# CHECK-SYM-NEXT: 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c52# CHECK-SYM-NEXT: 2: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text53# CHECK-SYM-NEXT: 3: 000000000000003b 0 NOTYPE LOCAL DEFAULT 3 my_label_0254# CHECK-SYM-NEXT: 4: 000000000000004e 0 NOTYPE LOCAL DEFAULT 3 my_label_0355# CHECK-SYM-NEXT: 5: 0000000000000061 0 NOTYPE LOCAL DEFAULT 3 my_label_0456# CHECK-SYM-NEXT: 6: 000000000000004e 0 NOTYPE LOCAL DEFAULT 3 my_label_03.157# CHECK-SYM-NEXT: 7: 0000000000000077 0 NOTYPE LOCAL DEFAULT 3 my_label_0558# CHECK-SYM-NEXT: 8: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 foo59 60# CHECK-OFFSETS: 0000 3b000000 4e000000 6100000061 62 .text63 .file "test.c"64 .globl foo65 .align 16, 0x9066 .type foo,@function67foo:68.Lfunc_begin0:69 .file 1 "test.c"70 .cfi_startproc71 .loc 1 1 172 mov %rax, 0x0173 .loc_label my_label_0274 .loc 1 1 275 mov %rax, 0x0276 .loc 1 1 377 .loc_label my_label_0378 .loc_label my_label_03.179 mov %rax, 0x0380 .loc 1 1 481 .loc_label my_label_0482 .loc 1 1 583.ifdef ERR84 .loc_label my_label_0485# ERR: [[#@LINE+1]]:13: error: expected identifier86 .loc_label87# ERR: [[#@LINE+1]]:19: error: expected newline88 .loc_label aaaa bbbb89.endif90.ifdef ERR291# ERR2: [[#@LINE+1]]:14: error: symbol 'my_label_04' is already defined92 .loc_label my_label_0493.endif94 mov %rax, 0x0495 .loc_label my_label_0596 ret97 .cfi_endproc98 99 .section .debug_line,"",@progbits100.Lline_table_start0:101 102 .section .offsets,"",@progbits103 .long my_label_02-.Lline_table_start0104 .long my_label_03-.Lline_table_start0105 .long my_label_04-.Lline_table_start0106