98 lines · plain
1# REQUIRES: x86, system-linux2# RUN: rm -rf %t && mkdir %t && cd %t3 4## Test errors in the header.5# RUN: sed '/Header: version/s/5/4/' %S/Inputs/debug-names-a.s > bad-version.s6# RUN: llvm-mc -filetype=obj -triple=x86_64 bad-version.s -o bad-version.o7# RUN: not ld.lld --debug-names bad-version.o 2>&1 | FileCheck %s --check-prefix=BAD-VERSION --implicit-check-not=error:8 9# BAD-VERSION: error: bad-version.o:(.debug_names): unsupported version: 410 11# RUN: sed '/Header: name count/s/[0-9]/4/' %S/Inputs/debug-names-a.s > bad-name-count.s12# RUN: llvm-mc -filetype=obj -triple=x86_64 bad-name-count.s -o bad-name-count.o13# RUN: not ld.lld --debug-names bad-name-count.o 2>&1 | FileCheck %s --check-prefix=BAD-NAME-COUNT --implicit-check-not=error:14 15## Test errors in offsets.16# BAD-NAME-COUNT: error: bad-name-count.o:(.debug_names): Section too small: cannot read abbreviations.17 18# RUN: sed '/Offset in Bucket/s/long/byte/' %S/Inputs/debug-names-a.s > entry-offset-in-byte.s19# RUN: llvm-mc -filetype=obj -triple=x86_64 entry-offset-in-byte.s -o entry-offset-in-byte.o20# RUN: not ld.lld --debug-names entry-offset-in-byte.o 2>&1 | FileCheck %s --check-prefix=ENTRY-OFFSET-IN-BYTE --implicit-check-not=error:21 22# ENTRY-OFFSET-IN-BYTE-COUNT-2: error: entry-offset-in-byte.o:(.debug_names): index entry is out of bounds23 24## Test errors in the abbrev table.25# RUN: sed -E '/DW_IDX_parent/{n;s/[0-9]+.*DW_FORM_flag_present/16/}' %S/Inputs/debug-names-a.s > bad-parent-form.s26# RUN: llvm-mc -filetype=obj -triple=x86_64 bad-parent-form.s -o bad-parent-form.o27# RUN: not ld.lld --debug-names bad-parent-form.o 2>&1 | FileCheck %s --check-prefix=BAD-PARENT-FORM --implicit-check-not=error:28 29# BAD-PARENT-FORM: error: bad-parent-form.o:(.debug_names): invalid form for DW_IDX_parent30 31# RUN: sed -E '/DW_IDX_die_offset/{n;s/[0-9]+.*DW_FORM_ref4/16/}' %S/Inputs/debug-names-a.s > bad-die-form.s32# RUN: llvm-mc -filetype=obj -triple=x86_64 bad-die-form.s -o bad-die-form.o33# RUN: not ld.lld --debug-names bad-die-form.o 2>&1 | FileCheck %s --check-prefix=BAD-DIE-FORM --implicit-check-not=error:34 35# BAD-DIE-FORM: error: bad-die-form.o:(.debug_names): unrecognized form encoding 16 in abbrev table36 37## Test errors in the entry pool.38# RUN: sed -E '/Lnames.:/{n;n;s/[0-9]+/3/}' %S/Inputs/debug-names-a.s > bad-abbrev-code.s39# RUN: llvm-mc -filetype=obj -triple=x86_64 bad-abbrev-code.s -o bad-abbrev-code.o40# RUN: not ld.lld --debug-names bad-abbrev-code.o 2>&1 | FileCheck %s --check-prefix=BAD-ABBREV-CODE --implicit-check-not=error:41# RUN: ld.lld --debug-names bad-abbrev-code.o -o bad-abbrev-code --noinhibit-exec42# RUN: llvm-dwarfdump --debug-names bad-abbrev-code | FileCheck %s --check-prefix=BAD-ABBREV-CODE-DWARF43 44# BAD-ABBREV-CODE: error: bad-abbrev-code.o:(.debug_names): abbrev code not found in abbrev table: 345 46# BAD-ABBREV-CODE-DWARF: Abbreviations [47# BAD-ABBREV-CODE-DWARF-NEXT: Abbreviation 0x1 {48# BAD-ABBREV-CODE-DWARF-NEXT: Tag: DW_TAG_subprogram49# BAD-ABBREV-CODE-DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref450# BAD-ABBREV-CODE-DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present51# BAD-ABBREV-CODE-DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data152# BAD-ABBREV-CODE-DWARF-NEXT: }53# BAD-ABBREV-CODE-DWARF-NEXT: Abbreviation 0x2 {54# BAD-ABBREV-CODE-DWARF-NEXT: Tag: DW_TAG_structure_type55# BAD-ABBREV-CODE-DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref456# BAD-ABBREV-CODE-DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present57# BAD-ABBREV-CODE-DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data158# BAD-ABBREV-CODE-DWARF-NEXT: }59# BAD-ABBREV-CODE-DWARF-NEXT: ]60# BAD-ABBREV-CODE-DWARF: Bucket 061# BAD-ABBREV-CODE-DWARF-NOT: Entry62 63# RUN: sed -E '/Lnames0:/{n;n;n;s/.*DW_IDX_die_offset.*//}' %S/Inputs/debug-names-a.s > missing-die-offset0.s64# RUN: llvm-mc -filetype=obj -triple=x86_64 missing-die-offset0.s -o missing-die-offset0.o65# RUN: ld.lld --debug-names missing-die-offset0.o --noinhibit-exec -o missing-die-offset0 2>&1 | FileCheck %s --check-prefix=MISSING-DIE-OFFSET066 67# MISSING-DIE-OFFSET0: warning: missing-die-offset0.o:(.debug_names): index entry is out of bounds68 69# RUN: sed -E '/Lnames1:/{n;n;n;s/.*DW_IDX_die_offset.*//}' %S/Inputs/debug-names-a.s > missing-die-offset1.s70# RUN: llvm-mc -filetype=obj -triple=x86_64 missing-die-offset1.s -o missing-die-offset1.o71# RUN: ld.lld --debug-names missing-die-offset1.o -o missing-die-offset172# RUN: llvm-dwarfdump --debug-names missing-die-offset1 | FileCheck %s --check-prefix=MISSING-DIE-OFFSET173 74# MISSING-DIE-OFFSET1: Bucket 0 [75# MISSING-DIE-OFFSET1-NEXT: Name 1 {76# MISSING-DIE-OFFSET1-NEXT: Hash: 0x59796A77# MISSING-DIE-OFFSET1-NEXT: String: {{.*}} "t1"78# MISSING-DIE-OFFSET1-NEXT: Entry @ 0x65 {79# MISSING-DIE-OFFSET1-NEXT: Abbrev: 0x280# MISSING-DIE-OFFSET1-NEXT: Tag: DW_TAG_structure_type81# MISSING-DIE-OFFSET1-NEXT: DW_IDX_die_offset: 0x0023020082# MISSING-DIE-OFFSET1-NEXT: DW_IDX_parent: <parent not indexed>83# MISSING-DIE-OFFSET1-NEXT: DW_IDX_compile_unit: 0x0084# MISSING-DIE-OFFSET1-NEXT: }85# MISSING-DIE-OFFSET1-NEXT: }86# MISSING-DIE-OFFSET1-NEXT: Name 2 {87# MISSING-DIE-OFFSET1-NEXT: Hash: 0xEDDB623288# MISSING-DIE-OFFSET1-NEXT: String: {{.*}} "_start"89# MISSING-DIE-OFFSET1-NEXT: Entry @ 0x6c {90# MISSING-DIE-OFFSET1-NEXT: Abbrev: 0x191# MISSING-DIE-OFFSET1-NEXT: Tag: DW_TAG_subprogram92# MISSING-DIE-OFFSET1-NEXT: DW_IDX_die_offset: 0x0000002393# MISSING-DIE-OFFSET1-NEXT: DW_IDX_parent: <parent not indexed>94# MISSING-DIE-OFFSET1-NEXT: DW_IDX_compile_unit: 0x0095# MISSING-DIE-OFFSET1-NEXT: }96# MISSING-DIE-OFFSET1-NEXT: }97# MISSING-DIE-OFFSET1-NEXT: ]98