117 lines · plain
1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o2# RUN: not llvm-dwarfdump -verify %t.o | FileCheck --check-prefix=VERIFY %s3 4# Check that the verifier correctly diagnoses various error conditions with5# the usage of string indices/offsets and string offsets tables.6 7 .section .debug_line_str,"MS",@progbits,18str_comp_dir:9 .asciz "llvm/test/tools/llvm-dwarfdump/X86"10 11 .section .debug_str,"MS",@progbits,112str_producer:13 .asciz "Handmade DWARF producer"14 15 .section .debug_str_offsets,"",@progbits16# The string offsets table17 .long .debug_str_offsets_segment0_end-.debug_str_offsets_base0+418 .short 5 # DWARF version19 .short 0 # Padding20.debug_str_offsets_base0:21 .long str_producer22 .long 1000 # Invalid string address.23.debug_str_offsets_segment0_end:24 25# A simple abbrev section with a basic compile unit DIE.26 .section .debug_abbrev,"",@progbits27 .byte 0x01 # Abbrev code28 .byte 0x11 # DW_TAG_compile_unit29 .byte 0x00 # DW_CHILDREN_no30 .byte 0x25 # DW_AT_producer31 .byte 0x1a # DW_FORM_strx32 .byte 0x1b # DW_AT_comp_dir33 .byte 0x1f # DW_FORM_line_strp34 .byte 0x72 # DW_AT_str_offsets_base35 .byte 0x17 # DW_FORM_sec_offset36 .byte 0x00 # EOM(1)37 .byte 0x00 # EOM(2)38 .byte 0x00 # EOM(3)39 40 .section .debug_info,"",@progbits41 42# The first unit's CU DIE has an invalid DW_AT_str_offsets_base which43# renders any string index unresolvable.44 45# DWARF v5 CU header.46 .long CU1_5_end-CU1_5_version # Length of Unit47CU1_5_version:48 .short 5 # DWARF version number49 .byte 1 # DWARF Unit Type50 .byte 8 # Address Size (in bytes)51 .long .debug_abbrev # Offset Into Abbrev. Section52# The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.53 .byte 1 # Abbreviation code54 .byte 0 # Index of string for DW_AT_producer.55 .long str_comp_dir # Offset of debug line string for DW_AT_comp_dir56 .long 1000 # Bad value for DW_AT_str_offsets_base57 .byte 0 # NULL58CU1_5_end:59 60# The second unit's CU DIE uses an invalid string index.61 62# DWARF v5 CU header63 .long CU2_5_end-CU2_5_version # Length of Unit64CU2_5_version:65 .short 5 # DWARF version number66 .byte 1 # DWARF Unit Type67 .byte 8 # Address Size (in bytes)68 .long .debug_abbrev # Offset Into Abbrev. Section69# The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.70 .byte 1 # Abbreviation code71 .byte 100 # Invalid string index72 .long str_comp_dir # Offset of debug line string for DW_AT_comp_dir73 .long .debug_str_offsets_base074 .byte 0 # NULL75CU2_5_end:76 77# The third unit's CU DIE uses a valid string index but the entry in the78# string offsets table is invalid.79 80# DWARF v5 CU header81 .long CU3_5_end-CU3_5_version # Length of Unit82CU3_5_version:83 .short 5 # DWARF version number84 .byte 1 # DWARF Unit Type85 .byte 8 # Address Size (in bytes)86 .long .debug_abbrev # Offset Into Abbrev. Section87# The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.88 .byte 1 # Abbreviation code89 .byte 1 # Index of string for DW_AT_producer.90 .long str_comp_dir # Offset of debug line string for DW_AT_comp_dir91 .long .debug_str_offsets_base092 .byte 0 # NULL93CU3_5_end:94 95# The fourth unit's CU DIE has an invalid offset for the debug line string.96 97# DWARF v5 CU header98 .long CU4_5_end-CU4_5_version # Length of Unit99CU4_5_version:100 .short 5 # DWARF version number101 .byte 1 # DWARF Unit Type102 .byte 8 # Address Size (in bytes)103 .long .debug_abbrev # Offset Into Abbrev. Section104# The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.105 .byte 1 # Abbreviation code106 .byte 0 # Index of string for DW_AT_producer.107 .long 99999 # Invalid offset of debug line string for DW_AT_comp_dir108 .long .debug_str_offsets_base0109 .byte 0 # NULL110CU4_5_end:111 112# VERIFY-DAG: error: DW_FORM_strx used without a valid string offsets table:113# VERIFY-DAG: error: DW_FORM_strx uses index 100, which is too large:114# VERIFY-DAG: error: DW_FORM_strx uses index 1, but the referenced string offset115# VERIFY-DAG-SAME: is beyond .debug_str bounds:116# VERIFY-DAG: error: DW_FORM_line_strp offset 99999 is beyond .debug_line_str bounds117