1 # RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
2 # RUN: not llvm-dwarfdump -verify %t.o | FileCheck --check-prefix=VERIFY %s
4 # Check that the verifier correctly diagnoses various error conditions with
5 # the usage of string indices and string offsets tables.
7 .section .debug_str,"MS",@progbits,1
9 .asciz "Handmade DWARF producer"
11 .section .debug_str_offsets,"",@progbits
12 # The string offsets table
13 .long .debug_str_offsets_segment0_end-.debug_str_offsets_base0+4
14 .short 5 # DWARF version
16 .debug_str_offsets_base0:
18 .long 1000 # Invalid string address.
19 .debug_str_offsets_segment0_end:
21 # A simple abbrev section with a basic compile unit DIE.
22 .section .debug_abbrev,"",@progbits
23 .byte 0x01 # Abbrev code
24 .byte 0x11 # DW_TAG_compile_unit
25 .byte 0x01 # DW_CHILDREN_no
26 .byte 0x25 # DW_AT_producer
27 .byte 0x1a # DW_FORM_strx
28 .byte 0x72 # DW_AT_str_offsets_base
29 .byte 0x17 # DW_FORM_sec_offset
33 .section .debug_info,"",@progbits
35 # The first unit's CU DIE has an invalid DW_AT_str_offsets_base which
36 # renders any string index unresolvable.
39 .long CU1_5_end-CU1_5_version # Length of Unit
41 .short 5 # DWARF version number
42 .byte 1 # DWARF Unit Type
43 .byte 8 # Address Size (in bytes)
44 .long .debug_abbrev # Offset Into Abbrev. Section
45 # The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.
46 .byte 1 # Abbreviation code
47 .byte 0 # Index of string for DW_AT_producer.
48 .long 1000 # Bad value for DW_AT_str_offsets_base
52 # The second unit's CU DIE uses an invalid string index.
55 .long CU2_5_end-CU2_5_version # Length of Unit
57 .short 5 # DWARF version number
58 .byte 1 # DWARF Unit Type
59 .byte 8 # Address Size (in bytes)
60 .long .debug_abbrev # Offset Into Abbrev. Section
61 # The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.
62 .byte 1 # Abbreviation code
63 .byte 100 # Invalid string index
64 .long .debug_str_offsets_base0
68 # The third unit's CU DIE uses a valid string index but the entry in the
69 # string offsets table is invalid.
72 .long CU3_5_end-CU3_5_version # Length of Unit
74 .short 5 # DWARF version number
75 .byte 1 # DWARF Unit Type
76 .byte 8 # Address Size (in bytes)
77 .long .debug_abbrev # Offset Into Abbrev. Section
78 # The compile-unit DIE, which has DW_AT_producer and DW_AT_str_offsets.
79 .byte 1 # Abbreviation code
80 .byte 1 # Index of string for DW_AT_producer.
81 .long .debug_str_offsets_base0
85 # VERIFY-DAG: error: DW_FORM_strx used without a valid string offsets table:
86 # VERIFY-DAG: error: DW_FORM_strx uses index 100, which is too large:
87 # VERIFY-DAG: error: DW_FORM_strx uses index 1, but the referenced string offset
88 # VERIFY-DAG-SAME: is beyond .debug_str bounds: