|
| 1 | +## Test cases when we run into the end of section while parsing a line table |
| 2 | +## prologue. |
| 3 | + |
| 4 | +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym CASE=0 -o %t0 |
| 5 | +# RUN: llvm-dwarfdump -debug-line %t0 2>&1 | FileCheck %s --check-prefixes=ALL,C0 |
| 6 | + |
| 7 | +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym CASE=1 -o %t1 |
| 8 | +# RUN: llvm-dwarfdump -debug-line %t1 2>&1 | FileCheck %s --check-prefixes=ALL,C1 |
| 9 | + |
| 10 | +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym CASE=2 -o %t2 |
| 11 | +# RUN: llvm-dwarfdump -debug-line %t2 2>&1 | FileCheck %s --check-prefixes=ALL,C2 |
| 12 | + |
| 13 | +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym CASE=3 -o %t3 |
| 14 | +# RUN: llvm-dwarfdump -debug-line %t3 2>&1 | FileCheck %s --check-prefixes=ALL,OK |
| 15 | + |
| 16 | +# ALL: debug_line[0x00000000] |
| 17 | +# C0-NEXT: warning: parsing line table prologue at 0x00000000 found an invalid directory or file table description at 0x00000027 |
| 18 | +# C0-NEXT: warning: failed to parse entry content descriptors: unexpected end of data at offset 0x27 |
| 19 | +# C1-NEXT: warning: parsing line table prologue at 0x00000000 found an invalid directory or file table description at 0x0000002a |
| 20 | +# C1-NEXT: warning: failed to parse entry content descriptors: malformed uleb128, extends past end |
| 21 | +# C2-NEXT: warning: parsing line table prologue at 0x00000000 found an invalid directory or file table description at 0x0000002b |
| 22 | +# C2-NEXT: warning: failed to parse entry content descriptors: malformed uleb128, extends past end |
| 23 | +# ALL: include_directories[ 0] = "/tmp" |
| 24 | +# OK: file_names[ 0]: |
| 25 | +# OK-NEXT: name: "foo" |
| 26 | +# OK-NEXT: dir_index: 0 |
| 27 | + |
| 28 | +.section .debug_line,"",@progbits |
| 29 | +.long .Lend-.Lstart # Length of Unit |
| 30 | +.Lstart: |
| 31 | +.short 5 # DWARF version number |
| 32 | +.byte 8 # Address Size |
| 33 | +.byte 0 # Segment Selector Size |
| 34 | +.long .Lprologue_end-.Lprologue_start # Length of Prologue |
| 35 | +.Lprologue_start: |
| 36 | +.byte 1 # Minimum Instruction Length |
| 37 | +.byte 1 # Maximum Operations per Instruction |
| 38 | +.byte 1 # Default is_stmt |
| 39 | +.byte -5 # Line Base |
| 40 | +.byte 14 # Line Range |
| 41 | +.byte 13 # Opcode Base |
| 42 | +.byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 # Standard Opcode Lengths |
| 43 | +# Directory table format |
| 44 | +.byte 1 # One element per directory entry |
| 45 | +.byte 1 # DW_LNCT_path |
| 46 | +.byte 0x08 # DW_FORM_string |
| 47 | +# Directory table entries |
| 48 | +.byte 1 # 1 directory |
| 49 | +.asciz "/tmp" |
| 50 | +# File table format |
| 51 | +.if CASE >= 1 |
| 52 | +.byte 2 # 2 elements per file entry |
| 53 | +.byte 1 # DW_LNCT_path |
| 54 | +.byte 8 # DW_FORM_string |
| 55 | +.if CASE >= 2 |
| 56 | +.byte 2 # DW_LNCT_directory_index |
| 57 | +.if CASE >= 3 |
| 58 | +.byte 11 # DW_FORM_data1 |
| 59 | +# File table entries |
| 60 | +.byte 1 |
| 61 | +.asciz "foo" |
| 62 | +.byte 0 |
| 63 | +.endif |
| 64 | +.endif |
| 65 | +.endif |
| 66 | + |
| 67 | +.Lprologue_end: |
| 68 | +.Lend: |
0 commit comments