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 /* Support for dumping the raw data from expressions in a human readable
503 static char * op_name PARAMS ((int opcode));
515 sprintf (buf, "<unknown %d>", opcode);
518 case OP_NULL: return "OP_NULL";
519 case BINOP_ADD: return "BINOP_ADD";
520 case BINOP_SUB: return "BINOP_SUB";
521 case BINOP_MUL: return "BINOP_MUL";
522 case BINOP_DIV: return "BINOP_DIV";
523 case BINOP_REM: return "BINOP_REM";
524 case BINOP_MOD: return "BINOP_MOD";
525 case BINOP_LSH: return "BINOP_LSH";
526 case BINOP_RSH: return "BINOP_RSH";
527 case BINOP_LOGICAL_AND: return "BINOP_LOGICAL_AND";
528 case BINOP_LOGICAL_OR: return "BINOP_LOGICAL_OR";
529 case BINOP_BITWISE_AND: return "BINOP_BITWISE_AND";
530 case BINOP_BITWISE_IOR: return "BINOP_BITWISE_IOR";
531 case BINOP_BITWISE_XOR: return "BINOP_BITWISE_XOR";
532 case BINOP_EQUAL: return "BINOP_EQUAL";
533 case BINOP_NOTEQUAL: return "BINOP_NOTEQUAL";
534 case BINOP_LESS: return "BINOP_LESS";
535 case BINOP_GTR: return "BINOP_GTR";
536 case BINOP_LEQ: return "BINOP_LEQ";
537 case BINOP_GEQ: return "BINOP_GEQ";
538 case BINOP_REPEAT: return "BINOP_REPEAT";
539 case BINOP_ASSIGN: return "BINOP_ASSIGN";
540 case BINOP_COMMA: return "BINOP_COMMA";
541 case BINOP_SUBSCRIPT: return "BINOP_SUBSCRIPT";
542 case MULTI_SUBSCRIPT: return "MULTI_SUBSCRIPT";
543 case BINOP_EXP: return "BINOP_EXP";
544 case BINOP_MIN: return "BINOP_MIN";
545 case BINOP_MAX: return "BINOP_MAX";
546 case BINOP_SCOPE: return "BINOP_SCOPE";
547 case STRUCTOP_MEMBER: return "STRUCTOP_MEMBER";
548 case STRUCTOP_MPTR: return "STRUCTOP_MPTR";
549 case BINOP_INTDIV: return "BINOP_INTDIV";
550 case BINOP_ASSIGN_MODIFY: return "BINOP_ASSIGN_MODIFY";
551 case BINOP_VAL: return "BINOP_VAL";
552 case BINOP_INCL: return "BINOP_INCL";
553 case BINOP_EXCL: return "BINOP_EXCL";
554 case BINOP_CONCAT: return "BINOP_CONCAT";
555 case BINOP_RANGE: return "BINOP_RANGE";
556 case BINOP_END: return "BINOP_END";
557 case TERNOP_COND: return "TERNOP_COND";
558 case TERNOP_SLICE: return "TERNOP_SLICE";
559 case TERNOP_SLICE_COUNT: return "TERNOP_SLICE_COUNT";
560 case OP_LONG: return "OP_LONG";
561 case OP_DOUBLE: return "OP_DOUBLE";
562 case OP_VAR_VALUE: return "OP_VAR_VALUE";
563 case OP_LAST: return "OP_LAST";
564 case OP_REGISTER: return "OP_REGISTER";
565 case OP_INTERNALVAR: return "OP_INTERNALVAR";
566 case OP_FUNCALL: return "OP_FUNCALL";
567 case OP_STRING: return "OP_STRING";
568 case OP_BITSTRING: return "OP_BITSTRING";
569 case OP_ARRAY: return "OP_ARRAY";
570 case UNOP_CAST: return "UNOP_CAST";
571 case UNOP_MEMVAL: return "UNOP_MEMVAL";
572 case UNOP_NEG: return "UNOP_NEG";
573 case UNOP_LOGICAL_NOT: return "UNOP_LOGICAL_NOT";
574 case UNOP_COMPLEMENT: return "UNOP_COMPLEMENT";
575 case UNOP_IND: return "UNOP_IND";
576 case UNOP_ADDR: return "UNOP_ADDR";
577 case UNOP_PREINCREMENT: return "UNOP_PREINCREMENT";
578 case UNOP_POSTINCREMENT: return "UNOP_POSTINCREMENT";
579 case UNOP_PREDECREMENT: return "UNOP_PREDECREMENT";
580 case UNOP_POSTDECREMENT: return "UNOP_POSTDECREMENT";
581 case UNOP_SIZEOF: return "UNOP_SIZEOF";
582 case UNOP_LOWER: return "UNOP_LOWER";
583 case UNOP_UPPER: return "UNOP_UPPER";
584 case UNOP_LENGTH: return "UNOP_LENGTH";
585 case UNOP_PLUS: return "UNOP_PLUS";
586 case UNOP_CAP: return "UNOP_CAP";
587 case UNOP_CHR: return "UNOP_CHR";
588 case UNOP_ORD: return "UNOP_ORD";
589 case UNOP_ABS: return "UNOP_ABS";
590 case UNOP_FLOAT: return "UNOP_FLOAT";
591 case UNOP_HIGH: return "UNOP_HIGH";
592 case UNOP_MAX: return "UNOP_MAX";
593 case UNOP_MIN: return "UNOP_MIN";
594 case UNOP_ODD: return "UNOP_ODD";
595 case UNOP_TRUNC: return "UNOP_TRUNC";
596 case OP_BOOL: return "OP_BOOL";
597 case OP_M2_STRING: return "OP_M2_STRING";
598 case STRUCTOP_STRUCT: return "STRUCTOP_STRUCT";
599 case STRUCTOP_PTR: return "STRUCTOP_PTR";
600 case OP_THIS: return "OP_THIS";
601 case OP_SCOPE: return "OP_SCOPE";
602 case OP_TYPE: return "OP_TYPE";
603 case OP_LABELED: return "OP_LABELED";
608 dump_prefix_expression (exp, stream, note)
609 struct expression *exp;
618 fprintf_filtered (stream, "Dump of expression @ ");
619 gdb_print_address (exp, stream);
620 fprintf_filtered (stream, ", %s:\nExpression: `", note);
621 if (exp->elts[0].opcode != OP_TYPE)
622 print_expression (exp, stream);
624 fprintf_filtered (stream, "Type printing not yet supported....");
625 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %d bytes each.\n",
626 exp->language_defn->la_name, exp -> nelts,
627 sizeof (union exp_element));
628 fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode",
629 "Hex Value", "String Value");
630 for (elt = 0; elt < exp -> nelts; elt++)
632 fprintf_filtered (stream, "\t%5d ", elt);
633 opcode_name = op_name (exp -> elts[elt].opcode);
635 fprintf_filtered (stream, "%20s ", opcode_name);
636 print_longest (stream, 'd', 0, exp -> elts[elt].longconst);
637 fprintf_filtered (stream, " ");
639 for (eltscan = (char *) &exp->elts[elt],
640 eltsize = sizeof (union exp_element) ;
644 fprintf_filtered (stream, "%c",
645 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
647 fprintf_filtered (stream, "\n");
651 static int dump_subexp PARAMS ((struct expression *exp, GDB_FILE *stream, int elt));
654 dump_subexp (exp, stream, elt)
655 struct expression *exp;
659 static int indent = 0;
662 fprintf_filtered (stream, "\n");
663 fprintf_filtered (stream, "\t%5d ", elt);
665 for (i = 1; i <= indent; i++)
666 fprintf_filtered (stream, " ");
669 fprintf_filtered (stream, "%-20s ", op_name (exp->elts[elt].opcode));
671 switch (exp -> elts[elt++].opcode)
675 case TERNOP_SLICE_COUNT:
676 elt = dump_subexp (exp, stream, elt);
685 case BINOP_LOGICAL_AND:
686 case BINOP_LOGICAL_OR:
687 case BINOP_BITWISE_AND:
688 case BINOP_BITWISE_IOR:
689 case BINOP_BITWISE_XOR:
699 case BINOP_SUBSCRIPT:
705 case BINOP_ASSIGN_MODIFY:
713 elt = dump_subexp (exp, stream, elt);
715 case UNOP_LOGICAL_NOT:
716 case UNOP_COMPLEMENT:
719 case UNOP_PREINCREMENT:
720 case UNOP_POSTINCREMENT:
721 case UNOP_PREDECREMENT:
722 case UNOP_POSTDECREMENT:
741 elt = dump_subexp (exp, stream, elt);
744 fprintf_filtered (stream, "Type @0x%x (", exp->elts[elt].type);
745 type_print (exp->elts[elt].type, NULL, stream, 0);
746 fprintf_filtered (stream, "), value %ld (0x%lx)",
747 (long)exp->elts[elt+1].longconst,
748 (long)exp->elts[elt+1].longconst);
752 fprintf_filtered (stream, "Type @0x%x (", exp->elts[elt].type);
753 type_print (exp->elts[elt].type, NULL, stream, 0);
754 fprintf_filtered (stream, "), value %g",
755 (double)exp->elts[elt+1].doubleconst);
759 fprintf_filtered (stream, "Block @0x%x, symbol @0x%x (%s)",
760 exp->elts[elt].block,
761 exp->elts[elt+1].symbol,
762 SYMBOL_NAME (exp->elts[elt+1].symbol));
766 fprintf_filtered (stream, "History element %ld",
767 (long)exp->elts[elt].longconst);
771 fprintf_filtered (stream, "Register %ld",
772 (long)exp->elts[elt].longconst);
776 fprintf_filtered (stream, "Internal var @0x%x (%s)",
777 exp->elts[elt].internalvar,
778 exp->elts[elt].internalvar->name);
785 nargs = longest_to_int (exp->elts[elt].longconst);
787 fprintf_filtered (stream, "Number of args: %d", nargs);
790 for (i = 1; i <= nargs + 1; i++)
791 elt = dump_subexp (exp, stream, elt);
799 lower = longest_to_int (exp->elts[elt].longconst);
800 upper = longest_to_int (exp->elts[elt + 1].longconst);
802 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
805 for (i = 1; i <= upper - lower + 1; i++)
806 elt = dump_subexp (exp, stream, elt);
811 fprintf_filtered (stream, "Type @0x%x (",
812 exp->elts[elt].type);
813 type_print (exp->elts[elt].type, NULL, stream, 0);
814 fprintf_filtered (stream, ")");
815 elt = dump_subexp (exp, stream, elt + 2);
818 fprintf_filtered (stream, "Type @0x%x (",
819 exp->elts[elt].type);
820 type_print (exp->elts[elt].type, NULL, stream, 0);
821 fprintf_filtered (stream, ")");
824 case STRUCTOP_STRUCT:
830 len = longest_to_int (exp->elts[elt].longconst);
831 elem_name = &exp->elts[elt + 1].string;
833 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
834 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
842 fprintf_filtered (stream, "Type @0x%x (", exp->elts[elt].type);
843 type_print (exp->elts[elt].type, NULL, stream, 0);
844 fprintf_filtered (stream, ") ");
846 len = longest_to_int (exp->elts[elt + 1].longconst);
847 elem_name = &exp->elts[elt + 2].string;
849 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
850 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
855 case STRUCTOP_MEMBER:
857 case MULTI_SUBSCRIPT:
858 case OP_F77_UNDETERMINED_ARGLIST:
868 fprintf_filtered (stream, "Unknown format");
877 dump_postfix_expression (exp, stream, note)
878 struct expression *exp;
884 fprintf_filtered (stream, "Dump of expression @ ");
885 gdb_print_address (exp, stream);
886 fprintf_filtered (stream, ", %s:\nExpression: `", note);
887 if (exp->elts[0].opcode != OP_TYPE)
888 print_expression (exp, stream);
890 fputs_filtered ("Type printing not yet supported....", stream);
891 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %d bytes each.\n",
892 exp->language_defn->la_name, exp -> nelts,
893 sizeof (union exp_element));
894 fputs_filtered ("\n", stream);
896 for (elt = 0; elt < exp -> nelts;)
897 elt = dump_subexp (exp, stream, elt);
898 fputs_filtered ("\n", stream);