144 lines · plain
1## Test the "--skip-line-zero" option.2##3## This test uses handcrafted assembly to produce the following line table:4## Address Line Column File ISA Discriminator OpIndex Flags5## ------------------ ------ ------ ------ --- ------------- ------- -------------6## 0x0000000000001710 1 0 1 0 0 07## 0x0000000000001714 0 0 1 0 0 08## 0x0000000000001719 1 2 1 0 0 09## 0x000000000000171b 1 2 1 0 0 0 end_sequence10## 0x00000000000016c0 0 0 1 0 0 011## 0x00000000000016cf 2 0 1 0 0 012## 0x00000000000016d4 0 0 1 0 0 013## 0x00000000000016d9 0 0 1 0 0 014## 0x00000000000016df 0 0 1 0 0 0 end_sequence15 16# REQUIRES: x86-registered-target17 18# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o19 20## Check that without '--skip-line-zero', line zero is displayed for a line-table entry which has no source correspondence.21# RUN: llvm-symbolizer --obj=%t.o -f=none 0x16d4 | FileCheck --strict-whitespace --match-full-lines --check-prefix=DISABLE %s22 23# DISABLE:main.c:0:024 25## Check that the '--skip-line-zero' does not cross sequence boundaries.26## If it fails to find in the current sequence then line zero is returned for the queried address.27# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero 0x16c0 | FileCheck --strict-whitespace --match-full-lines --check-prefix=FAIL-ACROSS-SEQ %s28 29# FAIL-ACROSS-SEQ:main.c:0:030 31## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed.32# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=WITHIN-SEQ %s33 34# WITHIN-SEQ:main.c:1:0 (approximate)35 36## Check that with '--skip-line-zero', multiple line zero rows are skipped within the current sequence.37# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero 0x16d9 | FileCheck --strict-whitespace --match-full-lines --check-prefix=MULTIPLE-ROWS %s38 39# MULTIPLE-ROWS:main.c:2:0 (approximate)40 41## Check that '--skip-line-zero' only affects the line zero addresses when more than one address is specified.42# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero 0x16d4 0x1719 | FileCheck --strict-whitespace --match-full-lines --check-prefixes=ENABLE,NO-APPROX %s43 44# ENABLE:main.c:2:0 (approximate)45# NO-APPROX:main.c:1:246 47## Check to ensure that '--skip-line-zero' with '--verbose' enabled displays approximate flag in verbose ouptut.48# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero --verbose 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=VERBOSE %s49 50# VERBOSE: Filename: main.c51# VERBOSE-NEXT: Line: 152# VERBOSE-NEXT: Column: 053# VERBOSE-NEXT: Approximate: true54 55## Check to ensure that '--skip-line-zero' with '--output-style=JSON' displays approximate flag in JSON output.56# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero --output-style=JSON 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=JSON %s57 58# JSON:[{"Address":"0x1717","ModuleName":"{{.*}}{{[/|\]+}}skip-line-zero.s{{.*}}","Symbol":[{"Approximate":true,"Column":0,"Discriminator":0,"FileName":"main.c","FunctionName":"","Line":1,"StartAddress":"","StartFileName":"","StartLine":0}]}]59 60## main.c61## __attribute__((section("def"))) int foo() { return 1234; }62## int main(void) { return foo()+5678; }63##64## Generated using65## clang -S -gdwarf-4 --target=x86_64-pc-linux -fdebug-prefix-map=/tmp="" main.c -o main.s66##67## Sections belonging to code segment(.text) are removed. Sections related to debug information(other than .debug_line) are modified. Section .debug_line is handwritten. Section .debug_str is deleted.68 69 .section .debug_abbrev,"",@progbits70 .byte 1 # Abbreviation Code71 .byte 17 # DW_TAG_compile_unit72 .byte 0 # DW_CHILDREN_no73 .byte 16 # DW_AT_stmt_list74 .byte 23 # DW_FORM_sec_offset75 .byte 17 # DW_AT_low_pc76 .byte 1 # DW_FORM_addr77 .byte 85 # DW_AT_ranges78 .byte 23 # DW_FORM_sec_offset79 .byte 0 # EOM(1)80 .byte 0 # EOM(2)81 .byte 0 # EOM(3)82 .section .debug_info,"",@progbits83.Lcu_begin0:84 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit85.Ldebug_info_start0:86 .short 4 # DWARF version number87 .long .debug_abbrev # Offset Into Abbrev. Section88 .byte 8 # Address Size (in bytes)89 .byte 1 # Abbrev [1] 0xb:0x55 DW_TAG_compile_unit90 .long .Lline_table_start0 # DW_AT_stmt_list91 .quad 0 # DW_AT_low_pc92 .long .Ldebug_ranges0 # DW_AT_ranges93 .byte 0 # End Of Children Mark94.Ldebug_info_end0:95 .section .debug_ranges,"",@progbits96.Ldebug_ranges0:97 .quad 0x1710 #.Lfunc_begin098 .quad 0x171b #.Lfunc_end099 .quad 0x16c0 #.Lfunc_begin1100 .quad 0x16df #.Lfunc_end1101 .quad 0102 .quad 0103 .section .debug_line,"",@progbits104.Lline_table_start0:105 .long .Lunit_end - .Lunit_start # unit length106.Lunit_start:107 .short 4 # version108 .long .Lprologue_end - .Lprologue_start # header length109.Lprologue_start:110 .byte 1 # minimum_instruction_length111 .byte 1 # maximum_operations_per_instruction112 .byte 0 # default_is_stmt113 .byte -5 # line_base114 .byte 14 # line_range115 .byte 13 # opcode_base116 .byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 # arguments in standard opcodes117 .byte 0 # end of include directories118 .asciz "main.c" # filename119 .byte 0 # directory index120 .byte 0 # modification time121 .byte 0 # length of file (unavailable)122 .byte 0 # end of filenames123.Lprologue_end:124 .byte 0x00, 9, 2 # DW_LNE_set_address125 .quad 0x1710 # Address Value126 .byte 0x01 # DW_LNS_copy127 .byte 0x49 # (address += 4, line += -1, op-index += 0)128 .byte 0x05, 2 # DW_LNS_set_column (2)129 .byte 0x59 # (address += 5, line += 1, op-index += 0)130 .byte 0x02 # DW_LNS_advance_pc131 .uleb128 0x02 # (addr += 2, op-index += 0)132 .byte 0x00, 1, 1 # DW_LNE_end_sequence133 .byte 0x00, 9, 2 # DW_LNE_set_address134 .quad 0x16c0 # Address Value135 .byte 0x11 # (address += 0, line += -1, op-index += 0)136 .byte 0xe6 # (address += 15, line += 2, op-index += 0)137 .byte 0x56 # (address += 5, line += -2, op-index += 0)138 .byte 0x58 # (address += 5, line += 0, op-index += 0)139 .byte 0x02 # DW_LNS_advance_pc140 .uleb128 0x06 # (addr += 6, op-index += 0)141 .byte 0x00, 1, 1 # DW_LNE_end_sequence142.Lunit_end:143 144