xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.dwarf2/dw2-op-call.S (revision a8c74629f602faa0ccf8a463757d7baf858bbf3a)
1/* This testcase is part of GDB, the GNU debugger.
2
3   Copyright 2009-2019 Free Software Foundation, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18/* Test DW_OP_call2 and DW_OP_call4, PR gdb/10640.  */
19
20	.section .data
21array1:	.2byte	1
22array2:	.2byte	2
23array3:	.2byte	3
24
25	.section .debug_info
26.Lcu0_begin:
27	/* CU header */
28	.4byte	.Lcu0_end - .Lcu0_start		/* Length of Compilation Unit */
29.Lcu0_start:
30	.2byte	2				/* DWARF Version */
31	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
32	.byte	4				/* Pointer size */
33
34	/* CU die */
35	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
36	.ascii	"file0.txt\0"			/* DW_AT_name */
37	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
38	.byte	2				/* DW_LANG_C (C) */
39
40	.byte	0				/* End of children of CU */
41.Lcu0_end:
42
43.Lcu1_begin:
44	/* CU header */
45	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
46.Lcu1_start:
47	.2byte	2				/* DWARF Version */
48	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
49	.byte	4				/* Pointer size */
50
51	/* CU die */
52	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
53	.ascii	"file1.txt\0"			/* DW_AT_name */
54	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
55	.byte	2				/* DW_LANG_C (C) */
56
57.L2byte_type:
58	.uleb128	2			/* Abbrev: DW_TAG_base_type */
59	.ascii		"2byte\0"		/* DW_AT_name */
60	.byte		2			/* DW_AT_byte_size */
61	.byte		7			/* DW_AT_encoding: DW_ATE_unsigned */
62
63.Larray1:
64	.uleb128	3			/* Abbrev: DW_TAG_variable */
65	.ascii		"array1\0"		/* DW_AT_name */
66	.4byte		.L2byte_type-.Lcu1_begin	/* DW_AT_type */
67	.byte		2f - 1f			/* DW_AT_location */
681:	.byte		3			/*   DW_OP_addr */
69	.4byte		array1			/*     <addr> */
702:
71
72	.uleb128	3			/* Abbrev: DW_TAG_variable */
73	.ascii		"array2\0"		/* DW_AT_name */
74	.4byte		.L2byte_type-.Lcu1_begin	/* DW_AT_type */
75	.byte		2f - 1f			/* DW_AT_location */
761:	.byte		0x98			/*   DW_OP_call2 */
77	.2byte		.Larray1-.Lcu1_begin	/*     <current CU offset> */
78	.byte		0x23			/*   DW_OP_plus_uconst */
79	.uleb128	array2-array1		/*     <uconst> */
802:
81
82	.uleb128	3			/* Abbrev: DW_TAG_variable */
83	.ascii		"array3\0"		/* DW_AT_name */
84	.4byte		.L2byte_type-.Lcu1_begin	/* DW_AT_type */
85	.byte		2f - 1f			/* DW_AT_location */
861:	.byte		0x99			/*   DW_OP_call4 */
87	.4byte		.Larray1-.Lcu1_begin	/*     <current CU offset> */
88	.byte		0x23			/*   DW_OP_plus_uconst */
89	.uleb128	array3-array1		/*     <uconst> */
902:
91
92	.uleb128	3			/* Abbrev: DW_TAG_variable */
93	.ascii		"arraycallnoloc\0"	/* DW_AT_name */
94	.4byte		.L2byte_type-.Lcu1_begin /* DW_AT_type */
95	.byte		2f - 1f			/* DW_AT_location */
961:	.byte		0x99			/*   DW_OP_call4 */
97	.4byte		.Larraynoloc-.Lcu1_begin /*     <current CU offset> */
982:
99
100.Larraynoloc:
101	.uleb128	4			/* Abbrev: DW_TAG_variable-loclist */
102	.ascii		"arraynoloc\0"		/* DW_AT_name */
103	.4byte		.L2byte_type-.Lcu1_begin /* DW_AT_type */
104	.4byte		loclist			/* DW_AT_location */
105
106	.byte		0			/* End of children of CU */
107
108.Lcu1_end:
109
110/* Location list.  */
111	.section	.debug_loc
112loclist:
113	/* Location list end.  */
114	.4byte	0, 0
115
116/* Abbrev table */
117	.section .debug_abbrev
118.Labbrev1_begin:
119	.uleb128	1			/* Abbrev code */
120	.uleb128	0x11			/* DW_TAG_compile_unit */
121	.byte		1			/* has_children */
122	.uleb128	0x3			/* DW_AT_name */
123	.uleb128	0x8			/* DW_FORM_string */
124	.uleb128	0x25			/* DW_AT_producer */
125	.uleb128	0x8			/* DW_FORM_string */
126	.uleb128	0x13			/* DW_AT_language */
127	.uleb128	0xb			/* DW_FORM_data1 */
128	.byte		0x0			/* Terminator */
129	.byte		0x0			/* Terminator */
130
131	.uleb128	2			/* Abbrev code */
132	.uleb128	0x24			/* DW_TAG_base_type */
133	.byte		0			/* has_children */
134	.uleb128	0x3			/* DW_AT_name */
135	.uleb128	0x8			/* DW_FORM_string */
136	.uleb128	0xb			/* DW_AT_byte_size */
137	.uleb128	0xb			/* DW_FORM_data1 */
138	.uleb128	0x3e			/* DW_AT_encoding */
139	.uleb128	0xb			/* DW_FORM_data1 */
140	.byte		0x0			/* Terminator */
141	.byte		0x0			/* Terminator */
142
143	.uleb128	3			/* Abbrev code */
144	.uleb128	0x34			/* DW_TAG_variable */
145	.byte		0			/* has_children */
146	.uleb128	0x3			/* DW_AT_name */
147	.uleb128	0x8			/* DW_FORM_string */
148	.uleb128	0x49			/* DW_AT_type */
149	.uleb128	0x13			/* DW_FORM_ref4 */
150	.uleb128	0x2			/* DW_AT_location */
151	.uleb128	0xa			/* DW_FORM_block1 */
152	.byte		0x0			/* Terminator */
153	.byte		0x0			/* Terminator */
154
155	.uleb128	4			/* Abbrev code */
156	.uleb128	0x34			/* DW_TAG_variable-loclist */
157	.byte		0			/* has_children */
158	.uleb128	0x3			/* DW_AT_name */
159	.uleb128	0x8			/* DW_FORM_string */
160	.uleb128	0x49			/* DW_AT_type */
161	.uleb128	0x13			/* DW_FORM_ref4 */
162	.uleb128	0x2			/* DW_AT_location */
163	.uleb128	0x06			/* DW_FORM_data4 */
164	.byte		0x0			/* Terminator */
165	.byte		0x0			/* Terminator */
166
167	.byte		0x0			/* Terminator */
168	.byte		0x0			/* Terminator */
169