summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
blob: 11b3a9c46e40ad035245e8516d6e268bc4156dad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/* Copyright (C) 2011-2019 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* This test demonstrates a failure to resolve opaque structure types in
   binaries compiled by the Intel C compiler.  This is GDB PR symtab/13277.

   The test was derived from opaque-pointer.c, which contains the single line:

   struct opaque_struct_t *p_struct;

   and opaque_struct.c, which looks like:

   struct opaque_struct_t
   {
     int wrapped_value;
   };

   struct opaque_struct_t opaque_internal = { 0 };

   What follows is a simplified version of the debug info generated by ICC
   version 12.0.4.191. */

	.file "opaque-pointer.c"
	.data
	.comm p_struct,8,8
	.global p_struct

	.section .debug_info
debug_info_seg1:
	.4byte debug_info_seg1_end - 1f	/* Length of compilation unit info. */
1:
	.2byte 0x0002			/* DWARF version number. */
	.4byte .debug_abbrev_seg1	/* Points to abbrev section for this unit. */
	.byte 0x04			/* Target address size. */

	.byte 0x01			/* DIE 1: DW_TAG_compile_unit. */
	.byte 0x01			/* DW_AT_language = DW_LANG_C89. */
	.ascii "Intel(R) C Intel(R) 64 Compiler XE "	/* DW_AT_producer. */
	.ascii "for applications running on Intel(R) 64, "
	.ascii "Version 12.0.4.191 Build 20110427\n "
	.asciz "Fixes SameLinkageName MemberPointers"

	.byte 0x02			/* DIE 2: DW_TAG_variable. */
	.byte 0x01			/* DW_AT_accessibility. */
	.asciz "p_struct"		/* DW_AT_name. */
	.4byte 3f - debug_info_seg1	/* DW_AT_type. */
	.byte 0x05			/* DW_AT_location: 5 bytes ... */
	.byte 0x03			/* DW_OP_addr ... */
	.4byte p_struct			/* followed by the address of p_struct. */
	.byte 0x01			/* DW_AT_external. */

3:
	.byte 0x03			/* DIE 3: DW_TAG_pointer_type. */
	.4byte 4f - debug_info_seg1	/* DW_AT_type. */

4:
	.byte 0x04			/* DIE 4: DW_TAG_structure_type. */
	.byte 0x01			/* DW_AT_accessibility. */
	.byte 0x00			/* DW_AT_byte_size. */
	.asciz "opaque_struct_t"	/* DW_AT_name. */

	.byte 0x00			/* End DIE 1. */
debug_info_seg1_end:

	.section .debug_abbrev
.debug_abbrev_seg1:
	.byte 0x01	/* Abbrev 1. */
	.byte 0x11	/* DW_TAG_compile_unit. */
	.byte 0x01	/* DW_CHILDREN_yes. */
	.byte 0x13	/* DW_AT_language. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x25	/* DW_AT_producer. */
	.byte 0x08	/* DW_AT_string. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x02	/* Abbrev 2. */
	.byte 0x34	/* DW_TAG_variable. */
	.byte 0x00	/* DW_CHILDREN_no. */
	.byte 0x32	/* DW_AT_accessibility. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x03	/* DW_AT_name. */
	.byte 0x08	/* DW_FORM_string. */
	.byte 0x49	/* DW_AT_type. */
	.byte 0x13	/* DW_FORM_ref4. */
	.byte 0x02	/* DW_AT_location. */
	.byte 0x0a	/* DW_FORM_block1. */
	.byte 0x3f	/* DW_AT_external. */
	.byte 0x0c	/* DW_FORM_flag. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x03	/* Abbrev 3. */
	.byte 0x0f	/* DW_TAG_pointer_type. */
	.byte 0x00	/* DW_CHILDREN_no. */
	.byte 0x49	/* DW_AT_type. */
	.byte 0x13	/* DW_FORM_ref4. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x04	/* Abbrev 4. */
	.byte 0x13	/* DW_TAG_structure_type. */
	.byte 0x00	/* DW_CHILDREN_no. */
	.byte 0x32	/* DW_AT_accessibility. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x0b	/* DW_AT_byte_size. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x03	/* DW_AT_name. */
	.byte 0x08	/* DW_FORM_string. */
	.2byte 0x0000	/* End abbrev. */
	.byte 0x00	/* End abbrev table. */


	.file "opaque-struct.c"
	.section .debug_info
debug_info_seg2:
	.4byte debug_info_seg2_end - 1f	/* Length of compilation unit info. */
1:
	.2byte 0x0002			/* DWARF version number. */
	.4byte .debug_abbrev_seg2	/* Points to abbrev section for this unit. */
	.byte 0x04			/* Target address size. */

	.byte 0x01			/* DIE 1: DW_TAG_compile_unit. */
	.byte 0x01			/* DW_AT_language = DW_LANG_C89. */
	.ascii "Intel(R) C Intel(R) 64 Compiler XE "	/* DW_AT_producer. */
	.ascii "for applications running on Intel(R) 64, "
	.ascii "Version 12.0.4.191 Build 20110427\n "
	.asciz "Fixes SameLinkageName MemberPointers"

	.byte 0x02			/* DIE 2: DW_TAG_structure_type. */
	.byte 0x01			/* DW_AT_accessibility. */
	.byte 0x04			/* DW_AT_byte_size. */
	.asciz "opaque_struct_t"	/* DW_AT_name. */


	.byte 0x03			/* DIE 3: DW_TAG_member. */
	.byte 0x02			/* DW_AT_data_member_location: 2 bytes ... */
	.byte 0x23			/* DW_OP_plus_uconst ... */
	.byte 0x00			/* followed by zero. */
	.asciz "wrapped_value"		/* DW_AT_name. */
	.4byte 4f - debug_info_seg2	/* DW_AT_type. */
	.byte 0x00

4:
	.byte 0x04			/* DIE 4: DW_TAG_base_type. */
	.byte 0x04			/* DW_AT_byte_size. */
	.byte 0x05			/* DW_AT_encoding. */
	.asciz "int"			/* DW_AT_name. */

	.byte 0x00			/* End DIE 1. */
debug_info_seg2_end:

	.section .debug_abbrev
.debug_abbrev_seg2:
	.byte 0x01	/* Abbrev 1. */
	.byte 0x11	/* DW_TAG_compile_unit. */
	.byte 0x01	/* DW_CHILDREN_yes. */
	.byte 0x13	/* DW_AT_language. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x25	/* DW_AT_producer. */
	.byte 0x08	/* DW_FORM_string. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x02	/* Abbrev 2. */
	.byte 0x13	/* DW_TAG_structure_type. */
	.byte 0x01	/* DW_CHILDREN_yes. */
	.byte 0x32	/* DW_AT_accessibility. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x0b	/* DW_AT_byte_size. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x03	/* DW_AT_name. */
	.byte 0x08	/* DW_FORM_string. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x03	/* Abbrev 3. */
	.byte 0x0d	/* DW_TAG_member. */
	.byte 0x00	/* DW_CHILDREN_no. */
	.byte 0x38	/* DW_AT_data_member_location. */
	.byte 0x0a	/* DW_FORM_block1. */
	.byte 0x03	/* DW_AT_name. */
	.byte 0x08	/* DW_FORM_string. */
	.byte 0x49	/* DW_AT_type. */
	.byte 0x13	/* DW_FORM_ref4. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x04	/* Abbrev 4. */
	.byte 0x24	/* DW_TAG_base_type. */
	.byte 0x00	/* DW_CHILDREN_no. */
	.byte 0x0b	/* DW_AT_byte_size. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x3e	/* DW_AT_encoding. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x03	/* DW_AT_name. */
	.byte 0x08	/* DW_FORM_string. */
	.2byte 0x0000	/* End abbrev. */
	.byte 0x00	/* End abbrev table. */


	.file "opaque-pointer2.c"

	.section .debug_info
debug_info_seg3:
	.4byte debug_info_seg3_end - 1f	/* Length of compilation unit info. */
1:
	.2byte 0x0002			/* DWARF version number. */
	.4byte .debug_abbrev_seg3	/* Points to abbrev section for this unit. */
	.byte 0x04			/* Target address size. */

	.byte 0x01			/* DIE 1: DW_TAG_compile_unit. */
	.byte 0x01			/* DW_AT_language = DW_LANG_C89. */
	.ascii "Intel(R) C Intel(R) 64 Compiler XE "	/* DW_AT_producer. */
	.ascii "for applications running on Intel(R) 64, "
	.ascii "Version 12.0.4.191 Build 20110427\n "
	.asciz "Fixes SameLinkageName MemberPointers"

	.byte 0x04			/* DIE 4: DW_TAG_structure_type. */
	.byte 0x01			/* DW_AT_accessibility. */
	.byte 0x00			/* DW_AT_byte_size. */
	.asciz "opaque_struct_t"	/* DW_AT_name. */

	.byte 0x00			/* End DIE 1. */
debug_info_seg3_end:

	.section .debug_abbrev
.debug_abbrev_seg3:
	.byte 0x01	/* Abbrev 1. */
	.byte 0x11	/* DW_TAG_compile_unit. */
	.byte 0x01	/* DW_CHILDREN_yes. */
	.byte 0x13	/* DW_AT_language. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x25	/* DW_AT_producer. */
	.byte 0x08	/* DW_AT_string. */
	.2byte 0x0000	/* End abbrev. */

	.byte 0x04	/* Abbrev 4. */
	.byte 0x13	/* DW_TAG_structure_type. */
	.byte 0x00	/* DW_CHILDREN_no. */
	.byte 0x32	/* DW_AT_accessibility. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x0b	/* DW_AT_byte_size. */
	.byte 0x0b	/* DW_FORM_data1. */
	.byte 0x03	/* DW_AT_name. */
	.byte 0x08	/* DW_FORM_string. */
	.2byte 0x0000	/* End abbrev. */
	.byte 0x00	/* End abbrev table. */