1 /* Print in infix form a struct expression.
2 Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 #include "expression.h"
26 #include "parser-defs.h"
32 /* Prototypes for local functions */
35 print_subexp PARAMS ((struct expression *, int *, GDB_FILE *, enum precedence));
38 print_expression (exp, stream)
39 struct expression *exp;
43 print_subexp (exp, &pc, stream, PREC_NULL);
46 /* Print the subexpression of EXP that starts in position POS, on STREAM.
47 PREC is the precedence of the surrounding operator;
48 if the precedence of the main operator of this subexpression is less,
49 parentheses are needed here. */
52 print_subexp (exp, pos, stream, prec)
53 register struct expression *exp;
58 register unsigned tem;
59 register const struct op_print *op_print_tab;
62 register char *op_str;
63 int assign_modify = 0;
64 enum exp_opcode opcode;
65 enum precedence myprec = PREC_NULL;
66 /* Set to 1 for a right-associative operator. */
71 op_print_tab = exp->language_defn->la_op_print_tab;
73 opcode = exp->elts[pc].opcode;
81 fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
82 fputs_filtered ("::", stream);
83 nargs = longest_to_int (exp->elts[pc + 2].longconst);
84 (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
85 fputs_filtered (&exp->elts[pc + 3].string, stream);
90 value_print (value_from_longest (exp->elts[pc + 1].type,
91 exp->elts[pc + 2].longconst),
92 stream, 0, Val_no_prettyprint);
97 value_print (value_from_double (exp->elts[pc + 1].type,
98 exp->elts[pc + 2].doubleconst),
99 stream, 0, Val_no_prettyprint);
106 b = exp->elts[pc + 1].block;
108 && BLOCK_FUNCTION (b) != NULL
109 && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)) != NULL)
111 fputs_filtered (SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)), stream);
112 fputs_filtered ("::", stream);
114 fputs_filtered (SYMBOL_SOURCE_NAME (exp->elts[pc + 2].symbol), stream);
120 fprintf_filtered (stream, "$%d",
121 longest_to_int (exp->elts[pc + 1].longconst));
126 fprintf_filtered (stream, "$%s",
127 REGISTER_NAME (longest_to_int (exp->elts[pc + 1].longconst)));
132 fprintf_filtered (stream, "%s",
133 longest_to_int (exp->elts[pc + 1].longconst)
139 fprintf_filtered (stream, "$%s",
140 internalvar_name (exp->elts[pc + 1].internalvar));
145 nargs = longest_to_int (exp->elts[pc + 1].longconst);
146 print_subexp (exp, pos, stream, PREC_SUFFIX);
147 fputs_filtered (" (", stream);
148 for (tem = 0; tem < nargs; tem++)
151 fputs_filtered (", ", stream);
152 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
154 fputs_filtered (")", stream);
159 nargs = longest_to_int (exp -> elts[pc + 1].longconst);
160 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
161 fputs_filtered (&exp->elts[pc + 2].string, stream);
165 nargs = longest_to_int (exp -> elts[pc + 1].longconst);
166 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
167 /* LA_PRINT_STRING will print using the current repeat count threshold.
168 If necessary, we can temporarily set it to zero, or pass it as an
169 additional parameter to LA_PRINT_STRING. -fnf */
170 LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
174 nargs = longest_to_int (exp -> elts[pc + 1].longconst);
176 += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
177 fprintf_unfiltered (stream, "B'<unimplemented>'");
182 nargs = longest_to_int (exp->elts[pc + 2].longconst);
183 nargs -= longest_to_int (exp->elts[pc + 1].longconst);
186 if (exp->elts[pc + 4].opcode == OP_LONG
187 && exp->elts[pc + 5].type == builtin_type_char
188 && exp->language_defn->la_language == language_c)
190 /* Attempt to print C character arrays using string syntax.
191 Walk through the args, picking up one character from each
192 of the OP_LONG expression elements. If any array element
193 does not match our expection of what we should find for
194 a simple string, revert back to array printing. Note that
195 the last expression element is an explicit null terminator
196 byte, which doesn't get printed. */
197 tempstr = alloca (nargs);
201 if (exp->elts[pc].opcode != OP_LONG
202 || exp->elts[pc + 1].type != builtin_type_char)
204 /* Not a simple array of char, use regular array printing. */
211 longest_to_int (exp->elts[pc + 2].longconst);
218 LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0);
223 int is_chill = exp->language_defn->la_language == language_chill;
224 fputs_filtered (is_chill ? " [" : " {", stream);
225 for (tem = 0; tem < nargs; tem++)
229 fputs_filtered (", ", stream);
231 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
233 fputs_filtered (is_chill ? "]" : "}", stream);
238 tem = longest_to_int (exp->elts[pc + 1].longconst);
239 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
241 if (exp->language_defn->la_language == language_chill)
243 fputs_filtered (".", stream);
244 fputs_filtered (&exp->elts[pc + 2].string, stream);
245 fputs_filtered (exp->elts[*pos].opcode == OP_LABELED ? ", "
251 /* Gcc support both these syntaxes. Unsure which is preferred. */
253 fputs_filtered (&exp->elts[pc + 2].string, stream);
254 fputs_filtered (": ", stream);
256 fputs_filtered (".", stream);
257 fputs_filtered (&exp->elts[pc + 2].string, stream);
258 fputs_filtered ("=", stream);
261 print_subexp (exp, pos, stream, PREC_SUFFIX);
265 if ((int) prec > (int) PREC_COMMA)
266 fputs_filtered ("(", stream);
267 /* Print the subexpressions, forcing parentheses
268 around any binary operations within them.
269 This is more parentheses than are strictly necessary,
270 but it looks clearer. */
271 print_subexp (exp, pos, stream, PREC_HYPER);
272 fputs_filtered (" ? ", stream);
273 print_subexp (exp, pos, stream, PREC_HYPER);
274 fputs_filtered (" : ", stream);
275 print_subexp (exp, pos, stream, PREC_HYPER);
276 if ((int) prec > (int) PREC_COMMA)
277 fputs_filtered (")", stream);
281 case TERNOP_SLICE_COUNT:
282 print_subexp (exp, pos, stream, PREC_SUFFIX);
283 fputs_filtered ("(", stream);
284 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
285 fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
286 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
287 fputs_filtered (")", stream);
290 case STRUCTOP_STRUCT:
291 tem = longest_to_int (exp->elts[pc + 1].longconst);
292 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
293 print_subexp (exp, pos, stream, PREC_SUFFIX);
294 fputs_filtered (".", stream);
295 fputs_filtered (&exp->elts[pc + 2].string, stream);
298 /* Will not occur for Modula-2 */
300 tem = longest_to_int (exp->elts[pc + 1].longconst);
301 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
302 print_subexp (exp, pos, stream, PREC_SUFFIX);
303 fputs_filtered ("->", stream);
304 fputs_filtered (&exp->elts[pc + 2].string, stream);
307 case BINOP_SUBSCRIPT:
308 print_subexp (exp, pos, stream, PREC_SUFFIX);
309 fputs_filtered ("[", stream);
310 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
311 fputs_filtered ("]", stream);
314 case UNOP_POSTINCREMENT:
315 print_subexp (exp, pos, stream, PREC_SUFFIX);
316 fputs_filtered ("++", stream);
319 case UNOP_POSTDECREMENT:
320 print_subexp (exp, pos, stream, PREC_SUFFIX);
321 fputs_filtered ("--", stream);
326 if ((int) prec > (int) PREC_PREFIX)
327 fputs_filtered ("(", stream);
328 fputs_filtered ("(", stream);
329 type_print (exp->elts[pc + 1].type, "", stream, 0);
330 fputs_filtered (") ", stream);
331 print_subexp (exp, pos, stream, PREC_PREFIX);
332 if ((int) prec > (int) PREC_PREFIX)
333 fputs_filtered (")", stream);
338 if ((int) prec > (int) PREC_PREFIX)
339 fputs_filtered ("(", stream);
340 if (exp->elts[pc + 1].type->code == TYPE_CODE_FUNC &&
341 exp->elts[pc + 3].opcode == OP_LONG) {
342 /* We have a minimal symbol fn, probably. It's encoded
343 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
344 Swallow the OP_LONG (including both its opcodes); ignore
345 its type; print the value in the type of the MEMVAL. */
347 val = value_at_lazy (exp->elts[pc + 1].type,
348 (CORE_ADDR) exp->elts[pc + 5].longconst,
350 value_print (val, stream, 0, Val_no_prettyprint);
352 fputs_filtered ("{", stream);
353 type_print (exp->elts[pc + 1].type, "", stream, 0);
354 fputs_filtered ("} ", stream);
355 print_subexp (exp, pos, stream, PREC_PREFIX);
357 if ((int) prec > (int) PREC_PREFIX)
358 fputs_filtered (")", stream);
361 case BINOP_ASSIGN_MODIFY:
362 opcode = exp->elts[pc + 1].opcode;
364 myprec = PREC_ASSIGN;
368 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
369 if (op_print_tab[tem].opcode == opcode)
371 op_str = op_print_tab[tem].string;
374 if (op_print_tab[tem].opcode != opcode)
375 /* Not found; don't try to keep going because we don't know how
376 to interpret further elements. */
377 error ("Invalid expression");
384 fputs_filtered ("this", stream);
389 case MULTI_SUBSCRIPT:
391 nargs = longest_to_int (exp->elts[pc + 1].longconst);
392 print_subexp (exp, pos, stream, PREC_SUFFIX);
393 fprintf_unfiltered (stream, " [");
394 for (tem = 0; tem < nargs; tem++)
397 fprintf_unfiltered (stream, ", ");
398 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
400 fprintf_unfiltered (stream, "]");
405 fprintf_unfiltered(stream,"VAL(");
406 type_print(exp->elts[pc+1].type,"",stream,0);
407 fprintf_unfiltered(stream,",");
408 print_subexp(exp,pos,stream,PREC_PREFIX);
409 fprintf_unfiltered(stream,")");
414 error("print_subexp: Not implemented.");
420 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
421 if (op_print_tab[tem].opcode == opcode)
423 op_str = op_print_tab[tem].string;
424 myprec = op_print_tab[tem].precedence;
425 assoc = op_print_tab[tem].right_assoc;
428 if (op_print_tab[tem].opcode != opcode)
429 /* Not found; don't try to keep going because we don't know how
430 to interpret further elements. For example, this happens
431 if opcode is OP_TYPE. */
432 error ("Invalid expression");
435 /* Note that PREC_BUILTIN will always emit parentheses. */
436 if ((int) myprec < (int) prec)
437 fputs_filtered ("(", stream);
438 if ((int) opcode > (int) BINOP_END)
442 /* Unary postfix operator. */
443 print_subexp (exp, pos, stream, PREC_SUFFIX);
444 fputs_filtered (op_str, stream);
448 /* Unary prefix operator. */
449 fputs_filtered (op_str, stream);
450 if (myprec == PREC_BUILTIN_FUNCTION)
451 fputs_filtered ("(", stream);
452 print_subexp (exp, pos, stream, PREC_PREFIX);
453 if (myprec == PREC_BUILTIN_FUNCTION)
454 fputs_filtered (")", stream);
459 /* Binary operator. */
460 /* Print left operand.
461 If operator is right-associative,
462 increment precedence for this operand. */
463 print_subexp (exp, pos, stream,
464 (enum precedence) ((int) myprec + assoc));
465 /* Print the operator itself. */
467 fprintf_filtered (stream, " %s= ", op_str);
468 else if (op_str[0] == ',')
469 fprintf_filtered (stream, "%s ", op_str);
471 fprintf_filtered (stream, " %s ", op_str);
472 /* Print right operand.
473 If operator is left-associative,
474 increment precedence for this operand. */
475 print_subexp (exp, pos, stream,
476 (enum precedence) ((int) myprec + !assoc));
479 if ((int) myprec < (int) prec)
480 fputs_filtered (")", stream);
483 /* Return the operator corresponding to opcode OP as
484 a string. NULL indicates that the opcode was not found in the
485 current language table. */
491 register const struct op_print *op_print_tab;
493 op_print_tab = current_language->la_op_print_tab;
494 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
495 if (op_print_tab[tem].opcode == op)
496 return op_print_tab[tem].string;
500 #ifdef MAINTENANCE_CMDS
502 /* Support for dumping the raw data from expressions in a human readable
505 static char * op_name PARAMS ((int opcode));
517 sprintf (buf, "<unknown %d>", opcode);
520 case OP_NULL: return "OP_NULL";
521 case BINOP_ADD: return "BINOP_ADD";
522 case BINOP_SUB: return "BINOP_SUB";
523 case BINOP_MUL: return "BINOP_MUL";
524 case BINOP_DIV: return "BINOP_DIV";
525 case BINOP_REM: return "BINOP_REM";
526 case BINOP_MOD: return "BINOP_MOD";
527 case BINOP_LSH: return "BINOP_LSH";
528 case BINOP_RSH: return "BINOP_RSH";
529 case BINOP_LOGICAL_AND: return "BINOP_LOGICAL_AND";
530 case BINOP_LOGICAL_OR: return "BINOP_LOGICAL_OR";
531 case BINOP_BITWISE_AND: return "BINOP_BITWISE_AND";
532 case BINOP_BITWISE_IOR: return "BINOP_BITWISE_IOR";
533 case BINOP_BITWISE_XOR: return "BINOP_BITWISE_XOR";
534 case BINOP_EQUAL: return "BINOP_EQUAL";
535 case BINOP_NOTEQUAL: return "BINOP_NOTEQUAL";
536 case BINOP_LESS: return "BINOP_LESS";
537 case BINOP_GTR: return "BINOP_GTR";
538 case BINOP_LEQ: return "BINOP_LEQ";
539 case BINOP_GEQ: return "BINOP_GEQ";
540 case BINOP_REPEAT: return "BINOP_REPEAT";
541 case BINOP_ASSIGN: return "BINOP_ASSIGN";
542 case BINOP_COMMA: return "BINOP_COMMA";
543 case BINOP_SUBSCRIPT: return "BINOP_SUBSCRIPT";
544 case MULTI_SUBSCRIPT: return "MULTI_SUBSCRIPT";
545 case BINOP_EXP: return "BINOP_EXP";
546 case BINOP_MIN: return "BINOP_MIN";
547 case BINOP_MAX: return "BINOP_MAX";
548 case BINOP_SCOPE: return "BINOP_SCOPE";
549 case STRUCTOP_MEMBER: return "STRUCTOP_MEMBER";
550 case STRUCTOP_MPTR: return "STRUCTOP_MPTR";
551 case BINOP_INTDIV: return "BINOP_INTDIV";
552 case BINOP_ASSIGN_MODIFY: return "BINOP_ASSIGN_MODIFY";
553 case BINOP_VAL: return "BINOP_VAL";
554 case BINOP_INCL: return "BINOP_INCL";
555 case BINOP_EXCL: return "BINOP_EXCL";
556 case BINOP_CONCAT: return "BINOP_CONCAT";
557 case BINOP_RANGE: return "BINOP_RANGE";
558 case BINOP_END: return "BINOP_END";
559 case TERNOP_COND: return "TERNOP_COND";
560 case TERNOP_SLICE: return "TERNOP_SLICE";
561 case TERNOP_SLICE_COUNT: return "TERNOP_SLICE_COUNT";
562 case OP_LONG: return "OP_LONG";
563 case OP_DOUBLE: return "OP_DOUBLE";
564 case OP_VAR_VALUE: return "OP_VAR_VALUE";
565 case OP_LAST: return "OP_LAST";
566 case OP_REGISTER: return "OP_REGISTER";
567 case OP_INTERNALVAR: return "OP_INTERNALVAR";
568 case OP_FUNCALL: return "OP_FUNCALL";
569 case OP_STRING: return "OP_STRING";
570 case OP_BITSTRING: return "OP_BITSTRING";
571 case OP_ARRAY: return "OP_ARRAY";
572 case UNOP_CAST: return "UNOP_CAST";
573 case UNOP_MEMVAL: return "UNOP_MEMVAL";
574 case UNOP_NEG: return "UNOP_NEG";
575 case UNOP_LOGICAL_NOT: return "UNOP_LOGICAL_NOT";
576 case UNOP_COMPLEMENT: return "UNOP_COMPLEMENT";
577 case UNOP_IND: return "UNOP_IND";
578 case UNOP_ADDR: return "UNOP_ADDR";
579 case UNOP_PREINCREMENT: return "UNOP_PREINCREMENT";
580 case UNOP_POSTINCREMENT: return "UNOP_POSTINCREMENT";
581 case UNOP_PREDECREMENT: return "UNOP_PREDECREMENT";
582 case UNOP_POSTDECREMENT: return "UNOP_POSTDECREMENT";
583 case UNOP_SIZEOF: return "UNOP_SIZEOF";
584 case UNOP_LOWER: return "UNOP_LOWER";
585 case UNOP_UPPER: return "UNOP_UPPER";
586 case UNOP_LENGTH: return "UNOP_LENGTH";
587 case UNOP_PLUS: return "UNOP_PLUS";
588 case UNOP_CAP: return "UNOP_CAP";
589 case UNOP_CHR: return "UNOP_CHR";
590 case UNOP_ORD: return "UNOP_ORD";
591 case UNOP_ABS: return "UNOP_ABS";
592 case UNOP_FLOAT: return "UNOP_FLOAT";
593 case UNOP_HIGH: return "UNOP_HIGH";
594 case UNOP_MAX: return "UNOP_MAX";
595 case UNOP_MIN: return "UNOP_MIN";
596 case UNOP_ODD: return "UNOP_ODD";
597 case UNOP_TRUNC: return "UNOP_TRUNC";
598 case OP_BOOL: return "OP_BOOL";
599 case OP_M2_STRING: return "OP_M2_STRING";
600 case STRUCTOP_STRUCT: return "STRUCTOP_STRUCT";
601 case STRUCTOP_PTR: return "STRUCTOP_PTR";
602 case OP_THIS: return "OP_THIS";
603 case OP_SCOPE: return "OP_SCOPE";
604 case OP_TYPE: return "OP_TYPE";
605 case OP_LABELED: return "OP_LABELED";
610 dump_prefix_expression (exp, stream, note)
611 struct expression *exp;
620 fprintf_filtered (stream, "Dump of expression @ ");
621 gdb_print_address (exp, stream);
622 fprintf_filtered (stream, ", %s:\nExpression: `", note);
623 if (exp->elts[0].opcode != OP_TYPE)
624 print_expression (exp, stream);
626 fprintf_filtered (stream, "Type printing not yet supported....");
627 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %d bytes each.\n",
628 exp->language_defn->la_name, exp -> nelts,
629 sizeof (union exp_element));
630 fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode",
631 "Hex Value", "String Value");
632 for (elt = 0; elt < exp -> nelts; elt++)
634 fprintf_filtered (stream, "\t%5d ", elt);
635 opcode_name = op_name (exp -> elts[elt].opcode);
637 fprintf_filtered (stream, "%20s ", opcode_name);
638 print_longest (stream, 'd', 0, exp -> elts[elt].longconst);
639 fprintf_filtered (stream, " ");
641 for (eltscan = (char *) &exp->elts[elt],
642 eltsize = sizeof (union exp_element) ;
646 fprintf_filtered (stream, "%c",
647 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
649 fprintf_filtered (stream, "\n");
653 static int dump_subexp PARAMS ((struct expression *exp, GDB_FILE *stream, int elt));
656 dump_subexp (exp, stream, elt)
657 struct expression *exp;
661 static int indent = 0;
664 fprintf_filtered (stream, "\n");
665 fprintf_filtered (stream, "\t%5d ", elt);
667 for (i = 1; i <= indent; i++)
668 fprintf_filtered (stream, " ");
671 fprintf_filtered (stream, "%-20s ", op_name (exp->elts[elt].opcode));
673 switch (exp -> elts[elt++].opcode)
677 case TERNOP_SLICE_COUNT:
678 elt = dump_subexp (exp, stream, elt);
687 case BINOP_LOGICAL_AND:
688 case BINOP_LOGICAL_OR:
689 case BINOP_BITWISE_AND:
690 case BINOP_BITWISE_IOR:
691 case BINOP_BITWISE_XOR:
701 case BINOP_SUBSCRIPT:
707 case BINOP_ASSIGN_MODIFY:
715 elt = dump_subexp (exp, stream, elt);
717 case UNOP_LOGICAL_NOT:
718 case UNOP_COMPLEMENT:
721 case UNOP_PREINCREMENT:
722 case UNOP_POSTINCREMENT:
723 case UNOP_PREDECREMENT:
724 case UNOP_POSTDECREMENT:
743 elt = dump_subexp (exp, stream, elt);
746 fprintf_filtered (stream, "Type @0x%x (", exp->elts[elt].type);
747 type_print (exp->elts[elt].type, NULL, stream, 0);
748 fprintf_filtered (stream, "), value %ld (0x%lx)",
749 (long)exp->elts[elt+1].longconst,
750 (long)exp->elts[elt+1].longconst);
754 fprintf_filtered (stream, "Type @0x%x (", exp->elts[elt].type);
755 type_print (exp->elts[elt].type, NULL, stream, 0);
756 fprintf_filtered (stream, "), value %g",
757 (double)exp->elts[elt+1].doubleconst);
761 fprintf_filtered (stream, "Block @0x%x, symbol @0x%x (%s)",
762 exp->elts[elt].block,
763 exp->elts[elt+1].symbol,
764 SYMBOL_NAME (exp->elts[elt+1].symbol));
768 fprintf_filtered (stream, "History element %ld",
769 (long)exp->elts[elt].longconst);
773 fprintf_filtered (stream, "Register %ld",
774 (long)exp->elts[elt].longconst);
778 fprintf_filtered (stream, "Internal var @0x%x (%s)",
779 exp->elts[elt].internalvar,
780 exp->elts[elt].internalvar->name);
787 nargs = longest_to_int (exp->elts[elt].longconst);
789 fprintf_filtered (stream, "Number of args: %d", nargs);
792 for (i = 1; i <= nargs + 1; i++)
793 elt = dump_subexp (exp, stream, elt);
801 lower = longest_to_int (exp->elts[elt].longconst);
802 upper = longest_to_int (exp->elts[elt + 1].longconst);
804 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
807 for (i = 1; i <= upper - lower + 1; i++)
808 elt = dump_subexp (exp, stream, elt);
813 fprintf_filtered (stream, "Type @0x%x (",
814 exp->elts[elt].type);
815 type_print (exp->elts[elt].type, NULL, stream, 0);
816 fprintf_filtered (stream, ")");
817 elt = dump_subexp (exp, stream, elt + 2);
820 fprintf_filtered (stream, "Type @0x%x (",
821 exp->elts[elt].type);
822 type_print (exp->elts[elt].type, NULL, stream, 0);
823 fprintf_filtered (stream, ")");
826 case STRUCTOP_STRUCT:
832 len = longest_to_int (exp->elts[elt].longconst);
833 elem_name = &exp->elts[elt + 1].string;
835 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
836 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
844 fprintf_filtered (stream, "Type @0x%x (", exp->elts[elt].type);
845 type_print (exp->elts[elt].type, NULL, stream, 0);
846 fprintf_filtered (stream, ") ");
848 len = longest_to_int (exp->elts[elt + 1].longconst);
849 elem_name = &exp->elts[elt + 2].string;
851 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
852 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
857 case STRUCTOP_MEMBER:
859 case MULTI_SUBSCRIPT:
860 case OP_F77_UNDETERMINED_ARGLIST:
870 fprintf_filtered (stream, "Unknown format");
879 dump_postfix_expression (exp, stream, note)
880 struct expression *exp;
886 fprintf_filtered (stream, "Dump of expression @ ");
887 gdb_print_address (exp, stream);
888 fprintf_filtered (stream, ", %s:\nExpression: `", note);
889 if (exp->elts[0].opcode != OP_TYPE)
890 print_expression (exp, stream);
892 fputs_filtered ("Type printing not yet supported....", stream);
893 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %d bytes each.\n",
894 exp->language_defn->la_name, exp -> nelts,
895 sizeof (union exp_element));
896 fputs_filtered ("\n", stream);
898 for (elt = 0; elt < exp -> nelts;)
899 elt = dump_subexp (exp, stream, elt);
900 fputs_filtered ("\n", stream);
903 #endif /* MAINTENANCE_CMDS */