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