brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.4 KiB · dade4e9 Raw
252 lines · plain
1## Test the different error cases in the debug line parsing and how they prevent2## or don't prevent further dumping of section contents.3 4## Show that a bad length stops parsing of the section.5# RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_reserved_length.s -filetype=obj -o %t-reserved.o6# RUN: llvm-dwarfdump -debug-line %t-reserved.o 2>&1 \7# RUN:   | FileCheck %s --check-prefixes=HEADER,FIRST,FATAL,RESERVED8# RUN: llvm-dwarfdump -debug-line %t-reserved.o -verbose 2>&1 \9# RUN:   | FileCheck %s --check-prefixes=HEADER,FIRST,FATAL,RESERVED10 11## We only produce warnings for malformed tables after the specified unit if12## parsing can continue.13# RUN: llvm-dwarfdump -debug-line=0 %t-reserved.o 2>&1 \14# RUN:   | FileCheck %s --check-prefixes=HEADER,FIRST,NOLATER,RESERVED15 16## Stop looking for the specified unit, if a fatally-bad prologue is detected.17# RUN: llvm-dwarfdump -debug-line=0x4b %t-reserved.o 2>&1 \18# RUN:   | FileCheck %s --check-prefixes=HEADER,NOFIRST,NOLATER,RESERVED19 20## Show that non-fatal errors do not prevent parsing the rest of the section.21# RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_malformed.s -filetype=obj -o %t-malformed.o22# RUN: llvm-dwarfdump -debug-line %t-malformed.o 2>&1 \23# RUN:   | FileCheck %s --check-prefixes=HEADER,FIRST,NONFATAL,LAST,SOME-ERR,MORE-ERR \24# RUN:       --implicit-check-not='debug_line[{{.*}}]' --implicit-check-not='warning:'25# RUN: llvm-dwarfdump -debug-line %t-malformed.o -verbose 2>&1 \26# RUN:   | FileCheck %s --check-prefixes=HEADER,FIRST,VERBOSE,NONFATAL,LAST,SOME-ERR,MORE-ERR \27# RUN:       --implicit-check-not='debug_line[{{.*}}]' --implicit-check-not=' DW_LNS' \28# RUN:       --implicit-check-not=' DW_LNE' --implicit-check-not='address +=' \29# RUN:       --implicit-check-not='warning:'30 31## We should still produce warnings for malformed tables after the specified unit.32# RUN: llvm-dwarfdump -debug-line=0 %t-malformed.o 2>&1 \33# RUN:   | FileCheck %s --check-prefixes=HEADER,FIRST,NOLATER,SOME-ERR --implicit-check-not='warning:'34 35## Don't stop looking for the later unit if non-fatal issues are found.36# RUN: llvm-dwarfdump -debug-line=0x3ed %t-malformed.o 2>&1 \37# RUN:   | FileCheck %s --check-prefixes=HEADER,LAST,SOME-ERR --implicit-check-not='debug_line[{{.*}}]' \38# RUN:       --implicit-check-not='warning:'39 40# HEADER:       .debug_line contents:41 42# FIRST:        debug_line[0x00000000]43# VERBOSE:        Address            Line   Column File   ISA Discriminator OpIndex Flags44# VERBOSE-NEXT:   ------------------ ------ ------ ------ --- ------------- ------- -------------45# VERBOSE-NEXT: DW_LNE_set_address (0x000000000badbeef)46# VERBOSE-NEXT: DW_LNE_end_sequence47# FIRST:        0x000000000badbeef {{.*}} end_sequence48# FIRST-EMPTY:49# NOFIRST-NOT:  debug_line[0x00000000]50# NOFIRST-NOT:  0x000000000badbeef {{.*}} end_sequence51# NOLATER-NOT:  debug_line[{{.*}}]52# NOLATER-NOT:  end_sequence53 54## For fatal issues, the following table(s) should not be dumped:55# FATAL:      debug_line[0x00000048]56# RESERVED-NOT: prologue57# RESERVED: warning: parsing line table prologue at offset 0x00000048: unsupported reserved unit length of value 0xfffffffe58# RESERVED-NOT: prologue59# RESERVED-NOT: Address60# FATAL-NOT:  debug_line61 62## For non-fatal issues, the table data should be dumped:63 64## Version 0 table.65# NONFATAL:      debug_line[0x00000048]66# NONFATAL-NEXT: Line table prologue67# NONFATAL-NEXT:    total_length: 0x0000000268# NONFATAL-NEXT:          format: DWARF3269# NONFATAL-NEXT:         version: 070# NONFATAL-EMPTY:71# SOME-ERR-NEXT: warning: parsing line table prologue at offset 0x00000048: unsupported version 072 73## Version 1 table.74# NONFATAL:      debug_line[0x0000004e]75# NONFATAL-NEXT: Line table prologue76# NONFATAL-NEXT:    total_length: 0x0000000277# NONFATAL-NEXT:          format: DWARF3278# NONFATAL-NEXT:         version: 179# NONFATAL-EMPTY:80# SOME-ERR-NEXT: warning: parsing line table prologue at offset 0x0000004e: unsupported version 181 82## Malformed directory format with no path component.83# NONFATAL:      debug_line[0x00000054]84# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000054 found an invalid directory or file table description at 0x0000007385# SOME-ERR-NEXT: warning: failed to parse entry content descriptions because no path was found86# NONFATAL-NEXT: Line table prologue87# NONFATAL:      prologue_length: 0x0000001388# NONFATAL-NOT:  include_directories89# NONFATAL-NOT:  file_names90# VERBOSE:       DW_LNE_set_address (0x8877665544332211)91# VERBOSE-NEXT:  DW_LNE_end_sequence92 93## Prologue with length shorter than parsed.94# NONFATAL:      debug_line[0x00000081]95# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000081 found an invalid directory or file table description at 0x000000b996# SOME-ERR-NEXT: warning: file names table was not null terminated before the end of the prologue97# NONFATAL-NEXT: Line table prologue98# NONFATAL:      file_names[  1]:99# NONFATAL-NEXT:            name: "file1"100# NONFATAL-NEXT:       dir_index: 1101# NONFATAL-NEXT:        mod_time: 0x00000002102# NONFATAL-NEXT:          length: 0x00000003103# VERBOSE:       DW_LNE_set_address (0x1122334455667788)104# VERBOSE-NEXT:  DW_LNE_end_sequence105 106## Prologue with length longer than parsed.107# NONFATAL:      debug_line[0x000000c7]108# SOME-ERR-NEXT: warning: unknown data in line table prologue at offset 0x000000c7: parsing ended (at offset 0x00000101) before reaching the prologue end at offset 0x00000102109# NONFATAL-NEXT: Line table prologue110# NONFATAL:      file_names[  2]:111# NONFATAL-NEXT:            name: "file2"112# NONFATAL-NEXT:       dir_index: 1113# NONFATAL-NEXT:        mod_time: 0x00000002114# NONFATAL-NEXT:          length: 0x00000003115# NONFATAL-NOT:  file_names116# VERBOSE:       DW_LNE_set_address (0x1111222233334444)117# VERBOSE-NEXT:  DW_LNE_end_sequence118 119## Extended opcode with incorrect length versus expected.120# NONFATAL:      debug_line[0x00000110]121# NONFATAL-NEXT: Line table prologue122# NONFATAL:      prologue_length: 0x00000030123# VERBOSE:       DW_LNE_set_address (0x00000000abbadaba)124# VERBOSE-NEXT:  DW_LNE_end_sequence125# MORE-ERR:      warning: unexpected line op length at offset 0x00000157 expected 0x02 found 0x01126# VERBOSE:       DW_LNE_set_discriminator (10)127# MORE-ERR:      warning: unexpected line op length at offset 0x0000015b expected 0x01 found 0x02128# VERBOSE:       DW_LNS_set_prologue_end129# VERBOSE-NEXT:  DW_LNE_set_address (0x00000000babb1e45)130# VERBOSE-NEXT:  DW_LNE_end_sequence131 132## No end of sequence.133# NONFATAL:      debug_line[0x0000016b]134# NONFATAL-NEXT: Line table prologue135# NONFATAL:      prologue_length: 0x00000030136# VERBOSE:       DW_LNE_set_address (0x00000000deadfade)137# VERBOSE-NEXT:  DW_LNS_copy138# MORE-ERR:      warning: last sequence in debug line table at offset 0x0000016b is not terminated139 140## Very short prologue length for V5 (ends during parameters).141# NONFATAL:      debug_line[0x000001b1]142# NONFATAL-NEXT: Line table prologue143# NONFATAL:      standard_opcode_lengths[DW_LNS_set_prologue_end] = 1144# NONFATAL-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0145# NONFATAL-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 0146# NONFATAL-EMPTY:147# SOME-ERR-NEXT: warning: parsing line table prologue at offset 0x000001b1: unexpected end of data at offset 0x1cd while reading [0x1cd, 0x1ce)148 149## V5 prologue ends during file table.150# NONFATAL-NEXT: debug_line[0x000001db]151# SOME-ERR-NEXT: warning: parsing line table prologue at 0x000001db found an invalid directory or file table description at 0x00000206152# SOME-ERR-NEXT: warning: failed to parse entry content descriptors: unable to decode LEB128 at offset 0x00000206: malformed uleb128, extends past end153# NONFATAL-NEXT: Line table prologue154# NONFATAL:      include_directories[  0] = "/tmp"155# NONFATAL-NOT:  file_names156# VERBOSE:       DW_LNE_set_address (0x00000ab4acadab4a)157# VERBOSE-NEXT:  DW_LNE_end_sequence158 159## V5 prologue ends during directory table.160# NONFATAL:      debug_line[0x00000214]161# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000214 found an invalid directory or file table description at 0x00000236162# SOME-ERR-NEXT: warning: failed to parse directory entry because extracting the form value failed163# NONFATAL-NEXT: Line table prologue164# NONFATAL-NOT:  include_directories165# VERBOSE:       DW_LNE_set_address (0x4444333322221111)166# VERBOSE-NEXT:  DW_LNE_end_sequence167 168## V5 invalid MD5 hash form when there is still data to be read.169# NONFATAL:      debug_line[0x00000244]170# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000244 found an invalid directory or file table description at 0x00000277171# SOME-ERR-NEXT: warning: failed to parse file entry because extracting the form value failed172# NONFATAL-NEXT: Line table prologue173# NONFATAL:      include_directories[  0] = "/tmp"174# NONFATAL-NOT:  file_names175# VERBOSE:       DW_LNE_set_address (0x1234123412341234)176# VERBOSE-NEXT:  DW_LNE_end_sequence177 178## V5 prologue ends while reading an MD5 hash179# NONFATAL:      debug_line[0x00000287]180# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000287 found an invalid directory or file table description at 0x000002b2181# SOME-ERR-NEXT: warning: failed to parse entry content descriptors: unable to decode LEB128 at offset 0x000002b2: malformed uleb128, extends past end182# NONFATAL-NEXT: Line table prologue183# NONFATAL:      include_directories[  0] = "/tmp"184# NONFATAL-NOT:  file_names185# VERBOSE:       DW_LNE_set_address (0x4321432143214321)186# VERBOSE-NEXT:  DW_LNE_end_sequence187 188## V5 invalid directory content description has unsupported form.189# NONFATAL:      debug_line[0x000002c0]190# SOME-ERR-NEXT: warning: parsing line table prologue at 0x000002c0 found an invalid directory or file table description at 0x000002e9191# SOME-ERR-NEXT: warning: failed to parse directory entry because skipping the form value failed192# NONFATAL-NEXT: Line table prologue193# NONFATAL:      include_directories[  0] = "/foo"194# NONFATAL-NOT:  include_directories195# NONFATAL-NOT:  file_names196# VERBOSE:       DW_LNE_set_address (0xaaaabbbbccccdddd)197# VERBOSE-NEXT:  DW_LNE_end_sequence198 199## Opcode base field of value zero.200# NONFATAL:      debug_line[0x00000306]201# SOME-ERR-NEXT: warning: parsing line table prologue at offset 0x00000306 found opcode base of 0. Assuming no standard opcodes202# NONFATAL-NEXT: Line table prologue203# NONFATAL:      include_directories[  1] = "dir1"204# NONFATAL-NEXT: file_names[  1]:205# NONFATAL-NEXT:            name: "file1"206# NONFATAL-NEXT:       dir_index: 1207# NONFATAL-NEXT:        mod_time: 0x00000002208# NONFATAL-NEXT:          length: 0x00000003209# VERBOSE:       DW_LNE_set_address (0xffffeeeeddddcccc)210# VERBOSE-NEXT:  address += 1, line += 0211# VERBOSE:       DW_LNE_end_sequence212 213## V4 table with unterminated include directory table.214# NONFATAL:      debug_line[0x00000335]215# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000335 found an invalid directory or file table description at 0x00000356216# SOME-ERR-NEXT: warning: include directories table was not null terminated before the end of the prologue217# NONFATAL-NEXT: Line table prologue218# NONFATAL:      include_directories[  1] = "dir1"219# NONFATAL-NOT:  file_names220# VERBOSE:       DW_LNE_set_address (0xabcdef0123456789)221# VERBOSE-NEXT:  DW_LNE_end_sequence222 223## V4 table with unterminated file name table.224# NONFATAL:      debug_line[0x00000364]225# SOME-ERR-NEXT: warning: parsing line table prologue at 0x00000364 found an invalid directory or file table description at 0x0000038f226# SOME-ERR-NEXT: warning: file names table was not null terminated before the end of the prologue227# NONFATAL-NEXT: Line table prologue228# NONFATAL:      file_names[  1]:229# NONFATAL-NEXT:            name: "foo.c"230# NONFATAL-NEXT:       dir_index: 1231# NONFATAL-NEXT:        mod_time: 0x00000002232# NONFATAL-NEXT:          length: 0x00000003233# NONFATAL-NOT:  file_names234# VERBOSE:       DW_LNE_set_address (0xababcdcdefef0909)235# VERBOSE-NEXT:  DW_LNE_end_sequence236 237## Table with extended opcode that overruns table end.238# NONFATAL:      debug_line[0x0000039d]239# NONFATAL-NEXT: Line table prologue240# NONFATAL:      Address241# NONFATAL-NEXT: ------------------242# VERBOSE-NEXT:  DW_LNE_set_address (0x00000000feedfeed)243# VERBOSE-NEXT:  DW_LNS_copy244# NONFATAL-NEXT: 0x00000000feedfeed245# VERBOSE-NEXT:  DW_LNE_set_address (<parsing error> 00 f0 01 f0 f0 00 01)246# MORE-ERR-NEXT: warning: unexpected end of data at offset 0x3ed while reading [0x3e6, 0x3ee)247# MORE-ERR-NEXT: warning: last sequence in debug line table at offset 0x0000039d is not terminated248 249# LAST:          debug_line[0x000003ed]250# VERBOSE:       DW_LNE_set_address (0x00000000cafebabe)251# VERBOSE-NEXT:  DW_LNE_end_sequence252