xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/debug_info_addrx.s (revision eed0242330926815d19dd0d54f393576bcffc762)
1# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
2# RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s
3# RUN: llvm-dwarfdump -debug-info %t.o -v | FileCheck --check-prefix=VERBOSE %s
4
5# CHECK: DW_TAG_compile_unit
6# CHECK:   DW_AT_low_pc                                              (0x0000000000000000)
7# VERBOSE: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000 ".text")
8# FIXME: Improve the error message from "unresolved" to describe the specific
9#        issue (in this case, the index is outside the bounds of the debug_addr
10#        contribution/debug_addr section)
11# CHECK:   DW_AT_low_pc                 (indexed (00000001) address = <unresolved>)
12# VERBOSE: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = <unresolved>)
13
14# CHECK: DW_TAG_compile_unit
15# FIXME: Should error "no debug_addr contribution" - rather than parsing debug_addr
16#        from the start, incorrectly interpreting the header bytes as an address.
17# CHECK:   DW_AT_low_pc                 (indexed (00000000) address = <unresolved>)
18# VERBOSE: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = <unresolved>)
19
20	.globl	foo                     # -- Begin function foo
21foo:                                    # @foo
22.Lfunc_begin0:
23	retq
24.Lfunc_end0:
25	.section	.debug_abbrev,"",@progbits
26	.byte	1                       # Abbreviation Code
27	.byte	17                      # DW_TAG_compile_unit
28	.byte	0                       # DW_CHILDREN_no
29	.byte	115                     # DW_AT_addr_base
30	.byte	23                      # DW_FORM_sec_offset
31	.byte	17                      # DW_AT_low_pc
32	.byte	27                      # DW_FORM_addrx
33	.byte	17                      # DW_AT_low_pc
34	.byte	27                      # DW_FORM_addrx
35	.byte	0                       # EOM(1)
36	.byte	0                       # EOM(2)
37	.byte	2                       # Abbreviation Code
38	.byte	17                      # DW_TAG_compile_unit
39	.byte	0                       # DW_CHILDREN_no
40	.byte	17                      # DW_AT_low_pc
41	.byte	27                      # DW_FORM_addrx
42	.byte	0                       # EOM(1)
43	.byte	0                       # EOM(2)
44	.byte	0                       # EOM(3)
45	.section	.debug_info,"",@progbits
46.Lcu_begin0:
47	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
48.Ldebug_info_start0:
49	.short	5                       # DWARF version number
50	.byte	1                       # DWARF Unit Type
51	.byte	8                       # Address Size (in bytes)
52	.long	.debug_abbrev           # Offset Into Abbrev. Section
53	.byte	1                       # Abbrev [1] 0xc:0x23 DW_TAG_compile_unit
54	.long	.Laddr_table_base0      # DW_AT_addr_base
55	.byte	0                       # DW_AT_low_pc
56	.byte	1                       # DW_AT_low_pc
57.Ldebug_info_end0:
58.Lcu_begin1:
59	.long	.Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
60.Ldebug_info_start1:
61	.short	5                       # DWARF version number
62	.byte	1                       # DWARF Unit Type
63	.byte	8                       # Address Size (in bytes)
64	.long	.debug_abbrev           # Offset Into Abbrev. Section
65	.byte	2                       # Abbrev [2] 0xc:0x23 DW_TAG_compile_unit
66	.long	.Laddr_table_base0      # DW_AT_addr_base
67	.byte	0                       # DW_AT_low_pc
68.Ldebug_info_end1:
69	.section	.debug_macinfo,"",@progbits
70	.byte	0                       # End Of Macro List Mark
71	.section	.debug_addr,"",@progbits
72	.long	12                      # Length of Pool
73	.short	5                       # DWARF version number
74	.byte	8                       # Address Size (in bytes)
75	.byte	0                       # Segment selector size
76.Laddr_table_base0:
77	.quad	.Lfunc_begin0
78