Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Print in infix form a struct expression. |
1bac305b | 2 | |
197e01b6 | 3 | Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, |
7b6bb8da | 4 | 1998, 1999, 2000, 2003, 2007, 2008, 2009, 2010, 2011 |
4c38e0a4 | 5 | Free Software Foundation, Inc. |
c906108c | 6 | |
c5aa993b | 7 | This file is part of GDB. |
c906108c | 8 | |
c5aa993b JM |
9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 11 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 12 | (at your option) any later version. |
c906108c | 13 | |
c5aa993b JM |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
c906108c | 18 | |
c5aa993b | 19 | You should have received a copy of the GNU General Public License |
a9762ec7 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
21 | |
22 | #include "defs.h" | |
23 | #include "symtab.h" | |
24 | #include "gdbtypes.h" | |
25 | #include "expression.h" | |
26 | #include "value.h" | |
27 | #include "language.h" | |
28 | #include "parser-defs.h" | |
eb8bc282 | 29 | #include "user-regs.h" /* For user_reg_map_regnum_to_name. */ |
82eeeb94 AF |
30 | #include "target.h" |
31 | #include "gdb_string.h" | |
fe898f56 | 32 | #include "block.h" |
9e35dae4 | 33 | #include "objfiles.h" |
fcd776e5 | 34 | #include "gdb_assert.h" |
79a45b7d | 35 | #include "valprint.h" |
c906108c SS |
36 | |
37 | #ifdef HAVE_CTYPE_H | |
38 | #include <ctype.h> | |
39 | #endif | |
40 | ||
c906108c | 41 | void |
fba45db2 | 42 | print_expression (struct expression *exp, struct ui_file *stream) |
c906108c SS |
43 | { |
44 | int pc = 0; | |
d7f9d729 | 45 | |
c906108c SS |
46 | print_subexp (exp, &pc, stream, PREC_NULL); |
47 | } | |
48 | ||
49 | /* Print the subexpression of EXP that starts in position POS, on STREAM. | |
50 | PREC is the precedence of the surrounding operator; | |
51 | if the precedence of the main operator of this subexpression is less, | |
52 | parentheses are needed here. */ | |
53 | ||
5f9769d1 | 54 | void |
f86f5ca3 | 55 | print_subexp (struct expression *exp, int *pos, |
fba45db2 | 56 | struct ui_file *stream, enum precedence prec) |
5f9769d1 PH |
57 | { |
58 | exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec); | |
59 | } | |
60 | ||
61 | /* Standard implementation of print_subexp for use in language_defn | |
62 | vectors. */ | |
63 | void | |
64 | print_subexp_standard (struct expression *exp, int *pos, | |
65 | struct ui_file *stream, enum precedence prec) | |
c906108c | 66 | { |
f86f5ca3 PH |
67 | unsigned tem; |
68 | const struct op_print *op_print_tab; | |
69 | int pc; | |
c906108c | 70 | unsigned nargs; |
f86f5ca3 | 71 | char *op_str; |
c906108c SS |
72 | int assign_modify = 0; |
73 | enum exp_opcode opcode; | |
74 | enum precedence myprec = PREC_NULL; | |
75 | /* Set to 1 for a right-associative operator. */ | |
76 | int assoc = 0; | |
3d6d86c6 | 77 | struct value *val; |
c906108c SS |
78 | char *tempstr = NULL; |
79 | ||
80 | op_print_tab = exp->language_defn->la_op_print_tab; | |
81 | pc = (*pos)++; | |
82 | opcode = exp->elts[pc].opcode; | |
83 | switch (opcode) | |
84 | { | |
c5aa993b | 85 | /* Common ops */ |
c906108c SS |
86 | |
87 | case OP_SCOPE: | |
88 | myprec = PREC_PREFIX; | |
89 | assoc = 0; | |
90 | fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream); | |
91 | fputs_filtered ("::", stream); | |
92 | nargs = longest_to_int (exp->elts[pc + 2].longconst); | |
93 | (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1); | |
94 | fputs_filtered (&exp->elts[pc + 3].string, stream); | |
95 | return; | |
96 | ||
97 | case OP_LONG: | |
79a45b7d TT |
98 | { |
99 | struct value_print_options opts; | |
d7f9d729 | 100 | |
79a45b7d TT |
101 | get_raw_print_options (&opts); |
102 | (*pos) += 3; | |
103 | value_print (value_from_longest (exp->elts[pc + 1].type, | |
104 | exp->elts[pc + 2].longconst), | |
105 | stream, &opts); | |
106 | } | |
c906108c SS |
107 | return; |
108 | ||
109 | case OP_DOUBLE: | |
79a45b7d TT |
110 | { |
111 | struct value_print_options opts; | |
d7f9d729 | 112 | |
79a45b7d TT |
113 | get_raw_print_options (&opts); |
114 | (*pos) += 3; | |
115 | value_print (value_from_double (exp->elts[pc + 1].type, | |
116 | exp->elts[pc + 2].doubleconst), | |
117 | stream, &opts); | |
118 | } | |
c906108c SS |
119 | return; |
120 | ||
121 | case OP_VAR_VALUE: | |
122 | { | |
123 | struct block *b; | |
d7f9d729 | 124 | |
c906108c SS |
125 | (*pos) += 3; |
126 | b = exp->elts[pc + 1].block; | |
127 | if (b != NULL | |
128 | && BLOCK_FUNCTION (b) != NULL | |
de5ad195 | 129 | && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL) |
c906108c | 130 | { |
de5ad195 | 131 | fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream); |
c906108c SS |
132 | fputs_filtered ("::", stream); |
133 | } | |
de5ad195 | 134 | fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream); |
c906108c SS |
135 | } |
136 | return; | |
137 | ||
138 | case OP_LAST: | |
139 | (*pos) += 2; | |
140 | fprintf_filtered (stream, "$%d", | |
141 | longest_to_int (exp->elts[pc + 1].longconst)); | |
142 | return; | |
143 | ||
144 | case OP_REGISTER: | |
e36180d7 | 145 | { |
67f3407f | 146 | const char *name = &exp->elts[pc + 2].string; |
d7f9d729 | 147 | |
67f3407f | 148 | (*pos) += 3 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1); |
eb8bc282 | 149 | fprintf_filtered (stream, "$%s", name); |
e36180d7 AC |
150 | return; |
151 | } | |
c906108c SS |
152 | |
153 | case OP_BOOL: | |
154 | (*pos) += 2; | |
155 | fprintf_filtered (stream, "%s", | |
156 | longest_to_int (exp->elts[pc + 1].longconst) | |
157 | ? "TRUE" : "FALSE"); | |
158 | return; | |
159 | ||
160 | case OP_INTERNALVAR: | |
161 | (*pos) += 2; | |
162 | fprintf_filtered (stream, "$%s", | |
c5aa993b | 163 | internalvar_name (exp->elts[pc + 1].internalvar)); |
c906108c SS |
164 | return; |
165 | ||
166 | case OP_FUNCALL: | |
167 | (*pos) += 2; | |
168 | nargs = longest_to_int (exp->elts[pc + 1].longconst); | |
169 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
170 | fputs_filtered (" (", stream); | |
171 | for (tem = 0; tem < nargs; tem++) | |
172 | { | |
173 | if (tem != 0) | |
174 | fputs_filtered (", ", stream); | |
175 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
176 | } | |
177 | fputs_filtered (")", stream); | |
178 | return; | |
179 | ||
180 | case OP_NAME: | |
c5aa993b | 181 | nargs = longest_to_int (exp->elts[pc + 1].longconst); |
c906108c SS |
182 | (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1); |
183 | fputs_filtered (&exp->elts[pc + 2].string, stream); | |
184 | return; | |
185 | ||
186 | case OP_STRING: | |
79a45b7d TT |
187 | { |
188 | struct value_print_options opts; | |
d7f9d729 | 189 | |
79a45b7d TT |
190 | nargs = longest_to_int (exp->elts[pc + 1].longconst); |
191 | (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1); | |
192 | /* LA_PRINT_STRING will print using the current repeat count threshold. | |
193 | If necessary, we can temporarily set it to zero, or pass it as an | |
194 | additional parameter to LA_PRINT_STRING. -fnf */ | |
195 | get_user_print_options (&opts); | |
6c7a06a3 | 196 | LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char, |
be759fcf | 197 | &exp->elts[pc + 2].string, nargs, NULL, 0, &opts); |
79a45b7d | 198 | } |
c906108c SS |
199 | return; |
200 | ||
201 | case OP_BITSTRING: | |
c5aa993b | 202 | nargs = longest_to_int (exp->elts[pc + 1].longconst); |
c906108c SS |
203 | (*pos) |
204 | += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT); | |
205 | fprintf_unfiltered (stream, "B'<unimplemented>'"); | |
206 | return; | |
207 | ||
3e43a32a MS |
208 | case OP_OBJC_NSSTRING: /* Objective-C Foundation Class |
209 | NSString constant. */ | |
79a45b7d TT |
210 | { |
211 | struct value_print_options opts; | |
d7f9d729 | 212 | |
79a45b7d TT |
213 | nargs = longest_to_int (exp->elts[pc + 1].longconst); |
214 | (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1); | |
215 | fputs_filtered ("@\"", stream); | |
216 | get_user_print_options (&opts); | |
6c7a06a3 | 217 | LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char, |
be759fcf | 218 | &exp->elts[pc + 2].string, nargs, NULL, 0, &opts); |
79a45b7d TT |
219 | fputs_filtered ("\"", stream); |
220 | } | |
82eeeb94 AF |
221 | return; |
222 | ||
223 | case OP_OBJC_MSGCALL: | |
224 | { /* Objective C message (method) call. */ | |
225 | char *selector; | |
d7f9d729 | 226 | |
82eeeb94 AF |
227 | (*pos) += 3; |
228 | nargs = longest_to_int (exp->elts[pc + 2].longconst); | |
229 | fprintf_unfiltered (stream, "["); | |
230 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
231 | if (0 == target_read_string (exp->elts[pc + 1].longconst, | |
232 | &selector, 1024, NULL)) | |
233 | { | |
8a3fe4f8 | 234 | error (_("bad selector")); |
82eeeb94 AF |
235 | return; |
236 | } | |
237 | if (nargs) | |
238 | { | |
239 | char *s, *nextS; | |
d7f9d729 | 240 | |
82eeeb94 AF |
241 | s = alloca (strlen (selector) + 1); |
242 | strcpy (s, selector); | |
243 | for (tem = 0; tem < nargs; tem++) | |
244 | { | |
245 | nextS = strchr (s, ':'); | |
fcd776e5 | 246 | gdb_assert (nextS); /* Make sure we found ':'. */ |
82eeeb94 AF |
247 | *nextS = '\0'; |
248 | fprintf_unfiltered (stream, " %s: ", s); | |
249 | s = nextS + 1; | |
250 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
251 | } | |
252 | } | |
253 | else | |
254 | { | |
255 | fprintf_unfiltered (stream, " %s", selector); | |
256 | } | |
257 | fprintf_unfiltered (stream, "]"); | |
0963b4bd | 258 | /* "selector" was malloc'd by target_read_string. Free it. */ |
4ef3f3be | 259 | xfree (selector); |
82eeeb94 AF |
260 | return; |
261 | } | |
262 | ||
c906108c SS |
263 | case OP_ARRAY: |
264 | (*pos) += 3; | |
265 | nargs = longest_to_int (exp->elts[pc + 2].longconst); | |
266 | nargs -= longest_to_int (exp->elts[pc + 1].longconst); | |
267 | nargs++; | |
268 | tem = 0; | |
269 | if (exp->elts[pc + 4].opcode == OP_LONG | |
b806fb9a UW |
270 | && exp->elts[pc + 5].type |
271 | == builtin_type (exp->gdbarch)->builtin_char | |
c906108c SS |
272 | && exp->language_defn->la_language == language_c) |
273 | { | |
274 | /* Attempt to print C character arrays using string syntax. | |
275 | Walk through the args, picking up one character from each | |
276 | of the OP_LONG expression elements. If any array element | |
277 | does not match our expection of what we should find for | |
278 | a simple string, revert back to array printing. Note that | |
279 | the last expression element is an explicit null terminator | |
0963b4bd | 280 | byte, which doesn't get printed. */ |
c906108c SS |
281 | tempstr = alloca (nargs); |
282 | pc += 4; | |
283 | while (tem < nargs) | |
284 | { | |
285 | if (exp->elts[pc].opcode != OP_LONG | |
b806fb9a UW |
286 | || exp->elts[pc + 1].type |
287 | != builtin_type (exp->gdbarch)->builtin_char) | |
c906108c | 288 | { |
0963b4bd MS |
289 | /* Not a simple array of char, use regular array |
290 | printing. */ | |
c906108c SS |
291 | tem = 0; |
292 | break; | |
293 | } | |
294 | else | |
295 | { | |
296 | tempstr[tem++] = | |
297 | longest_to_int (exp->elts[pc + 2].longconst); | |
298 | pc += 4; | |
299 | } | |
300 | } | |
301 | } | |
302 | if (tem > 0) | |
303 | { | |
79a45b7d | 304 | struct value_print_options opts; |
d7f9d729 | 305 | |
79a45b7d | 306 | get_user_print_options (&opts); |
6c7a06a3 | 307 | LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char, |
be759fcf | 308 | tempstr, nargs - 1, NULL, 0, &opts); |
c906108c SS |
309 | (*pos) = pc; |
310 | } | |
311 | else | |
312 | { | |
db034ac5 | 313 | fputs_filtered (" {", stream); |
c906108c SS |
314 | for (tem = 0; tem < nargs; tem++) |
315 | { | |
316 | if (tem != 0) | |
317 | { | |
318 | fputs_filtered (", ", stream); | |
319 | } | |
320 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
321 | } | |
db034ac5 | 322 | fputs_filtered ("}", stream); |
c906108c SS |
323 | } |
324 | return; | |
325 | ||
326 | case OP_LABELED: | |
327 | tem = longest_to_int (exp->elts[pc + 1].longconst); | |
328 | (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); | |
1b831c93 | 329 | /* Gcc support both these syntaxes. Unsure which is preferred. */ |
c906108c | 330 | #if 1 |
1b831c93 AC |
331 | fputs_filtered (&exp->elts[pc + 2].string, stream); |
332 | fputs_filtered (": ", stream); | |
c906108c | 333 | #else |
1b831c93 AC |
334 | fputs_filtered (".", stream); |
335 | fputs_filtered (&exp->elts[pc + 2].string, stream); | |
336 | fputs_filtered ("=", stream); | |
c906108c | 337 | #endif |
c906108c SS |
338 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
339 | return; | |
340 | ||
341 | case TERNOP_COND: | |
342 | if ((int) prec > (int) PREC_COMMA) | |
343 | fputs_filtered ("(", stream); | |
344 | /* Print the subexpressions, forcing parentheses | |
c5aa993b JM |
345 | around any binary operations within them. |
346 | This is more parentheses than are strictly necessary, | |
347 | but it looks clearer. */ | |
c906108c SS |
348 | print_subexp (exp, pos, stream, PREC_HYPER); |
349 | fputs_filtered (" ? ", stream); | |
350 | print_subexp (exp, pos, stream, PREC_HYPER); | |
351 | fputs_filtered (" : ", stream); | |
352 | print_subexp (exp, pos, stream, PREC_HYPER); | |
353 | if ((int) prec > (int) PREC_COMMA) | |
354 | fputs_filtered (")", stream); | |
355 | return; | |
356 | ||
357 | case TERNOP_SLICE: | |
358 | case TERNOP_SLICE_COUNT: | |
359 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
360 | fputs_filtered ("(", stream); | |
361 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
362 | fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream); | |
363 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
364 | fputs_filtered (")", stream); | |
365 | return; | |
366 | ||
367 | case STRUCTOP_STRUCT: | |
368 | tem = longest_to_int (exp->elts[pc + 1].longconst); | |
369 | (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); | |
370 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
371 | fputs_filtered (".", stream); | |
372 | fputs_filtered (&exp->elts[pc + 2].string, stream); | |
373 | return; | |
374 | ||
0963b4bd | 375 | /* Will not occur for Modula-2. */ |
c906108c SS |
376 | case STRUCTOP_PTR: |
377 | tem = longest_to_int (exp->elts[pc + 1].longconst); | |
378 | (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); | |
379 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
380 | fputs_filtered ("->", stream); | |
381 | fputs_filtered (&exp->elts[pc + 2].string, stream); | |
382 | return; | |
383 | ||
0534816d DJ |
384 | case STRUCTOP_MEMBER: |
385 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
386 | fputs_filtered (".*", stream); | |
387 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
388 | return; | |
389 | ||
390 | case STRUCTOP_MPTR: | |
391 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
392 | fputs_filtered ("->*", stream); | |
393 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
394 | return; | |
395 | ||
c906108c SS |
396 | case BINOP_SUBSCRIPT: |
397 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
398 | fputs_filtered ("[", stream); | |
399 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
400 | fputs_filtered ("]", stream); | |
401 | return; | |
402 | ||
403 | case UNOP_POSTINCREMENT: | |
404 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
405 | fputs_filtered ("++", stream); | |
406 | return; | |
407 | ||
408 | case UNOP_POSTDECREMENT: | |
409 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
410 | fputs_filtered ("--", stream); | |
411 | return; | |
412 | ||
413 | case UNOP_CAST: | |
414 | (*pos) += 2; | |
415 | if ((int) prec > (int) PREC_PREFIX) | |
c5aa993b | 416 | fputs_filtered ("(", stream); |
c906108c SS |
417 | fputs_filtered ("(", stream); |
418 | type_print (exp->elts[pc + 1].type, "", stream, 0); | |
419 | fputs_filtered (") ", stream); | |
420 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
421 | if ((int) prec > (int) PREC_PREFIX) | |
c5aa993b | 422 | fputs_filtered (")", stream); |
c906108c SS |
423 | return; |
424 | ||
4e8f195d TT |
425 | case UNOP_DYNAMIC_CAST: |
426 | case UNOP_REINTERPRET_CAST: | |
427 | fputs_filtered (opcode == UNOP_DYNAMIC_CAST ? "dynamic_cast" | |
428 | : "reinterpret_cast", stream); | |
429 | fputs_filtered ("<", stream); | |
430 | (*pos) += 2; | |
431 | type_print (exp->elts[pc + 1].type, "", stream, 0); | |
432 | fputs_filtered ("> (", stream); | |
433 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
434 | fputs_filtered (")", stream); | |
435 | return; | |
436 | ||
c906108c SS |
437 | case UNOP_MEMVAL: |
438 | (*pos) += 2; | |
439 | if ((int) prec > (int) PREC_PREFIX) | |
c5aa993b | 440 | fputs_filtered ("(", stream); |
905e0470 PM |
441 | if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC |
442 | && exp->elts[pc + 3].opcode == OP_LONG) | |
c5aa993b | 443 | { |
79a45b7d TT |
444 | struct value_print_options opts; |
445 | ||
c5aa993b JM |
446 | /* We have a minimal symbol fn, probably. It's encoded |
447 | as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address). | |
448 | Swallow the OP_LONG (including both its opcodes); ignore | |
449 | its type; print the value in the type of the MEMVAL. */ | |
450 | (*pos) += 4; | |
451 | val = value_at_lazy (exp->elts[pc + 1].type, | |
00a4c844 | 452 | (CORE_ADDR) exp->elts[pc + 5].longconst); |
79a45b7d TT |
453 | get_raw_print_options (&opts); |
454 | value_print (val, stream, &opts); | |
c5aa993b JM |
455 | } |
456 | else | |
457 | { | |
458 | fputs_filtered ("{", stream); | |
459 | type_print (exp->elts[pc + 1].type, "", stream, 0); | |
460 | fputs_filtered ("} ", stream); | |
461 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
462 | } | |
c906108c | 463 | if ((int) prec > (int) PREC_PREFIX) |
c5aa993b | 464 | fputs_filtered (")", stream); |
c906108c SS |
465 | return; |
466 | ||
9e35dae4 DJ |
467 | case UNOP_MEMVAL_TLS: |
468 | (*pos) += 3; | |
469 | if ((int) prec > (int) PREC_PREFIX) | |
470 | fputs_filtered ("(", stream); | |
471 | fputs_filtered ("{", stream); | |
472 | type_print (exp->elts[pc + 2].type, "", stream, 0); | |
473 | fputs_filtered ("} ", stream); | |
474 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
475 | if ((int) prec > (int) PREC_PREFIX) | |
476 | fputs_filtered (")", stream); | |
477 | return; | |
478 | ||
c906108c SS |
479 | case BINOP_ASSIGN_MODIFY: |
480 | opcode = exp->elts[pc + 1].opcode; | |
481 | (*pos) += 2; | |
482 | myprec = PREC_ASSIGN; | |
483 | assoc = 1; | |
484 | assign_modify = 1; | |
485 | op_str = "???"; | |
486 | for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++) | |
487 | if (op_print_tab[tem].opcode == opcode) | |
488 | { | |
489 | op_str = op_print_tab[tem].string; | |
490 | break; | |
491 | } | |
492 | if (op_print_tab[tem].opcode != opcode) | |
493 | /* Not found; don't try to keep going because we don't know how | |
494 | to interpret further elements. */ | |
8a3fe4f8 | 495 | error (_("Invalid expression")); |
c906108c SS |
496 | break; |
497 | ||
c5aa993b | 498 | /* C++ ops */ |
c906108c SS |
499 | |
500 | case OP_THIS: | |
501 | ++(*pos); | |
502 | fputs_filtered ("this", stream); | |
503 | return; | |
504 | ||
82eeeb94 AF |
505 | /* Objective-C ops */ |
506 | ||
507 | case OP_OBJC_SELF: | |
508 | ++(*pos); | |
509 | fputs_filtered ("self", stream); /* The ObjC equivalent of "this". */ | |
510 | return; | |
511 | ||
c5aa993b | 512 | /* Modula-2 ops */ |
c906108c SS |
513 | |
514 | case MULTI_SUBSCRIPT: | |
515 | (*pos) += 2; | |
516 | nargs = longest_to_int (exp->elts[pc + 1].longconst); | |
517 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
518 | fprintf_unfiltered (stream, " ["); | |
519 | for (tem = 0; tem < nargs; tem++) | |
520 | { | |
521 | if (tem != 0) | |
522 | fprintf_unfiltered (stream, ", "); | |
523 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); | |
524 | } | |
525 | fprintf_unfiltered (stream, "]"); | |
526 | return; | |
527 | ||
528 | case BINOP_VAL: | |
c5aa993b JM |
529 | (*pos) += 2; |
530 | fprintf_unfiltered (stream, "VAL("); | |
531 | type_print (exp->elts[pc + 1].type, "", stream, 0); | |
532 | fprintf_unfiltered (stream, ","); | |
533 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
534 | fprintf_unfiltered (stream, ")"); | |
c906108c | 535 | return; |
c5aa993b | 536 | |
600ea1be JK |
537 | case TYPE_INSTANCE: |
538 | { | |
539 | LONGEST count = exp->elts[pc + 1].longconst; | |
540 | ||
541 | /* The COUNT. */ | |
542 | (*pos)++; | |
543 | fputs_unfiltered ("TypesInstance(", stream); | |
544 | while (count-- > 0) | |
545 | { | |
546 | type_print (exp->elts[(*pos)++].type, "", stream, 0); | |
547 | if (count > 0) | |
548 | fputs_unfiltered (",", stream); | |
549 | } | |
550 | fputs_unfiltered (",", stream); | |
551 | /* Ending COUNT and ending TYPE_INSTANCE. */ | |
552 | (*pos) += 2; | |
553 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
554 | fputs_unfiltered (")", stream); | |
555 | return; | |
556 | } | |
557 | ||
c5aa993b | 558 | /* Default ops */ |
c906108c SS |
559 | |
560 | default: | |
561 | op_str = "???"; | |
562 | for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++) | |
563 | if (op_print_tab[tem].opcode == opcode) | |
564 | { | |
565 | op_str = op_print_tab[tem].string; | |
566 | myprec = op_print_tab[tem].precedence; | |
567 | assoc = op_print_tab[tem].right_assoc; | |
568 | break; | |
569 | } | |
570 | if (op_print_tab[tem].opcode != opcode) | |
571 | /* Not found; don't try to keep going because we don't know how | |
572 | to interpret further elements. For example, this happens | |
573 | if opcode is OP_TYPE. */ | |
8a3fe4f8 | 574 | error (_("Invalid expression")); |
c5aa993b | 575 | } |
c906108c | 576 | |
0963b4bd | 577 | /* Note that PREC_BUILTIN will always emit parentheses. */ |
c906108c SS |
578 | if ((int) myprec < (int) prec) |
579 | fputs_filtered ("(", stream); | |
580 | if ((int) opcode > (int) BINOP_END) | |
581 | { | |
582 | if (assoc) | |
583 | { | |
584 | /* Unary postfix operator. */ | |
585 | print_subexp (exp, pos, stream, PREC_SUFFIX); | |
586 | fputs_filtered (op_str, stream); | |
587 | } | |
588 | else | |
589 | { | |
590 | /* Unary prefix operator. */ | |
591 | fputs_filtered (op_str, stream); | |
592 | if (myprec == PREC_BUILTIN_FUNCTION) | |
593 | fputs_filtered ("(", stream); | |
594 | print_subexp (exp, pos, stream, PREC_PREFIX); | |
595 | if (myprec == PREC_BUILTIN_FUNCTION) | |
596 | fputs_filtered (")", stream); | |
597 | } | |
598 | } | |
599 | else | |
600 | { | |
601 | /* Binary operator. */ | |
602 | /* Print left operand. | |
c5aa993b JM |
603 | If operator is right-associative, |
604 | increment precedence for this operand. */ | |
c906108c SS |
605 | print_subexp (exp, pos, stream, |
606 | (enum precedence) ((int) myprec + assoc)); | |
607 | /* Print the operator itself. */ | |
608 | if (assign_modify) | |
609 | fprintf_filtered (stream, " %s= ", op_str); | |
610 | else if (op_str[0] == ',') | |
611 | fprintf_filtered (stream, "%s ", op_str); | |
612 | else | |
613 | fprintf_filtered (stream, " %s ", op_str); | |
614 | /* Print right operand. | |
c5aa993b JM |
615 | If operator is left-associative, |
616 | increment precedence for this operand. */ | |
c906108c SS |
617 | print_subexp (exp, pos, stream, |
618 | (enum precedence) ((int) myprec + !assoc)); | |
619 | } | |
620 | ||
621 | if ((int) myprec < (int) prec) | |
622 | fputs_filtered (")", stream); | |
623 | } | |
624 | ||
625 | /* Return the operator corresponding to opcode OP as | |
626 | a string. NULL indicates that the opcode was not found in the | |
627 | current language table. */ | |
628 | char * | |
fba45db2 | 629 | op_string (enum exp_opcode op) |
c906108c SS |
630 | { |
631 | int tem; | |
f86f5ca3 | 632 | const struct op_print *op_print_tab; |
c906108c SS |
633 | |
634 | op_print_tab = current_language->la_op_print_tab; | |
635 | for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++) | |
636 | if (op_print_tab[tem].opcode == op) | |
637 | return op_print_tab[tem].string; | |
638 | return NULL; | |
639 | } | |
640 | ||
c906108c SS |
641 | /* Support for dumping the raw data from expressions in a human readable |
642 | form. */ | |
643 | ||
5f9769d1 | 644 | static char *op_name (struct expression *, enum exp_opcode); |
24daaebc | 645 | static int dump_subexp_body (struct expression *exp, struct ui_file *, int); |
c906108c | 646 | |
0963b4bd | 647 | /* Name for OPCODE, when it appears in expression EXP. */ |
5f9769d1 | 648 | |
c906108c | 649 | static char * |
5f9769d1 PH |
650 | op_name (struct expression *exp, enum exp_opcode opcode) |
651 | { | |
652 | return exp->language_defn->la_exp_desc->op_name (opcode); | |
653 | } | |
654 | ||
655 | /* Default name for the standard operator OPCODE (i.e., one defined in | |
656 | the definition of enum exp_opcode). */ | |
657 | ||
658 | char * | |
659 | op_name_standard (enum exp_opcode opcode) | |
c906108c SS |
660 | { |
661 | switch (opcode) | |
662 | { | |
663 | default: | |
664 | { | |
665 | static char buf[30]; | |
666 | ||
667 | sprintf (buf, "<unknown %d>", opcode); | |
668 | return buf; | |
669 | } | |
56c12414 JK |
670 | #define OP(name) \ |
671 | case name: \ | |
672 | return #name ; | |
673 | #include "std-operator.def" | |
674 | #undef OP | |
c906108c SS |
675 | } |
676 | } | |
677 | ||
a411cd0e DE |
678 | /* Print a raw dump of expression EXP to STREAM. |
679 | NOTE, if non-NULL, is printed as extra explanatory text. */ | |
680 | ||
c906108c | 681 | void |
24daaebc PH |
682 | dump_raw_expression (struct expression *exp, struct ui_file *stream, |
683 | char *note) | |
c906108c SS |
684 | { |
685 | int elt; | |
686 | char *opcode_name; | |
687 | char *eltscan; | |
688 | int eltsize; | |
689 | ||
690 | fprintf_filtered (stream, "Dump of expression @ "); | |
d4f3574e | 691 | gdb_print_host_address (exp, stream); |
a411cd0e DE |
692 | if (note) |
693 | fprintf_filtered (stream, ", %s:", note); | |
694 | fprintf_filtered (stream, "\n\tLanguage %s, %d elements, %ld bytes each.\n", | |
c5aa993b | 695 | exp->language_defn->la_name, exp->nelts, |
9d271fd8 | 696 | (long) sizeof (union exp_element)); |
c906108c SS |
697 | fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode", |
698 | "Hex Value", "String Value"); | |
c5aa993b | 699 | for (elt = 0; elt < exp->nelts; elt++) |
c906108c SS |
700 | { |
701 | fprintf_filtered (stream, "\t%5d ", elt); | |
5f9769d1 | 702 | opcode_name = op_name (exp, exp->elts[elt].opcode); |
c906108c SS |
703 | |
704 | fprintf_filtered (stream, "%20s ", opcode_name); | |
c5aa993b | 705 | print_longest (stream, 'd', 0, exp->elts[elt].longconst); |
c906108c SS |
706 | fprintf_filtered (stream, " "); |
707 | ||
708 | for (eltscan = (char *) &exp->elts[elt], | |
c5aa993b | 709 | eltsize = sizeof (union exp_element); |
c906108c SS |
710 | eltsize-- > 0; |
711 | eltscan++) | |
712 | { | |
713 | fprintf_filtered (stream, "%c", | |
714 | isprint (*eltscan) ? (*eltscan & 0xFF) : '.'); | |
715 | } | |
716 | fprintf_filtered (stream, "\n"); | |
717 | } | |
718 | } | |
719 | ||
24daaebc PH |
720 | /* Dump the subexpression of prefix expression EXP whose operator is at |
721 | position ELT onto STREAM. Returns the position of the next | |
722 | subexpression in EXP. */ | |
c906108c | 723 | |
24daaebc | 724 | int |
fba45db2 | 725 | dump_subexp (struct expression *exp, struct ui_file *stream, int elt) |
c906108c SS |
726 | { |
727 | static int indent = 0; | |
728 | int i; | |
729 | ||
730 | fprintf_filtered (stream, "\n"); | |
731 | fprintf_filtered (stream, "\t%5d ", elt); | |
732 | ||
733 | for (i = 1; i <= indent; i++) | |
734 | fprintf_filtered (stream, " "); | |
735 | indent += 2; | |
736 | ||
5f9769d1 | 737 | fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode)); |
c906108c | 738 | |
24daaebc PH |
739 | elt = dump_subexp_body (exp, stream, elt); |
740 | ||
741 | indent -= 2; | |
742 | ||
743 | return elt; | |
744 | } | |
745 | ||
746 | /* Dump the operands of prefix expression EXP whose opcode is at | |
747 | position ELT onto STREAM. Returns the position of the next | |
748 | subexpression in EXP. */ | |
749 | ||
750 | static int | |
751 | dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt) | |
5f9769d1 PH |
752 | { |
753 | return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt); | |
754 | } | |
755 | ||
756 | /* Default value for subexp_body in exp_descriptor vector. */ | |
757 | ||
758 | int | |
759 | dump_subexp_body_standard (struct expression *exp, | |
760 | struct ui_file *stream, int elt) | |
24daaebc PH |
761 | { |
762 | int opcode = exp->elts[elt++].opcode; | |
763 | ||
764 | switch (opcode) | |
c906108c SS |
765 | { |
766 | case TERNOP_COND: | |
767 | case TERNOP_SLICE: | |
768 | case TERNOP_SLICE_COUNT: | |
769 | elt = dump_subexp (exp, stream, elt); | |
cb969d61 | 770 | /* FALL THROUGH */ |
c906108c SS |
771 | case BINOP_ADD: |
772 | case BINOP_SUB: | |
773 | case BINOP_MUL: | |
774 | case BINOP_DIV: | |
775 | case BINOP_REM: | |
776 | case BINOP_MOD: | |
777 | case BINOP_LSH: | |
778 | case BINOP_RSH: | |
779 | case BINOP_LOGICAL_AND: | |
780 | case BINOP_LOGICAL_OR: | |
781 | case BINOP_BITWISE_AND: | |
782 | case BINOP_BITWISE_IOR: | |
783 | case BINOP_BITWISE_XOR: | |
784 | case BINOP_EQUAL: | |
785 | case BINOP_NOTEQUAL: | |
786 | case BINOP_LESS: | |
787 | case BINOP_GTR: | |
788 | case BINOP_LEQ: | |
789 | case BINOP_GEQ: | |
790 | case BINOP_REPEAT: | |
791 | case BINOP_ASSIGN: | |
792 | case BINOP_COMMA: | |
793 | case BINOP_SUBSCRIPT: | |
794 | case BINOP_EXP: | |
795 | case BINOP_MIN: | |
796 | case BINOP_MAX: | |
c906108c SS |
797 | case BINOP_INTDIV: |
798 | case BINOP_ASSIGN_MODIFY: | |
799 | case BINOP_VAL: | |
c906108c SS |
800 | case BINOP_CONCAT: |
801 | case BINOP_IN: | |
802 | case BINOP_RANGE: | |
803 | case BINOP_END: | |
0534816d DJ |
804 | case STRUCTOP_MEMBER: |
805 | case STRUCTOP_MPTR: | |
c906108c | 806 | elt = dump_subexp (exp, stream, elt); |
cb969d61 | 807 | /* FALL THROUGH */ |
c906108c SS |
808 | case UNOP_NEG: |
809 | case UNOP_LOGICAL_NOT: | |
810 | case UNOP_COMPLEMENT: | |
811 | case UNOP_IND: | |
812 | case UNOP_ADDR: | |
813 | case UNOP_PREINCREMENT: | |
814 | case UNOP_POSTINCREMENT: | |
815 | case UNOP_PREDECREMENT: | |
816 | case UNOP_POSTDECREMENT: | |
817 | case UNOP_SIZEOF: | |
818 | case UNOP_PLUS: | |
819 | case UNOP_CAP: | |
820 | case UNOP_CHR: | |
821 | case UNOP_ORD: | |
822 | case UNOP_ABS: | |
823 | case UNOP_FLOAT: | |
824 | case UNOP_HIGH: | |
825 | case UNOP_MAX: | |
826 | case UNOP_MIN: | |
827 | case UNOP_ODD: | |
828 | case UNOP_TRUNC: | |
c906108c SS |
829 | elt = dump_subexp (exp, stream, elt); |
830 | break; | |
831 | case OP_LONG: | |
d4f3574e SS |
832 | fprintf_filtered (stream, "Type @"); |
833 | gdb_print_host_address (exp->elts[elt].type, stream); | |
834 | fprintf_filtered (stream, " ("); | |
c906108c SS |
835 | type_print (exp->elts[elt].type, NULL, stream, 0); |
836 | fprintf_filtered (stream, "), value %ld (0x%lx)", | |
c5aa993b JM |
837 | (long) exp->elts[elt + 1].longconst, |
838 | (long) exp->elts[elt + 1].longconst); | |
c906108c SS |
839 | elt += 3; |
840 | break; | |
841 | case OP_DOUBLE: | |
d4f3574e SS |
842 | fprintf_filtered (stream, "Type @"); |
843 | gdb_print_host_address (exp->elts[elt].type, stream); | |
844 | fprintf_filtered (stream, " ("); | |
c906108c SS |
845 | type_print (exp->elts[elt].type, NULL, stream, 0); |
846 | fprintf_filtered (stream, "), value %g", | |
c5aa993b | 847 | (double) exp->elts[elt + 1].doubleconst); |
c906108c SS |
848 | elt += 3; |
849 | break; | |
850 | case OP_VAR_VALUE: | |
d4f3574e SS |
851 | fprintf_filtered (stream, "Block @"); |
852 | gdb_print_host_address (exp->elts[elt].block, stream); | |
853 | fprintf_filtered (stream, ", symbol @"); | |
854 | gdb_print_host_address (exp->elts[elt + 1].symbol, stream); | |
855 | fprintf_filtered (stream, " (%s)", | |
3567439c | 856 | SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol)); |
c906108c SS |
857 | elt += 3; |
858 | break; | |
859 | case OP_LAST: | |
860 | fprintf_filtered (stream, "History element %ld", | |
c5aa993b | 861 | (long) exp->elts[elt].longconst); |
c906108c SS |
862 | elt += 2; |
863 | break; | |
864 | case OP_REGISTER: | |
67f3407f DJ |
865 | fprintf_filtered (stream, "Register $%s", &exp->elts[elt + 1].string); |
866 | elt += 3 + BYTES_TO_EXP_ELEM (exp->elts[elt].longconst + 1); | |
c906108c SS |
867 | break; |
868 | case OP_INTERNALVAR: | |
d4f3574e SS |
869 | fprintf_filtered (stream, "Internal var @"); |
870 | gdb_print_host_address (exp->elts[elt].internalvar, stream); | |
871 | fprintf_filtered (stream, " (%s)", | |
4fa62494 | 872 | internalvar_name (exp->elts[elt].internalvar)); |
c906108c SS |
873 | elt += 2; |
874 | break; | |
875 | case OP_FUNCALL: | |
876 | { | |
24daaebc | 877 | int i, nargs; |
c906108c SS |
878 | |
879 | nargs = longest_to_int (exp->elts[elt].longconst); | |
880 | ||
881 | fprintf_filtered (stream, "Number of args: %d", nargs); | |
882 | elt += 2; | |
883 | ||
884 | for (i = 1; i <= nargs + 1; i++) | |
885 | elt = dump_subexp (exp, stream, elt); | |
886 | } | |
887 | break; | |
888 | case OP_ARRAY: | |
889 | { | |
890 | int lower, upper; | |
891 | int i; | |
892 | ||
893 | lower = longest_to_int (exp->elts[elt].longconst); | |
894 | upper = longest_to_int (exp->elts[elt + 1].longconst); | |
895 | ||
896 | fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper); | |
897 | elt += 3; | |
898 | ||
899 | for (i = 1; i <= upper - lower + 1; i++) | |
900 | elt = dump_subexp (exp, stream, elt); | |
901 | } | |
902 | break; | |
903 | case UNOP_MEMVAL: | |
904 | case UNOP_CAST: | |
4e8f195d TT |
905 | case UNOP_DYNAMIC_CAST: |
906 | case UNOP_REINTERPRET_CAST: | |
d4f3574e SS |
907 | fprintf_filtered (stream, "Type @"); |
908 | gdb_print_host_address (exp->elts[elt].type, stream); | |
909 | fprintf_filtered (stream, " ("); | |
c906108c SS |
910 | type_print (exp->elts[elt].type, NULL, stream, 0); |
911 | fprintf_filtered (stream, ")"); | |
912 | elt = dump_subexp (exp, stream, elt + 2); | |
913 | break; | |
9e35dae4 DJ |
914 | case UNOP_MEMVAL_TLS: |
915 | fprintf_filtered (stream, "TLS type @"); | |
916 | gdb_print_host_address (exp->elts[elt + 1].type, stream); | |
917 | fprintf_filtered (stream, " (__thread /* \"%s\" */ ", | |
918 | (exp->elts[elt].objfile == NULL ? "(null)" | |
919 | : exp->elts[elt].objfile->name)); | |
920 | type_print (exp->elts[elt + 1].type, NULL, stream, 0); | |
921 | fprintf_filtered (stream, ")"); | |
922 | elt = dump_subexp (exp, stream, elt + 3); | |
923 | break; | |
c906108c | 924 | case OP_TYPE: |
d4f3574e SS |
925 | fprintf_filtered (stream, "Type @"); |
926 | gdb_print_host_address (exp->elts[elt].type, stream); | |
927 | fprintf_filtered (stream, " ("); | |
c906108c SS |
928 | type_print (exp->elts[elt].type, NULL, stream, 0); |
929 | fprintf_filtered (stream, ")"); | |
930 | elt += 2; | |
931 | break; | |
932 | case STRUCTOP_STRUCT: | |
933 | case STRUCTOP_PTR: | |
934 | { | |
935 | char *elem_name; | |
936 | int len; | |
937 | ||
938 | len = longest_to_int (exp->elts[elt].longconst); | |
939 | elem_name = &exp->elts[elt + 1].string; | |
940 | ||
941 | fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name); | |
942 | elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1)); | |
943 | } | |
944 | break; | |
945 | case OP_SCOPE: | |
946 | { | |
947 | char *elem_name; | |
948 | int len; | |
949 | ||
d4f3574e SS |
950 | fprintf_filtered (stream, "Type @"); |
951 | gdb_print_host_address (exp->elts[elt].type, stream); | |
952 | fprintf_filtered (stream, " ("); | |
c906108c SS |
953 | type_print (exp->elts[elt].type, NULL, stream, 0); |
954 | fprintf_filtered (stream, ") "); | |
955 | ||
956 | len = longest_to_int (exp->elts[elt + 1].longconst); | |
957 | elem_name = &exp->elts[elt + 2].string; | |
958 | ||
959 | fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name); | |
960 | elt += 4 + BYTES_TO_EXP_ELEM (len + 1); | |
961 | } | |
962 | break; | |
600ea1be JK |
963 | case TYPE_INSTANCE: |
964 | { | |
965 | char *elem_name; | |
966 | LONGEST len; | |
967 | ||
968 | len = exp->elts[elt++].longconst; | |
969 | fprintf_filtered (stream, "%s TypeInstance: ", plongest (len)); | |
970 | while (len-- > 0) | |
971 | { | |
972 | fprintf_filtered (stream, "Type @"); | |
973 | gdb_print_host_address (exp->elts[elt].type, stream); | |
974 | fprintf_filtered (stream, " ("); | |
975 | type_print (exp->elts[elt].type, NULL, stream, 0); | |
976 | fprintf_filtered (stream, ")"); | |
977 | elt++; | |
978 | if (len > 0) | |
979 | fputs_filtered (", ", stream); | |
980 | } | |
981 | /* Ending LEN and ending TYPE_INSTANCE. */ | |
982 | elt += 2; | |
983 | elt = dump_subexp (exp, stream, elt); | |
984 | } | |
985 | break; | |
c906108c SS |
986 | default: |
987 | case OP_NULL: | |
c906108c SS |
988 | case MULTI_SUBSCRIPT: |
989 | case OP_F77_UNDETERMINED_ARGLIST: | |
990 | case OP_COMPLEX: | |
991 | case OP_STRING: | |
992 | case OP_BITSTRING: | |
993 | case OP_BOOL: | |
994 | case OP_M2_STRING: | |
995 | case OP_THIS: | |
996 | case OP_LABELED: | |
997 | case OP_NAME: | |
c906108c SS |
998 | fprintf_filtered (stream, "Unknown format"); |
999 | } | |
1000 | ||
c906108c SS |
1001 | return elt; |
1002 | } | |
1003 | ||
1004 | void | |
24daaebc | 1005 | dump_prefix_expression (struct expression *exp, struct ui_file *stream) |
c906108c SS |
1006 | { |
1007 | int elt; | |
1008 | ||
1009 | fprintf_filtered (stream, "Dump of expression @ "); | |
d4f3574e | 1010 | gdb_print_host_address (exp, stream); |
24daaebc | 1011 | fputs_filtered (", after conversion to prefix form:\nExpression: `", stream); |
c906108c SS |
1012 | if (exp->elts[0].opcode != OP_TYPE) |
1013 | print_expression (exp, stream); | |
1014 | else | |
1015 | fputs_filtered ("Type printing not yet supported....", stream); | |
9d271fd8 | 1016 | fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n", |
c5aa993b | 1017 | exp->language_defn->la_name, exp->nelts, |
9d271fd8 | 1018 | (long) sizeof (union exp_element)); |
c906108c SS |
1019 | fputs_filtered ("\n", stream); |
1020 | ||
c5aa993b | 1021 | for (elt = 0; elt < exp->nelts;) |
c906108c SS |
1022 | elt = dump_subexp (exp, stream, elt); |
1023 | fputs_filtered ("\n", stream); | |
1024 | } |