153 lines · plain
1# Test object to verify dwarfdump handles a syntactically correct line-number2# program containing unrecognized extended opcodes.3# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o4# RUN: llvm-dwarfdump -v %t.o | FileCheck %s5# RUN: llvm-dwarfdump -v %t.o 2>&1 | FileCheck %s --check-prefix=ERR6 7 .section .text8 # Dummy function9foo: ret10 11# FIXME: When we can dump a line-table without a unit, we could remove12# the .debug_abbrev and .debug_info sections from this test.13 .section .debug_abbrev,"",@progbits14 .byte 0x01 # Abbrev code15 .byte 0x11 # DW_TAG_compile_unit16 .byte 0x00 # DW_CHILDREN_no17 .byte 0x10 # DW_AT_stmt_list18 .byte 0x17 # DW_FORM_sec_offset19 .byte 0x00 # EOM(1)20 .byte 0x00 # EOM(2)21 22 .section .debug_info,"",@progbits23 .long CU_end-CU_version # Length of Unit24CU_version:25 .short 4 # DWARF version number26 .long .debug_abbrev # Offset Into Abbrev. Section27 .byte 8 # Address Size (in bytes)28# The compile-unit DIE, with DW_AT_stmt_list.29 .byte 130 .long LT_start31 .byte 0 # NULL32CU_end:33 34 .long CU2_end-CU2_version # Length of Unit35CU2_version:36 .short 4 # DWARF version number37 .long .debug_abbrev # Offset Into Abbrev. Section38 .byte 8 # Address Size (in bytes)39# The compile-unit DIE, with DW_AT_stmt_list.40 .byte 141 .long LT2_start42 .byte 0 # NULL43CU2_end:44 45 .section .debug_line,"",@progbits46# CHECK-LABEL: .debug_line contents:47 48# DWARF v4 line-table header.49LT_start:50 .long LT_end-LT_version # Length of Unit (DWARF-32 format)51LT_version:52 .short 4 # DWARF version number53 .long LT_header_end-LT_params # Length of Prologue54LT_params:55 .byte 1 # Minimum Instruction Length56 .byte 1 # Maximum Operations per Instruction57 .byte 1 # Default is_stmt58 .byte -5 # Line Base59 .byte 14 # Line Range60 .byte 13 # Opcode Base61 .byte 0 # Standard Opcode Lengths62 .byte 163 .byte 164 .byte 165 .byte 166 .byte 067 .byte 068 .byte 069 .byte 170 .byte 071 .byte 072 .byte 173 # No directories.74 .byte 075 # No files.76 .byte 077LT_header_end:78 # Bogus extended opcode with zero length.79 .byte 0 # Extended opcode indicator.80 .byte 0 # LEB length of extended opcode + operands.81 # Real opcode and operand.82 .byte 083 .byte 984 .byte 2 # DW_LNE_set_address85 .quad .text86 # Bogus extended opcode with multibyte LEB length.87 .byte 088 .byte 0x82 # Length of 2 but with additional length byte.89 .byte 0 # Additional length byte.90 .byte 0x47 # Unrecognized opcode...91 .byte 0 # with its 1-byte operand.92 # Proper end-sequence opcode.93 .byte 094 .byte 195 .byte 1 # DW_LNE_end_sequence96LT_end:97 98# CHECK: Line table prologue:99# CHECK: version: 4100# Exact prologue length isn't important but it tells us where to expect the101# line-number program to start, and we do want to verify those offsets.102# CHECK-NEXT: prologue_length: 0x00000014103# CHECK: 0x0000001e: 00 Badly formed extended line op104# CHECK-NEXT: 0x00000020: 00 DW_LNE_set_address105# CHECK-NEXT: 0x0000002b: 00 Unrecognized extended op 0x47 length 2106# CHECK-NEXT: 0x00000030: 00 DW_LNE_end_sequence107# CHECK-NEXT: 0x0000000000000000 {{.*}} is_stmt end_sequence108 109 110# DWARF v4 line-table header #2.111LT2_start:112 .long LT2_end-LT2_version # Length of Unit (DWARF-32 format)113LT2_version:114 .short 4 # DWARF version number115 .long LT2_header_end-LT2_params # Length of Prologue116LT2_params:117 .byte 1 # Minimum Instruction Length118 .byte 1 # Maximum Operations per Instruction119 .byte 1 # Default is_stmt120 .byte -5 # Line Base121 .byte 14 # Line Range122 .byte 13 # Opcode Base123 .byte 0 # Standard Opcode Lengths124 .byte 1125 .byte 1126 .byte 1127 .byte 1128 .byte 0129 .byte 0130 .byte 0131 .byte 1132 .byte 0133 .byte 0134 .byte 1135 # No directories.136 .byte 0137 # No files.138 .byte 0139LT2_header_end:140 # Real opcode and operand.141 .byte 0142 .byte 9143 .byte 2 # DW_LNE_set_address144 .quad .text145 # Real opcode with incorrect length.146 .byte 0147 .byte 2 # Wrong length, should be 1.148 .byte 1 # DW_LNE_end_sequence149LT2_end:150 151# ERR: warning: unexpected line op length at offset 0x0000005e152# ERR-SAME: expected 0x02 found 0x01153