xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s (revision 2d1fc4375f3885f0ee0ffcb58fc554530cd74ef2)
1b136c393SPavel Labath# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj | \
2b136c393SPavel Labath# RUN:   not llvm-dwarfdump -verify - | FileCheck %s
3b136c393SPavel Labath
4b136c393SPavel Labath# CHECK: error: Bucket 0 of Name Index @ 0x0 contains invalid value 2. Valid range is [0, 1].
5b136c393SPavel Labath	.section	.debug_str,"MS",@progbits,1
6b136c393SPavel Labath.Lstring_foo:
7b136c393SPavel Labath	.asciz	"foo"
8b136c393SPavel Labath.Lstring_producer:
9b136c393SPavel Labath	.asciz	"Hand-written dwarf"
10b136c393SPavel Labath
11b136c393SPavel Labath	.section	.debug_abbrev,"",@progbits
12b136c393SPavel Labath.Lsection_abbrev:
13b136c393SPavel Labath	.byte	1                       # Abbreviation Code
14b136c393SPavel Labath	.byte	17                      # DW_TAG_compile_unit
15b136c393SPavel Labath	.byte	1                       # DW_CHILDREN_yes
16b136c393SPavel Labath	.byte	37                      # DW_AT_producer
17b136c393SPavel Labath	.byte	14                      # DW_FORM_strp
18b136c393SPavel Labath	.byte	19                      # DW_AT_language
19b136c393SPavel Labath	.byte	5                       # DW_FORM_data2
20b136c393SPavel Labath	.byte	0                       # EOM(1)
21b136c393SPavel Labath	.byte	0                       # EOM(2)
22b136c393SPavel Labath	.byte	2                       # Abbreviation Code
23b136c393SPavel Labath	.byte	46                      # DW_TAG_subprogram
24b136c393SPavel Labath	.byte	0                       # DW_CHILDREN_no
25b136c393SPavel Labath	.byte	3                       # DW_AT_name
26b136c393SPavel Labath	.byte	14                      # DW_FORM_strp
27b136c393SPavel Labath	.byte	63                      # DW_AT_external
28b136c393SPavel Labath	.byte	25                      # DW_FORM_flag_present
29b136c393SPavel Labath	.byte	0                       # EOM(1)
30b136c393SPavel Labath	.byte	0                       # EOM(2)
31b136c393SPavel Labath	.byte	0                       # EOM(3)
32b136c393SPavel Labath
33b136c393SPavel Labath	.section	.debug_info,"",@progbits
34b136c393SPavel Labath.Lcu_begin0:
35b136c393SPavel Labath	.long	.Lcu_end0-.Lcu_start0   # Length of Unit
36b136c393SPavel Labath.Lcu_start0:
37b136c393SPavel Labath	.short	4                       # DWARF version number
38b136c393SPavel Labath	.long	.Lsection_abbrev        # Offset Into Abbrev. Section
39b136c393SPavel Labath	.byte	8                       # Address Size (in bytes)
40b136c393SPavel Labath	.byte	1                       # Abbrev [1] DW_TAG_compile_unit
41b136c393SPavel Labath	.long	.Lstring_producer       # DW_AT_producer
42b136c393SPavel Labath	.short	12                      # DW_AT_language
43b136c393SPavel Labath.Ldie_foo:
44b136c393SPavel Labath	.byte	2                       # Abbrev [2] DW_TAG_subprogram
45b136c393SPavel Labath	.long	.Lstring_foo            # DW_AT_name
46b136c393SPavel Labath                                        # DW_AT_external
47b136c393SPavel Labath	.byte	0                       # End Of Children Mark
48b136c393SPavel Labath.Lcu_end0:
49b136c393SPavel Labath
50b136c393SPavel Labath	.section	.debug_names,"",@progbits
51b136c393SPavel Labath	.long	.Lnames_end0-.Lnames_start0 # Header: contribution length
52b136c393SPavel Labath.Lnames_start0:
53b136c393SPavel Labath	.short	5                       # Header: version
54b136c393SPavel Labath	.short	0                       # Header: padding
55b136c393SPavel Labath	.long	1                       # Header: compilation unit count
56b136c393SPavel Labath	.long	0                       # Header: local type unit count
57b136c393SPavel Labath	.long	0                       # Header: foreign type unit count
58b136c393SPavel Labath	.long	2                       # Header: bucket count
59b136c393SPavel Labath	.long	1                       # Header: name count
60b136c393SPavel Labath	.long	.Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size
61b136c393SPavel Labath	.long	0                       # Header: augmentation length
62b136c393SPavel Labath	.long	.Lcu_begin0             # Compilation unit 0
63b136c393SPavel Labath	.long	2                       # Bucket 0
64b136c393SPavel Labath	.long	1                       # Bucket 1
65b136c393SPavel Labath	.long	193491849               # Hash in Bucket 1
66b136c393SPavel Labath	.long	.Lstring_foo            # String in Bucket 1: foo
67b136c393SPavel Labath	.long	.Lnames0-.Lnames_entries0 # Offset in Bucket 1
68b136c393SPavel Labath.Lnames_abbrev_start0:
69b136c393SPavel Labath	.byte	46                      # Abbrev code
70b136c393SPavel Labath	.byte	46                      # DW_TAG_subprogram
71b136c393SPavel Labath	.byte	3                       # DW_IDX_die_offset
72*2d1fc437SPavel Labath	.byte	19                      # DW_FORM_ref4
73b136c393SPavel Labath	.byte	0                       # End of abbrev
74b136c393SPavel Labath	.byte	0                       # End of abbrev
75b136c393SPavel Labath	.byte	0                       # End of abbrev list
76b136c393SPavel Labath.Lnames_abbrev_end0:
77b136c393SPavel Labath.Lnames_entries0:
78b136c393SPavel Labath.Lnames0:
79b136c393SPavel Labath	.byte	46                      # Abbrev code
80b136c393SPavel Labath	.long	.Ldie_foo-.Lcu_begin0   # DW_IDX_die_offset
81b136c393SPavel Labath	.long	0                       # End of list: foo
82b136c393SPavel Labath	.p2align	2
83b136c393SPavel Labath.Lnames_end0:
84