1 /* Print in infix form a struct expression.
3 Copyright (C) 1986-2013 Free Software Foundation, Inc.
5 This file is part of GDB.
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "expression.h"
26 #include "parser-defs.h"
27 #include "user-regs.h" /* For user_reg_map_regnum_to_name. */
29 #include "gdb_string.h"
32 #include "gdb_assert.h"
38 print_expression (struct expression *exp, struct ui_file *stream)
42 print_subexp (exp, &pc, stream, PREC_NULL);
45 /* Print the subexpression of EXP that starts in position POS, on STREAM.
46 PREC is the precedence of the surrounding operator;
47 if the precedence of the main operator of this subexpression is less,
48 parentheses are needed here. */
51 print_subexp (struct expression *exp, int *pos,
52 struct ui_file *stream, enum precedence prec)
54 exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
57 /* Standard implementation of print_subexp for use in language_defn
60 print_subexp_standard (struct expression *exp, int *pos,
61 struct ui_file *stream, enum precedence prec)
64 const struct op_print *op_print_tab;
68 int assign_modify = 0;
69 enum exp_opcode opcode;
70 enum precedence myprec = PREC_NULL;
71 /* Set to 1 for a right-associative operator. */
76 op_print_tab = exp->language_defn->la_op_print_tab;
78 opcode = exp->elts[pc].opcode;
85 type_print (exp->elts[pc + 1].type, "", stream, 0);
91 fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
92 fputs_filtered ("::", stream);
93 nargs = longest_to_int (exp->elts[pc + 2].longconst);
94 (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
95 fputs_filtered (&exp->elts[pc + 3].string, stream);
100 struct value_print_options opts;
102 get_no_prettyformat_print_options (&opts);
104 value_print (value_from_longest (exp->elts[pc + 1].type,
105 exp->elts[pc + 2].longconst),
112 struct value_print_options opts;
114 get_no_prettyformat_print_options (&opts);
116 value_print (value_from_double (exp->elts[pc + 1].type,
117 exp->elts[pc + 2].doubleconst),
124 const struct block *b;
127 b = exp->elts[pc + 1].block;
129 && BLOCK_FUNCTION (b) != NULL
130 && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
132 fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
133 fputs_filtered ("::", stream);
135 fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
139 case OP_VAR_ENTRY_VALUE:
142 fprintf_filtered (stream, "%s@entry",
143 SYMBOL_PRINT_NAME (exp->elts[pc + 1].symbol));
149 fprintf_filtered (stream, "$%d",
150 longest_to_int (exp->elts[pc + 1].longconst));
155 const char *name = &exp->elts[pc + 2].string;
157 (*pos) += 3 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
158 fprintf_filtered (stream, "$%s", name);
164 fprintf_filtered (stream, "%s",
165 longest_to_int (exp->elts[pc + 1].longconst)
171 fprintf_filtered (stream, "$%s",
172 internalvar_name (exp->elts[pc + 1].internalvar));
177 nargs = longest_to_int (exp->elts[pc + 1].longconst);
178 print_subexp (exp, pos, stream, PREC_SUFFIX);
179 fputs_filtered (" (", stream);
180 for (tem = 0; tem < nargs; tem++)
183 fputs_filtered (", ", stream);
184 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
186 fputs_filtered (")", stream);
190 nargs = longest_to_int (exp->elts[pc + 1].longconst);
191 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
192 fputs_filtered (&exp->elts[pc + 2].string, stream);
197 struct value_print_options opts;
199 nargs = longest_to_int (exp->elts[pc + 1].longconst);
200 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
201 /* LA_PRINT_STRING will print using the current repeat count threshold.
202 If necessary, we can temporarily set it to zero, or pass it as an
203 additional parameter to LA_PRINT_STRING. -fnf */
204 get_user_print_options (&opts);
205 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
206 (gdb_byte *) &exp->elts[pc + 2].string, nargs,
211 case OP_OBJC_NSSTRING: /* Objective-C Foundation Class
212 NSString constant. */
214 struct value_print_options opts;
216 nargs = longest_to_int (exp->elts[pc + 1].longconst);
217 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
218 fputs_filtered ("@\"", stream);
219 get_user_print_options (&opts);
220 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
221 (gdb_byte *) &exp->elts[pc + 2].string, nargs,
223 fputs_filtered ("\"", stream);
227 case OP_OBJC_MSGCALL:
228 { /* Objective C message (method) call. */
232 nargs = longest_to_int (exp->elts[pc + 2].longconst);
233 fprintf_unfiltered (stream, "[");
234 print_subexp (exp, pos, stream, PREC_SUFFIX);
235 if (0 == target_read_string (exp->elts[pc + 1].longconst,
236 &selector, 1024, NULL))
238 error (_("bad selector"));
245 s = alloca (strlen (selector) + 1);
246 strcpy (s, selector);
247 for (tem = 0; tem < nargs; tem++)
249 nextS = strchr (s, ':');
250 gdb_assert (nextS); /* Make sure we found ':'. */
252 fprintf_unfiltered (stream, " %s: ", s);
254 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
259 fprintf_unfiltered (stream, " %s", selector);
261 fprintf_unfiltered (stream, "]");
262 /* "selector" was malloc'd by target_read_string. Free it. */
269 nargs = longest_to_int (exp->elts[pc + 2].longconst);
270 nargs -= longest_to_int (exp->elts[pc + 1].longconst);
273 if (exp->elts[pc + 4].opcode == OP_LONG
274 && exp->elts[pc + 5].type
275 == builtin_type (exp->gdbarch)->builtin_char
276 && exp->language_defn->la_language == language_c)
278 /* Attempt to print C character arrays using string syntax.
279 Walk through the args, picking up one character from each
280 of the OP_LONG expression elements. If any array element
281 does not match our expection of what we should find for
282 a simple string, revert back to array printing. Note that
283 the last expression element is an explicit null terminator
284 byte, which doesn't get printed. */
285 tempstr = alloca (nargs);
289 if (exp->elts[pc].opcode != OP_LONG
290 || exp->elts[pc + 1].type
291 != builtin_type (exp->gdbarch)->builtin_char)
293 /* Not a simple array of char, use regular array
301 longest_to_int (exp->elts[pc + 2].longconst);
308 struct value_print_options opts;
310 get_user_print_options (&opts);
311 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
312 (gdb_byte *) tempstr, nargs - 1, NULL, 0, &opts);
317 fputs_filtered (" {", stream);
318 for (tem = 0; tem < nargs; tem++)
322 fputs_filtered (", ", stream);
324 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
326 fputs_filtered ("}", stream);
331 if ((int) prec > (int) PREC_COMMA)
332 fputs_filtered ("(", stream);
333 /* Print the subexpressions, forcing parentheses
334 around any binary operations within them.
335 This is more parentheses than are strictly necessary,
336 but it looks clearer. */
337 print_subexp (exp, pos, stream, PREC_HYPER);
338 fputs_filtered (" ? ", stream);
339 print_subexp (exp, pos, stream, PREC_HYPER);
340 fputs_filtered (" : ", stream);
341 print_subexp (exp, pos, stream, PREC_HYPER);
342 if ((int) prec > (int) PREC_COMMA)
343 fputs_filtered (")", stream);
347 print_subexp (exp, pos, stream, PREC_SUFFIX);
348 fputs_filtered ("(", stream);
349 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
350 fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
351 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
352 fputs_filtered (")", stream);
355 case STRUCTOP_STRUCT:
356 tem = longest_to_int (exp->elts[pc + 1].longconst);
357 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
358 print_subexp (exp, pos, stream, PREC_SUFFIX);
359 fputs_filtered (".", stream);
360 fputs_filtered (&exp->elts[pc + 2].string, stream);
363 /* Will not occur for Modula-2. */
365 tem = longest_to_int (exp->elts[pc + 1].longconst);
366 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
367 print_subexp (exp, pos, stream, PREC_SUFFIX);
368 fputs_filtered ("->", stream);
369 fputs_filtered (&exp->elts[pc + 2].string, stream);
372 case STRUCTOP_MEMBER:
373 print_subexp (exp, pos, stream, PREC_SUFFIX);
374 fputs_filtered (".*", stream);
375 print_subexp (exp, pos, stream, PREC_SUFFIX);
379 print_subexp (exp, pos, stream, PREC_SUFFIX);
380 fputs_filtered ("->*", stream);
381 print_subexp (exp, pos, stream, PREC_SUFFIX);
384 case BINOP_SUBSCRIPT:
385 print_subexp (exp, pos, stream, PREC_SUFFIX);
386 fputs_filtered ("[", stream);
387 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
388 fputs_filtered ("]", stream);
391 case UNOP_POSTINCREMENT:
392 print_subexp (exp, pos, stream, PREC_SUFFIX);
393 fputs_filtered ("++", stream);
396 case UNOP_POSTDECREMENT:
397 print_subexp (exp, pos, stream, PREC_SUFFIX);
398 fputs_filtered ("--", stream);
403 if ((int) prec > (int) PREC_PREFIX)
404 fputs_filtered ("(", stream);
405 fputs_filtered ("(", stream);
406 type_print (exp->elts[pc + 1].type, "", stream, 0);
407 fputs_filtered (") ", stream);
408 print_subexp (exp, pos, stream, PREC_PREFIX);
409 if ((int) prec > (int) PREC_PREFIX)
410 fputs_filtered (")", stream);
414 if ((int) prec > (int) PREC_PREFIX)
415 fputs_filtered ("(", stream);
416 fputs_filtered ("(", stream);
417 print_subexp (exp, pos, stream, PREC_PREFIX);
418 fputs_filtered (") ", stream);
419 print_subexp (exp, pos, stream, PREC_PREFIX);
420 if ((int) prec > (int) PREC_PREFIX)
421 fputs_filtered (")", stream);
424 case UNOP_DYNAMIC_CAST:
425 case UNOP_REINTERPRET_CAST:
426 fputs_filtered (opcode == UNOP_DYNAMIC_CAST ? "dynamic_cast"
427 : "reinterpret_cast", stream);
428 fputs_filtered ("<", stream);
429 print_subexp (exp, pos, stream, PREC_PREFIX);
430 fputs_filtered ("> (", stream);
431 print_subexp (exp, pos, stream, PREC_PREFIX);
432 fputs_filtered (")", stream);
437 if ((int) prec > (int) PREC_PREFIX)
438 fputs_filtered ("(", stream);
439 if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC
440 && exp->elts[pc + 3].opcode == OP_LONG)
442 struct value_print_options opts;
444 /* We have a minimal symbol fn, probably. It's encoded
445 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
446 Swallow the OP_LONG (including both its opcodes); ignore
447 its type; print the value in the type of the MEMVAL. */
449 val = value_at_lazy (exp->elts[pc + 1].type,
450 (CORE_ADDR) exp->elts[pc + 5].longconst);
451 get_no_prettyformat_print_options (&opts);
452 value_print (val, stream, &opts);
456 fputs_filtered ("{", stream);
457 type_print (exp->elts[pc + 1].type, "", stream, 0);
458 fputs_filtered ("} ", stream);
459 print_subexp (exp, pos, stream, PREC_PREFIX);
461 if ((int) prec > (int) PREC_PREFIX)
462 fputs_filtered (")", stream);
465 case UNOP_MEMVAL_TYPE:
466 if ((int) prec > (int) PREC_PREFIX)
467 fputs_filtered ("(", stream);
468 fputs_filtered ("{", stream);
469 print_subexp (exp, pos, stream, PREC_PREFIX);
470 fputs_filtered ("} ", stream);
471 print_subexp (exp, pos, stream, PREC_PREFIX);
472 if ((int) prec > (int) PREC_PREFIX)
473 fputs_filtered (")", stream);
476 case UNOP_MEMVAL_TLS:
478 if ((int) prec > (int) PREC_PREFIX)
479 fputs_filtered ("(", stream);
480 fputs_filtered ("{", stream);
481 type_print (exp->elts[pc + 2].type, "", stream, 0);
482 fputs_filtered ("} ", stream);
483 print_subexp (exp, pos, stream, PREC_PREFIX);
484 if ((int) prec > (int) PREC_PREFIX)
485 fputs_filtered (")", stream);
488 case BINOP_ASSIGN_MODIFY:
489 opcode = exp->elts[pc + 1].opcode;
491 myprec = PREC_ASSIGN;
495 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
496 if (op_print_tab[tem].opcode == opcode)
498 op_str = op_print_tab[tem].string;
501 if (op_print_tab[tem].opcode != opcode)
502 /* Not found; don't try to keep going because we don't know how
503 to interpret further elements. */
504 error (_("Invalid expression"));
511 if (exp->language_defn->la_name_of_this)
512 fputs_filtered (exp->language_defn->la_name_of_this, stream);
514 fprintf_filtered (stream, _("<language %s has no 'this'>"),
515 exp->language_defn->la_name);
520 case MULTI_SUBSCRIPT:
522 nargs = longest_to_int (exp->elts[pc + 1].longconst);
523 print_subexp (exp, pos, stream, PREC_SUFFIX);
524 fprintf_unfiltered (stream, " [");
525 for (tem = 0; tem < nargs; tem++)
528 fprintf_unfiltered (stream, ", ");
529 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
531 fprintf_unfiltered (stream, "]");
536 fprintf_unfiltered (stream, "VAL(");
537 type_print (exp->elts[pc + 1].type, "", stream, 0);
538 fprintf_unfiltered (stream, ",");
539 print_subexp (exp, pos, stream, PREC_PREFIX);
540 fprintf_unfiltered (stream, ")");
545 LONGEST count = exp->elts[pc + 1].longconst;
549 fputs_unfiltered ("TypesInstance(", stream);
552 type_print (exp->elts[(*pos)++].type, "", stream, 0);
554 fputs_unfiltered (",", stream);
556 fputs_unfiltered (",", stream);
557 /* Ending COUNT and ending TYPE_INSTANCE. */
559 print_subexp (exp, pos, stream, PREC_PREFIX);
560 fputs_unfiltered (")", stream);
568 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
569 if (op_print_tab[tem].opcode == opcode)
571 op_str = op_print_tab[tem].string;
572 myprec = op_print_tab[tem].precedence;
573 assoc = op_print_tab[tem].right_assoc;
576 if (op_print_tab[tem].opcode != opcode)
577 /* Not found; don't try to keep going because we don't know how
578 to interpret further elements. For example, this happens
579 if opcode is OP_TYPE. */
580 error (_("Invalid expression"));
583 /* Note that PREC_BUILTIN will always emit parentheses. */
584 if ((int) myprec < (int) prec)
585 fputs_filtered ("(", stream);
586 if ((int) opcode > (int) BINOP_END)
590 /* Unary postfix operator. */
591 print_subexp (exp, pos, stream, PREC_SUFFIX);
592 fputs_filtered (op_str, stream);
596 /* Unary prefix operator. */
597 fputs_filtered (op_str, stream);
598 if (myprec == PREC_BUILTIN_FUNCTION)
599 fputs_filtered ("(", stream);
600 print_subexp (exp, pos, stream, PREC_PREFIX);
601 if (myprec == PREC_BUILTIN_FUNCTION)
602 fputs_filtered (")", stream);
607 /* Binary operator. */
608 /* Print left operand.
609 If operator is right-associative,
610 increment precedence for this operand. */
611 print_subexp (exp, pos, stream,
612 (enum precedence) ((int) myprec + assoc));
613 /* Print the operator itself. */
615 fprintf_filtered (stream, " %s= ", op_str);
616 else if (op_str[0] == ',')
617 fprintf_filtered (stream, "%s ", op_str);
619 fprintf_filtered (stream, " %s ", op_str);
620 /* Print right operand.
621 If operator is left-associative,
622 increment precedence for this operand. */
623 print_subexp (exp, pos, stream,
624 (enum precedence) ((int) myprec + !assoc));
627 if ((int) myprec < (int) prec)
628 fputs_filtered (")", stream);
631 /* Return the operator corresponding to opcode OP as
632 a string. NULL indicates that the opcode was not found in the
633 current language table. */
635 op_string (enum exp_opcode op)
638 const struct op_print *op_print_tab;
640 op_print_tab = current_language->la_op_print_tab;
641 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
642 if (op_print_tab[tem].opcode == op)
643 return op_print_tab[tem].string;
647 /* Support for dumping the raw data from expressions in a human readable
650 static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
652 /* Name for OPCODE, when it appears in expression EXP. */
655 op_name (struct expression *exp, enum exp_opcode opcode)
657 return exp->language_defn->la_exp_desc->op_name (opcode);
660 /* Default name for the standard operator OPCODE (i.e., one defined in
661 the definition of enum exp_opcode). */
664 op_name_standard (enum exp_opcode opcode)
672 xsnprintf (buf, sizeof (buf), "<unknown %d>", opcode);
678 #include "std-operator.def"
683 /* Print a raw dump of expression EXP to STREAM.
684 NOTE, if non-NULL, is printed as extra explanatory text. */
687 dump_raw_expression (struct expression *exp, struct ui_file *stream,
695 fprintf_filtered (stream, "Dump of expression @ ");
696 gdb_print_host_address (exp, stream);
698 fprintf_filtered (stream, ", %s:", note);
699 fprintf_filtered (stream, "\n\tLanguage %s, %d elements, %ld bytes each.\n",
700 exp->language_defn->la_name, exp->nelts,
701 (long) sizeof (union exp_element));
702 fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode",
703 "Hex Value", "String Value");
704 for (elt = 0; elt < exp->nelts; elt++)
706 fprintf_filtered (stream, "\t%5d ", elt);
707 opcode_name = op_name (exp, exp->elts[elt].opcode);
709 fprintf_filtered (stream, "%20s ", opcode_name);
710 print_longest (stream, 'd', 0, exp->elts[elt].longconst);
711 fprintf_filtered (stream, " ");
713 for (eltscan = (char *) &exp->elts[elt],
714 eltsize = sizeof (union exp_element);
718 fprintf_filtered (stream, "%c",
719 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
721 fprintf_filtered (stream, "\n");
725 /* Dump the subexpression of prefix expression EXP whose operator is at
726 position ELT onto STREAM. Returns the position of the next
727 subexpression in EXP. */
730 dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
732 static int indent = 0;
735 fprintf_filtered (stream, "\n");
736 fprintf_filtered (stream, "\t%5d ", elt);
738 for (i = 1; i <= indent; i++)
739 fprintf_filtered (stream, " ");
742 fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode));
744 elt = dump_subexp_body (exp, stream, elt);
751 /* Dump the operands of prefix expression EXP whose opcode is at
752 position ELT onto STREAM. Returns the position of the next
753 subexpression in EXP. */
756 dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
758 return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
761 /* Default value for subexp_body in exp_descriptor vector. */
764 dump_subexp_body_standard (struct expression *exp,
765 struct ui_file *stream, int elt)
767 int opcode = exp->elts[elt++].opcode;
773 elt = dump_subexp (exp, stream, elt);
783 case BINOP_LOGICAL_AND:
784 case BINOP_LOGICAL_OR:
785 case BINOP_BITWISE_AND:
786 case BINOP_BITWISE_IOR:
787 case BINOP_BITWISE_XOR:
797 case BINOP_SUBSCRIPT:
802 case BINOP_ASSIGN_MODIFY:
808 case STRUCTOP_MEMBER:
810 elt = dump_subexp (exp, stream, elt);
813 case UNOP_LOGICAL_NOT:
814 case UNOP_COMPLEMENT:
817 case UNOP_PREINCREMENT:
818 case UNOP_POSTINCREMENT:
819 case UNOP_PREDECREMENT:
820 case UNOP_POSTDECREMENT:
833 elt = dump_subexp (exp, stream, elt);
836 fprintf_filtered (stream, "Type @");
837 gdb_print_host_address (exp->elts[elt].type, stream);
838 fprintf_filtered (stream, " (");
839 type_print (exp->elts[elt].type, NULL, stream, 0);
840 fprintf_filtered (stream, "), value %ld (0x%lx)",
841 (long) exp->elts[elt + 1].longconst,
842 (long) exp->elts[elt + 1].longconst);
846 fprintf_filtered (stream, "Type @");
847 gdb_print_host_address (exp->elts[elt].type, stream);
848 fprintf_filtered (stream, " (");
849 type_print (exp->elts[elt].type, NULL, stream, 0);
850 fprintf_filtered (stream, "), value %g",
851 (double) exp->elts[elt + 1].doubleconst);
855 fprintf_filtered (stream, "Block @");
856 gdb_print_host_address (exp->elts[elt].block, stream);
857 fprintf_filtered (stream, ", symbol @");
858 gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
859 fprintf_filtered (stream, " (%s)",
860 SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol));
863 case OP_VAR_ENTRY_VALUE:
864 fprintf_filtered (stream, "Entry value of symbol @");
865 gdb_print_host_address (exp->elts[elt].symbol, stream);
866 fprintf_filtered (stream, " (%s)",
867 SYMBOL_PRINT_NAME (exp->elts[elt].symbol));
871 fprintf_filtered (stream, "History element %ld",
872 (long) exp->elts[elt].longconst);
876 fprintf_filtered (stream, "Register $%s", &exp->elts[elt + 1].string);
877 elt += 3 + BYTES_TO_EXP_ELEM (exp->elts[elt].longconst + 1);
880 fprintf_filtered (stream, "Internal var @");
881 gdb_print_host_address (exp->elts[elt].internalvar, stream);
882 fprintf_filtered (stream, " (%s)",
883 internalvar_name (exp->elts[elt].internalvar));
890 nargs = longest_to_int (exp->elts[elt].longconst);
892 fprintf_filtered (stream, "Number of args: %d", nargs);
895 for (i = 1; i <= nargs + 1; i++)
896 elt = dump_subexp (exp, stream, elt);
904 lower = longest_to_int (exp->elts[elt].longconst);
905 upper = longest_to_int (exp->elts[elt + 1].longconst);
907 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
910 for (i = 1; i <= upper - lower + 1; i++)
911 elt = dump_subexp (exp, stream, elt);
914 case UNOP_DYNAMIC_CAST:
915 case UNOP_REINTERPRET_CAST:
917 case UNOP_MEMVAL_TYPE:
918 fprintf_filtered (stream, " (");
919 elt = dump_subexp (exp, stream, elt);
920 fprintf_filtered (stream, ")");
921 elt = dump_subexp (exp, stream, elt);
925 fprintf_filtered (stream, "Type @");
926 gdb_print_host_address (exp->elts[elt].type, stream);
927 fprintf_filtered (stream, " (");
928 type_print (exp->elts[elt].type, NULL, stream, 0);
929 fprintf_filtered (stream, ")");
930 elt = dump_subexp (exp, stream, elt + 2);
932 case UNOP_MEMVAL_TLS:
933 fprintf_filtered (stream, "TLS type @");
934 gdb_print_host_address (exp->elts[elt + 1].type, stream);
935 fprintf_filtered (stream, " (__thread /* \"%s\" */ ",
936 (exp->elts[elt].objfile == NULL ? "(null)"
937 : exp->elts[elt].objfile->name));
938 type_print (exp->elts[elt + 1].type, NULL, stream, 0);
939 fprintf_filtered (stream, ")");
940 elt = dump_subexp (exp, stream, elt + 3);
943 fprintf_filtered (stream, "Type @");
944 gdb_print_host_address (exp->elts[elt].type, stream);
945 fprintf_filtered (stream, " (");
946 type_print (exp->elts[elt].type, NULL, stream, 0);
947 fprintf_filtered (stream, ")");
952 fprintf_filtered (stream, "Typeof (");
953 elt = dump_subexp (exp, stream, elt);
954 fprintf_filtered (stream, ")");
957 fprintf_filtered (stream, "typeid (");
958 elt = dump_subexp (exp, stream, elt);
959 fprintf_filtered (stream, ")");
961 case STRUCTOP_STRUCT:
967 len = longest_to_int (exp->elts[elt].longconst);
968 elem_name = &exp->elts[elt + 1].string;
970 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
971 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
979 fprintf_filtered (stream, "Type @");
980 gdb_print_host_address (exp->elts[elt].type, stream);
981 fprintf_filtered (stream, " (");
982 type_print (exp->elts[elt].type, NULL, stream, 0);
983 fprintf_filtered (stream, ") ");
985 len = longest_to_int (exp->elts[elt + 1].longconst);
986 elem_name = &exp->elts[elt + 2].string;
988 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
989 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
996 len = exp->elts[elt++].longconst;
997 fprintf_filtered (stream, "%s TypeInstance: ", plongest (len));
1000 fprintf_filtered (stream, "Type @");
1001 gdb_print_host_address (exp->elts[elt].type, stream);
1002 fprintf_filtered (stream, " (");
1003 type_print (exp->elts[elt].type, NULL, stream, 0);
1004 fprintf_filtered (stream, ")");
1007 fputs_filtered (", ", stream);
1009 /* Ending LEN and ending TYPE_INSTANCE. */
1011 elt = dump_subexp (exp, stream, elt);
1016 case MULTI_SUBSCRIPT:
1017 case OP_F77_UNDETERMINED_ARGLIST:
1024 fprintf_filtered (stream, "Unknown format");
1031 dump_prefix_expression (struct expression *exp, struct ui_file *stream)
1035 fprintf_filtered (stream, "Dump of expression @ ");
1036 gdb_print_host_address (exp, stream);
1037 fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
1038 print_expression (exp, stream);
1039 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
1040 exp->language_defn->la_name, exp->nelts,
1041 (long) sizeof (union exp_element));
1042 fputs_filtered ("\n", stream);
1044 for (elt = 0; elt < exp->nelts;)
1045 elt = dump_subexp (exp, stream, elt);
1046 fputs_filtered ("\n", stream);