155 lines · plain
1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o2# RUN: not llvm-dwarfdump -v %t.o 2>&1 | FileCheck %s3#4# Test object to verify that llvm-dwarfdump handles an invalid string offsets5# table.6#7# A rudimentary abbrev section.8 .section .debug_abbrev,"",@progbits9 .byte 0x01 # Abbrev code10 .byte 0x11 # DW_TAG_compile_unit11 .byte 0x00 # DW_CHILDREN_no12 .byte 0x72 # DW_AT_str_offsets_base13 .byte 0x17 # DW_FORM_sec_offset14 .byte 0x00 # EOM(1)15 .byte 0x00 # EOM(2)16 .byte 0x00 # EOM(3)17 18# A rudimentary compile unit to convince dwarfdump that we are dealing with a 19# DWARF v5 string offsets table.20 .section .debug_info,"",@progbits21 22# DWARF v5 32 bit CU header.23 .long CU1_end-CU1_begin # Length of Unit24CU1_begin:25 .short 5 # DWARF version number26 .byte 1 # DWARF Unit Type27 .byte 8 # Address Size (in bytes)28 .long .debug_abbrev # Offset Into Abbrev. Section29 .byte 1 # Abbreviation code: DW_TAG_compile_unit30 .long 0 # DW_AT_str_offsets_base31CU1_end:32 33# DWARF v5 64 bit CU header.34 .long 0xffffffff35 .quad CU2_end-CU2_begin # Length of Unit36CU2_begin:37 .short 5 # DWARF version number38 .byte 1 # DWARF Unit Type39 .byte 8 # Address Size (in bytes)40 .quad .debug_abbrev # Offset Into Abbrev. Section41 .byte 1 # Abbreviation code: DW_TAG_compile_unit42 .quad 0 # DW_AT_str_offsets_base43CU2_end:44 .long CU3_end-CU3_begin # Length of Unit45CU3_begin:46 .short 5 # DWARF version number47 .byte 1 # DWARF Unit Type48 .byte 8 # Address Size (in bytes)49 .long .debug_abbrev # Offset Into Abbrev. Section50 .byte 1 # Abbreviation code: DW_TAG_compile_unit51 .quad .str_off0 # DW_AT_str_offsets_base52CU3_end:53 .long CU4_end-CU4_begin # Length of Unit54CU4_begin:55 .short 5 # DWARF version number56 .byte 1 # DWARF Unit Type57 .byte 8 # Address Size (in bytes)58 .long .debug_abbrev # Offset Into Abbrev. Section59 .byte 1 # Abbreviation code: DW_TAG_compile_unit60 .quad .str_off1 # DW_AT_str_offsets_base61CU4_end:62 .long CU5_end-CU5_begin # Length of Unit63CU5_begin:64 .short 5 # DWARF version number65 .byte 1 # DWARF Unit Type66 .byte 8 # Address Size (in bytes)67 .long .debug_abbrev # Offset Into Abbrev. Section68 .byte 1 # Abbreviation code: DW_TAG_compile_unit69 .long .str_off2_begin # DW_AT_str_offsets_base70CU5_end:71 .long CU6_end-CU6_begin # Length of Unit72CU6_begin:73 .short 5 # DWARF version number74 .byte 1 # DWARF Unit Type75 .byte 8 # Address Size (in bytes)76 .long .debug_abbrev # Offset Into Abbrev. Section77 .byte 1 # Abbreviation code: DW_TAG_compile_unit78 .long .str_off3_begin # DW_AT_str_offsets_base79CU6_end:80 .long 0xffffffff81 .quad CU7_end-CU7_begin # Length of Unit82CU7_begin:83 .short 5 # DWARF version number84 .byte 1 # DWARF Unit Type85 .byte 8 # Address Size (in bytes)86 .quad .debug_abbrev # Offset Into Abbrev. Section87 .byte 1 # Abbreviation code: DW_TAG_compile_unit88 .quad .str_off4_begin # DW_AT_str_offsets_base89CU7_end:90 .long CU8_end-CU8_begin # Length of Unit91CU8_begin:92 .short 5 # DWARF version number93 .byte 1 # DWARF Unit Type94 .byte 8 # Address Size (in bytes)95 .long .debug_abbrev # Offset Into Abbrev. Section96 .byte 1 # Abbreviation code: DW_TAG_compile_unit97 .long .str_off_end+16 # DW_AT_str_offsets_base98CU8_end:99 .long 0xffffffff100 .quad CU9_end-CU9_begin # Length of Unit101CU9_begin:102 .short 5 # DWARF version number103 .byte 1 # DWARF Unit Type104 .byte 8 # Address Size (in bytes)105 .quad .debug_abbrev # Offset Into Abbrev. Section106 .byte 1 # Abbreviation code: DW_TAG_compile_unit107 .quad .str_off_end+8 # DW_AT_str_offsets_base108CU9_end:109 110 .section .debug_str_offsets,"",@progbits111# Invalid length112 .long 0xfffffff4113 .short 5 # DWARF version114 .short 0 # Padding115.str_off0:116 .long 0117# Length beyond section bounds118 .long .str_off_end-.str_off1+8119 .short 5 # DWARF version120 .short 0 # Padding121.str_off1:122 .long 0123# Length intrudes on following unit124 .long .str_off2_end-.str_off2_begin+8125 .short 5 # DWARF version126 .short 0 # Padding127.str_off2_begin:128 .long 0129.str_off2_end:130# Plain contribution, no errors here131 .long .str_off3_end-.str_off3_begin132 .short 5 # DWARF version133 .short 0 # Padding134.str_off3_begin:135 .long 0136.str_off3_end:137# 32 bit contribution referenced from a 64 bit unit138 .long .str_off4_end-.str_off4_begin139 .short 5 # DWARF version140 .short 0 # Padding141.str_off4_begin:142 .long 0143.str_off4_end:144.str_off_end:145 146 147# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix148# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 64 bit header prefix149# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: invalid length150# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: length exceeds section size151# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: 32 bit contribution referenced from a 64 bit unit152# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: section offset exceeds section size153# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: section offset exceeds section size154# CHECK: error: overlapping contributions to string offsets table in section .debug_str_offsets.155