1 /* Print in infix form a struct expression.
3 Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
4 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
26 #include "expression.h"
29 #include "parser-defs.h"
30 #include "user-regs.h" /* For user_reg_map_regnum_to_name. */
32 #include "gdb_string.h"
40 print_expression (struct expression *exp, struct ui_file *stream)
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 (struct expression *exp, int *pos,
53 struct ui_file *stream, enum precedence prec)
55 exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
58 /* Standard implementation of print_subexp for use in language_defn
61 print_subexp_standard (struct expression *exp, int *pos,
62 struct ui_file *stream, enum precedence prec)
65 const struct op_print *op_print_tab;
69 int assign_modify = 0;
70 enum exp_opcode opcode;
71 enum precedence myprec = PREC_NULL;
72 /* Set to 1 for a right-associative operator. */
77 op_print_tab = exp->language_defn->la_op_print_tab;
79 opcode = exp->elts[pc].opcode;
87 fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
88 fputs_filtered ("::", stream);
89 nargs = longest_to_int (exp->elts[pc + 2].longconst);
90 (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
91 fputs_filtered (&exp->elts[pc + 3].string, stream);
96 value_print (value_from_longest (exp->elts[pc + 1].type,
97 exp->elts[pc + 2].longconst),
98 stream, 0, Val_no_prettyprint);
103 value_print (value_from_double (exp->elts[pc + 1].type,
104 exp->elts[pc + 2].doubleconst),
105 stream, 0, Val_no_prettyprint);
112 b = exp->elts[pc + 1].block;
114 && BLOCK_FUNCTION (b) != NULL
115 && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
117 fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
118 fputs_filtered ("::", stream);
120 fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
126 fprintf_filtered (stream, "$%d",
127 longest_to_int (exp->elts[pc + 1].longconst));
132 int regnum = longest_to_int (exp->elts[pc + 1].longconst);
133 const char *name = user_reg_map_regnum_to_name (current_gdbarch,
136 fprintf_filtered (stream, "$%s", name);
142 fprintf_filtered (stream, "%s",
143 longest_to_int (exp->elts[pc + 1].longconst)
149 fprintf_filtered (stream, "$%s",
150 internalvar_name (exp->elts[pc + 1].internalvar));
155 nargs = longest_to_int (exp->elts[pc + 1].longconst);
156 print_subexp (exp, pos, stream, PREC_SUFFIX);
157 fputs_filtered (" (", stream);
158 for (tem = 0; tem < nargs; tem++)
161 fputs_filtered (", ", stream);
162 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
164 fputs_filtered (")", stream);
169 nargs = longest_to_int (exp->elts[pc + 1].longconst);
170 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
171 fputs_filtered (&exp->elts[pc + 2].string, stream);
175 nargs = longest_to_int (exp->elts[pc + 1].longconst);
176 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
177 /* LA_PRINT_STRING will print using the current repeat count threshold.
178 If necessary, we can temporarily set it to zero, or pass it as an
179 additional parameter to LA_PRINT_STRING. -fnf */
180 LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
184 nargs = longest_to_int (exp->elts[pc + 1].longconst);
186 += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
187 fprintf_unfiltered (stream, "B'<unimplemented>'");
190 case OP_OBJC_NSSTRING: /* Objective-C Foundation Class NSString constant. */
191 nargs = longest_to_int (exp->elts[pc + 1].longconst);
192 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
193 fputs_filtered ("@\"", stream);
194 LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
195 fputs_filtered ("\"", stream);
198 case OP_OBJC_MSGCALL:
199 { /* Objective C message (method) call. */
202 nargs = longest_to_int (exp->elts[pc + 2].longconst);
203 fprintf_unfiltered (stream, "[");
204 print_subexp (exp, pos, stream, PREC_SUFFIX);
205 if (0 == target_read_string (exp->elts[pc + 1].longconst,
206 &selector, 1024, NULL))
208 error (_("bad selector"));
214 s = alloca (strlen (selector) + 1);
215 strcpy (s, selector);
216 for (tem = 0; tem < nargs; tem++)
218 nextS = strchr (s, ':');
220 fprintf_unfiltered (stream, " %s: ", s);
222 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
227 fprintf_unfiltered (stream, " %s", selector);
229 fprintf_unfiltered (stream, "]");
230 /* "selector" was malloc'd by target_read_string. Free it. */
237 nargs = longest_to_int (exp->elts[pc + 2].longconst);
238 nargs -= longest_to_int (exp->elts[pc + 1].longconst);
241 if (exp->elts[pc + 4].opcode == OP_LONG
242 && exp->elts[pc + 5].type == builtin_type_char
243 && exp->language_defn->la_language == language_c)
245 /* Attempt to print C character arrays using string syntax.
246 Walk through the args, picking up one character from each
247 of the OP_LONG expression elements. If any array element
248 does not match our expection of what we should find for
249 a simple string, revert back to array printing. Note that
250 the last expression element is an explicit null terminator
251 byte, which doesn't get printed. */
252 tempstr = alloca (nargs);
256 if (exp->elts[pc].opcode != OP_LONG
257 || exp->elts[pc + 1].type != builtin_type_char)
259 /* Not a simple array of char, use regular array printing. */
266 longest_to_int (exp->elts[pc + 2].longconst);
273 LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0);
278 fputs_filtered (" {", stream);
279 for (tem = 0; tem < nargs; tem++)
283 fputs_filtered (", ", stream);
285 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
287 fputs_filtered ("}", stream);
292 tem = longest_to_int (exp->elts[pc + 1].longconst);
293 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
294 /* Gcc support both these syntaxes. Unsure which is preferred. */
296 fputs_filtered (&exp->elts[pc + 2].string, stream);
297 fputs_filtered (": ", stream);
299 fputs_filtered (".", stream);
300 fputs_filtered (&exp->elts[pc + 2].string, stream);
301 fputs_filtered ("=", stream);
303 print_subexp (exp, pos, stream, PREC_SUFFIX);
307 if ((int) prec > (int) PREC_COMMA)
308 fputs_filtered ("(", stream);
309 /* Print the subexpressions, forcing parentheses
310 around any binary operations within them.
311 This is more parentheses than are strictly necessary,
312 but it looks clearer. */
313 print_subexp (exp, pos, stream, PREC_HYPER);
314 fputs_filtered (" ? ", stream);
315 print_subexp (exp, pos, stream, PREC_HYPER);
316 fputs_filtered (" : ", stream);
317 print_subexp (exp, pos, stream, PREC_HYPER);
318 if ((int) prec > (int) PREC_COMMA)
319 fputs_filtered (")", stream);
323 case TERNOP_SLICE_COUNT:
324 print_subexp (exp, pos, stream, PREC_SUFFIX);
325 fputs_filtered ("(", stream);
326 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
327 fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
328 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
329 fputs_filtered (")", stream);
332 case STRUCTOP_STRUCT:
333 tem = longest_to_int (exp->elts[pc + 1].longconst);
334 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
335 print_subexp (exp, pos, stream, PREC_SUFFIX);
336 fputs_filtered (".", stream);
337 fputs_filtered (&exp->elts[pc + 2].string, stream);
340 /* Will not occur for Modula-2 */
342 tem = longest_to_int (exp->elts[pc + 1].longconst);
343 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
344 print_subexp (exp, pos, stream, PREC_SUFFIX);
345 fputs_filtered ("->", stream);
346 fputs_filtered (&exp->elts[pc + 2].string, stream);
349 case STRUCTOP_MEMBER:
350 print_subexp (exp, pos, stream, PREC_SUFFIX);
351 fputs_filtered (".*", stream);
352 print_subexp (exp, pos, stream, PREC_SUFFIX);
356 print_subexp (exp, pos, stream, PREC_SUFFIX);
357 fputs_filtered ("->*", stream);
358 print_subexp (exp, pos, stream, PREC_SUFFIX);
361 case BINOP_SUBSCRIPT:
362 print_subexp (exp, pos, stream, PREC_SUFFIX);
363 fputs_filtered ("[", stream);
364 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
365 fputs_filtered ("]", stream);
368 case UNOP_POSTINCREMENT:
369 print_subexp (exp, pos, stream, PREC_SUFFIX);
370 fputs_filtered ("++", stream);
373 case UNOP_POSTDECREMENT:
374 print_subexp (exp, pos, stream, PREC_SUFFIX);
375 fputs_filtered ("--", stream);
380 if ((int) prec > (int) PREC_PREFIX)
381 fputs_filtered ("(", stream);
382 fputs_filtered ("(", stream);
383 type_print (exp->elts[pc + 1].type, "", stream, 0);
384 fputs_filtered (") ", stream);
385 print_subexp (exp, pos, stream, PREC_PREFIX);
386 if ((int) prec > (int) PREC_PREFIX)
387 fputs_filtered (")", stream);
392 if ((int) prec > (int) PREC_PREFIX)
393 fputs_filtered ("(", stream);
394 if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC &&
395 exp->elts[pc + 3].opcode == OP_LONG)
397 /* We have a minimal symbol fn, probably. It's encoded
398 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
399 Swallow the OP_LONG (including both its opcodes); ignore
400 its type; print the value in the type of the MEMVAL. */
402 val = value_at_lazy (exp->elts[pc + 1].type,
403 (CORE_ADDR) exp->elts[pc + 5].longconst);
404 value_print (val, stream, 0, Val_no_prettyprint);
408 fputs_filtered ("{", stream);
409 type_print (exp->elts[pc + 1].type, "", stream, 0);
410 fputs_filtered ("} ", stream);
411 print_subexp (exp, pos, stream, PREC_PREFIX);
413 if ((int) prec > (int) PREC_PREFIX)
414 fputs_filtered (")", stream);
417 case BINOP_ASSIGN_MODIFY:
418 opcode = exp->elts[pc + 1].opcode;
420 myprec = PREC_ASSIGN;
424 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
425 if (op_print_tab[tem].opcode == opcode)
427 op_str = op_print_tab[tem].string;
430 if (op_print_tab[tem].opcode != opcode)
431 /* Not found; don't try to keep going because we don't know how
432 to interpret further elements. */
433 error (_("Invalid expression"));
440 fputs_filtered ("this", stream);
443 /* Objective-C ops */
447 fputs_filtered ("self", stream); /* The ObjC equivalent of "this". */
452 case MULTI_SUBSCRIPT:
454 nargs = longest_to_int (exp->elts[pc + 1].longconst);
455 print_subexp (exp, pos, stream, PREC_SUFFIX);
456 fprintf_unfiltered (stream, " [");
457 for (tem = 0; tem < nargs; tem++)
460 fprintf_unfiltered (stream, ", ");
461 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
463 fprintf_unfiltered (stream, "]");
468 fprintf_unfiltered (stream, "VAL(");
469 type_print (exp->elts[pc + 1].type, "", stream, 0);
470 fprintf_unfiltered (stream, ",");
471 print_subexp (exp, pos, stream, PREC_PREFIX);
472 fprintf_unfiltered (stream, ")");
477 error (_("print_subexp: Not implemented."));
483 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
484 if (op_print_tab[tem].opcode == opcode)
486 op_str = op_print_tab[tem].string;
487 myprec = op_print_tab[tem].precedence;
488 assoc = op_print_tab[tem].right_assoc;
491 if (op_print_tab[tem].opcode != opcode)
492 /* Not found; don't try to keep going because we don't know how
493 to interpret further elements. For example, this happens
494 if opcode is OP_TYPE. */
495 error (_("Invalid expression"));
498 /* Note that PREC_BUILTIN will always emit parentheses. */
499 if ((int) myprec < (int) prec)
500 fputs_filtered ("(", stream);
501 if ((int) opcode > (int) BINOP_END)
505 /* Unary postfix operator. */
506 print_subexp (exp, pos, stream, PREC_SUFFIX);
507 fputs_filtered (op_str, stream);
511 /* Unary prefix operator. */
512 fputs_filtered (op_str, stream);
513 if (myprec == PREC_BUILTIN_FUNCTION)
514 fputs_filtered ("(", stream);
515 print_subexp (exp, pos, stream, PREC_PREFIX);
516 if (myprec == PREC_BUILTIN_FUNCTION)
517 fputs_filtered (")", stream);
522 /* Binary operator. */
523 /* Print left operand.
524 If operator is right-associative,
525 increment precedence for this operand. */
526 print_subexp (exp, pos, stream,
527 (enum precedence) ((int) myprec + assoc));
528 /* Print the operator itself. */
530 fprintf_filtered (stream, " %s= ", op_str);
531 else if (op_str[0] == ',')
532 fprintf_filtered (stream, "%s ", op_str);
534 fprintf_filtered (stream, " %s ", op_str);
535 /* Print right operand.
536 If operator is left-associative,
537 increment precedence for this operand. */
538 print_subexp (exp, pos, stream,
539 (enum precedence) ((int) myprec + !assoc));
542 if ((int) myprec < (int) prec)
543 fputs_filtered (")", stream);
546 /* Return the operator corresponding to opcode OP as
547 a string. NULL indicates that the opcode was not found in the
548 current language table. */
550 op_string (enum exp_opcode op)
553 const struct op_print *op_print_tab;
555 op_print_tab = current_language->la_op_print_tab;
556 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
557 if (op_print_tab[tem].opcode == op)
558 return op_print_tab[tem].string;
562 /* Support for dumping the raw data from expressions in a human readable
565 static char *op_name (struct expression *, enum exp_opcode);
566 static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
568 /* Name for OPCODE, when it appears in expression EXP. */
571 op_name (struct expression *exp, enum exp_opcode opcode)
573 return exp->language_defn->la_exp_desc->op_name (opcode);
576 /* Default name for the standard operator OPCODE (i.e., one defined in
577 the definition of enum exp_opcode). */
580 op_name_standard (enum exp_opcode opcode)
588 sprintf (buf, "<unknown %d>", opcode);
609 case BINOP_LOGICAL_AND:
610 return "BINOP_LOGICAL_AND";
611 case BINOP_LOGICAL_OR:
612 return "BINOP_LOGICAL_OR";
613 case BINOP_BITWISE_AND:
614 return "BINOP_BITWISE_AND";
615 case BINOP_BITWISE_IOR:
616 return "BINOP_BITWISE_IOR";
617 case BINOP_BITWISE_XOR:
618 return "BINOP_BITWISE_XOR";
620 return "BINOP_EQUAL";
622 return "BINOP_NOTEQUAL";
632 return "BINOP_REPEAT";
634 return "BINOP_ASSIGN";
636 return "BINOP_COMMA";
637 case BINOP_SUBSCRIPT:
638 return "BINOP_SUBSCRIPT";
639 case MULTI_SUBSCRIPT:
640 return "MULTI_SUBSCRIPT";
647 case STRUCTOP_MEMBER:
648 return "STRUCTOP_MEMBER";
650 return "STRUCTOP_MPTR";
652 return "BINOP_INTDIV";
653 case BINOP_ASSIGN_MODIFY:
654 return "BINOP_ASSIGN_MODIFY";
662 return "BINOP_CONCAT";
664 return "BINOP_RANGE";
668 return "TERNOP_COND";
670 return "TERNOP_SLICE";
671 case TERNOP_SLICE_COUNT:
672 return "TERNOP_SLICE_COUNT";
678 return "OP_VAR_VALUE";
682 return "OP_REGISTER";
684 return "OP_INTERNALVAR";
690 return "OP_BITSTRING";
696 return "UNOP_MEMVAL";
699 case UNOP_LOGICAL_NOT:
700 return "UNOP_LOGICAL_NOT";
701 case UNOP_COMPLEMENT:
702 return "UNOP_COMPLEMENT";
707 case UNOP_PREINCREMENT:
708 return "UNOP_PREINCREMENT";
709 case UNOP_POSTINCREMENT:
710 return "UNOP_POSTINCREMENT";
711 case UNOP_PREDECREMENT:
712 return "UNOP_PREDECREMENT";
713 case UNOP_POSTDECREMENT:
714 return "UNOP_POSTDECREMENT";
716 return "UNOP_SIZEOF";
722 return "UNOP_LENGTH";
748 return "OP_M2_STRING";
749 case STRUCTOP_STRUCT:
750 return "STRUCTOP_STRUCT";
752 return "STRUCTOP_PTR";
756 return "OP_OBJC_SELF";
767 dump_raw_expression (struct expression *exp, struct ui_file *stream,
775 fprintf_filtered (stream, "Dump of expression @ ");
776 gdb_print_host_address (exp, stream);
777 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
778 exp->language_defn->la_name, exp->nelts,
779 (long) sizeof (union exp_element));
780 fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode",
781 "Hex Value", "String Value");
782 for (elt = 0; elt < exp->nelts; elt++)
784 fprintf_filtered (stream, "\t%5d ", elt);
785 opcode_name = op_name (exp, exp->elts[elt].opcode);
787 fprintf_filtered (stream, "%20s ", opcode_name);
788 print_longest (stream, 'd', 0, exp->elts[elt].longconst);
789 fprintf_filtered (stream, " ");
791 for (eltscan = (char *) &exp->elts[elt],
792 eltsize = sizeof (union exp_element);
796 fprintf_filtered (stream, "%c",
797 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
799 fprintf_filtered (stream, "\n");
803 /* Dump the subexpression of prefix expression EXP whose operator is at
804 position ELT onto STREAM. Returns the position of the next
805 subexpression in EXP. */
808 dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
810 static int indent = 0;
813 fprintf_filtered (stream, "\n");
814 fprintf_filtered (stream, "\t%5d ", elt);
816 for (i = 1; i <= indent; i++)
817 fprintf_filtered (stream, " ");
820 fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode));
822 elt = dump_subexp_body (exp, stream, elt);
829 /* Dump the operands of prefix expression EXP whose opcode is at
830 position ELT onto STREAM. Returns the position of the next
831 subexpression in EXP. */
834 dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
836 return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
839 /* Default value for subexp_body in exp_descriptor vector. */
842 dump_subexp_body_standard (struct expression *exp,
843 struct ui_file *stream, int elt)
845 int opcode = exp->elts[elt++].opcode;
851 case TERNOP_SLICE_COUNT:
852 elt = dump_subexp (exp, stream, elt);
861 case BINOP_LOGICAL_AND:
862 case BINOP_LOGICAL_OR:
863 case BINOP_BITWISE_AND:
864 case BINOP_BITWISE_IOR:
865 case BINOP_BITWISE_XOR:
875 case BINOP_SUBSCRIPT:
880 case BINOP_ASSIGN_MODIFY:
888 case STRUCTOP_MEMBER:
890 elt = dump_subexp (exp, stream, elt);
892 case UNOP_LOGICAL_NOT:
893 case UNOP_COMPLEMENT:
896 case UNOP_PREINCREMENT:
897 case UNOP_POSTINCREMENT:
898 case UNOP_PREDECREMENT:
899 case UNOP_POSTDECREMENT:
918 elt = dump_subexp (exp, stream, elt);
921 fprintf_filtered (stream, "Type @");
922 gdb_print_host_address (exp->elts[elt].type, stream);
923 fprintf_filtered (stream, " (");
924 type_print (exp->elts[elt].type, NULL, stream, 0);
925 fprintf_filtered (stream, "), value %ld (0x%lx)",
926 (long) exp->elts[elt + 1].longconst,
927 (long) exp->elts[elt + 1].longconst);
931 fprintf_filtered (stream, "Type @");
932 gdb_print_host_address (exp->elts[elt].type, stream);
933 fprintf_filtered (stream, " (");
934 type_print (exp->elts[elt].type, NULL, stream, 0);
935 fprintf_filtered (stream, "), value %g",
936 (double) exp->elts[elt + 1].doubleconst);
940 fprintf_filtered (stream, "Block @");
941 gdb_print_host_address (exp->elts[elt].block, stream);
942 fprintf_filtered (stream, ", symbol @");
943 gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
944 fprintf_filtered (stream, " (%s)",
945 DEPRECATED_SYMBOL_NAME (exp->elts[elt + 1].symbol));
949 fprintf_filtered (stream, "History element %ld",
950 (long) exp->elts[elt].longconst);
954 fprintf_filtered (stream, "Register %ld",
955 (long) exp->elts[elt].longconst);
959 fprintf_filtered (stream, "Internal var @");
960 gdb_print_host_address (exp->elts[elt].internalvar, stream);
961 fprintf_filtered (stream, " (%s)",
962 exp->elts[elt].internalvar->name);
969 nargs = longest_to_int (exp->elts[elt].longconst);
971 fprintf_filtered (stream, "Number of args: %d", nargs);
974 for (i = 1; i <= nargs + 1; i++)
975 elt = dump_subexp (exp, stream, elt);
983 lower = longest_to_int (exp->elts[elt].longconst);
984 upper = longest_to_int (exp->elts[elt + 1].longconst);
986 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
989 for (i = 1; i <= upper - lower + 1; i++)
990 elt = dump_subexp (exp, stream, elt);
995 fprintf_filtered (stream, "Type @");
996 gdb_print_host_address (exp->elts[elt].type, stream);
997 fprintf_filtered (stream, " (");
998 type_print (exp->elts[elt].type, NULL, stream, 0);
999 fprintf_filtered (stream, ")");
1000 elt = dump_subexp (exp, stream, elt + 2);
1003 fprintf_filtered (stream, "Type @");
1004 gdb_print_host_address (exp->elts[elt].type, stream);
1005 fprintf_filtered (stream, " (");
1006 type_print (exp->elts[elt].type, NULL, stream, 0);
1007 fprintf_filtered (stream, ")");
1010 case STRUCTOP_STRUCT:
1016 len = longest_to_int (exp->elts[elt].longconst);
1017 elem_name = &exp->elts[elt + 1].string;
1019 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
1020 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
1028 fprintf_filtered (stream, "Type @");
1029 gdb_print_host_address (exp->elts[elt].type, stream);
1030 fprintf_filtered (stream, " (");
1031 type_print (exp->elts[elt].type, NULL, stream, 0);
1032 fprintf_filtered (stream, ") ");
1034 len = longest_to_int (exp->elts[elt + 1].longconst);
1035 elem_name = &exp->elts[elt + 2].string;
1037 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
1038 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
1043 case MULTI_SUBSCRIPT:
1044 case OP_F77_UNDETERMINED_ARGLIST:
1054 fprintf_filtered (stream, "Unknown format");
1061 dump_prefix_expression (struct expression *exp, struct ui_file *stream)
1065 fprintf_filtered (stream, "Dump of expression @ ");
1066 gdb_print_host_address (exp, stream);
1067 fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
1068 if (exp->elts[0].opcode != OP_TYPE)
1069 print_expression (exp, stream);
1071 fputs_filtered ("Type printing not yet supported....", stream);
1072 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
1073 exp->language_defn->la_name, exp->nelts,
1074 (long) sizeof (union exp_element));
1075 fputs_filtered ("\n", stream);
1077 for (elt = 0; elt < exp->nelts;)
1078 elt = dump_subexp (exp, stream, elt);
1079 fputs_filtered ("\n", stream);