1 /* Print in infix form a struct expression.
3 Copyright (C) 1986, 1988-1989, 1991-2000, 2003, 2007-2012 Free
4 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 3 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, see <http://www.gnu.org/licenses/>. */
24 #include "expression.h"
27 #include "parser-defs.h"
28 #include "user-regs.h" /* For user_reg_map_regnum_to_name. */
30 #include "gdb_string.h"
33 #include "gdb_assert.h"
41 print_expression (struct expression *exp, struct ui_file *stream)
45 print_subexp (exp, &pc, stream, PREC_NULL);
48 /* Print the subexpression of EXP that starts in position POS, on STREAM.
49 PREC is the precedence of the surrounding operator;
50 if the precedence of the main operator of this subexpression is less,
51 parentheses are needed here. */
54 print_subexp (struct expression *exp, int *pos,
55 struct ui_file *stream, enum precedence prec)
57 exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
60 /* Standard implementation of print_subexp for use in language_defn
63 print_subexp_standard (struct expression *exp, int *pos,
64 struct ui_file *stream, enum precedence prec)
67 const struct op_print *op_print_tab;
71 int assign_modify = 0;
72 enum exp_opcode opcode;
73 enum precedence myprec = PREC_NULL;
74 /* Set to 1 for a right-associative operator. */
79 op_print_tab = exp->language_defn->la_op_print_tab;
81 opcode = exp->elts[pc].opcode;
89 fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
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);
98 struct value_print_options opts;
100 get_raw_print_options (&opts);
102 value_print (value_from_longest (exp->elts[pc + 1].type,
103 exp->elts[pc + 2].longconst),
110 struct value_print_options opts;
112 get_raw_print_options (&opts);
114 value_print (value_from_double (exp->elts[pc + 1].type,
115 exp->elts[pc + 2].doubleconst),
125 b = exp->elts[pc + 1].block;
127 && BLOCK_FUNCTION (b) != NULL
128 && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
130 fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
131 fputs_filtered ("::", stream);
133 fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
137 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 &exp->elts[pc + 2].string, nargs, NULL, 0, &opts);
211 nargs = longest_to_int (exp->elts[pc + 1].longconst);
213 += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
214 fprintf_unfiltered (stream, "B'<unimplemented>'");
217 case OP_OBJC_NSSTRING: /* Objective-C Foundation Class
218 NSString constant. */
220 struct value_print_options opts;
222 nargs = longest_to_int (exp->elts[pc + 1].longconst);
223 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
224 fputs_filtered ("@\"", stream);
225 get_user_print_options (&opts);
226 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
227 &exp->elts[pc + 2].string, nargs, NULL, 0, &opts);
228 fputs_filtered ("\"", stream);
232 case OP_OBJC_MSGCALL:
233 { /* Objective C message (method) call. */
237 nargs = longest_to_int (exp->elts[pc + 2].longconst);
238 fprintf_unfiltered (stream, "[");
239 print_subexp (exp, pos, stream, PREC_SUFFIX);
240 if (0 == target_read_string (exp->elts[pc + 1].longconst,
241 &selector, 1024, NULL))
243 error (_("bad selector"));
250 s = alloca (strlen (selector) + 1);
251 strcpy (s, selector);
252 for (tem = 0; tem < nargs; tem++)
254 nextS = strchr (s, ':');
255 gdb_assert (nextS); /* Make sure we found ':'. */
257 fprintf_unfiltered (stream, " %s: ", s);
259 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
264 fprintf_unfiltered (stream, " %s", selector);
266 fprintf_unfiltered (stream, "]");
267 /* "selector" was malloc'd by target_read_string. Free it. */
274 nargs = longest_to_int (exp->elts[pc + 2].longconst);
275 nargs -= longest_to_int (exp->elts[pc + 1].longconst);
278 if (exp->elts[pc + 4].opcode == OP_LONG
279 && exp->elts[pc + 5].type
280 == builtin_type (exp->gdbarch)->builtin_char
281 && exp->language_defn->la_language == language_c)
283 /* Attempt to print C character arrays using string syntax.
284 Walk through the args, picking up one character from each
285 of the OP_LONG expression elements. If any array element
286 does not match our expection of what we should find for
287 a simple string, revert back to array printing. Note that
288 the last expression element is an explicit null terminator
289 byte, which doesn't get printed. */
290 tempstr = alloca (nargs);
294 if (exp->elts[pc].opcode != OP_LONG
295 || exp->elts[pc + 1].type
296 != builtin_type (exp->gdbarch)->builtin_char)
298 /* Not a simple array of char, use regular array
306 longest_to_int (exp->elts[pc + 2].longconst);
313 struct value_print_options opts;
315 get_user_print_options (&opts);
316 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
317 tempstr, nargs - 1, NULL, 0, &opts);
322 fputs_filtered (" {", stream);
323 for (tem = 0; tem < nargs; tem++)
327 fputs_filtered (", ", stream);
329 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
331 fputs_filtered ("}", stream);
336 tem = longest_to_int (exp->elts[pc + 1].longconst);
337 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
338 /* Gcc support both these syntaxes. Unsure which is preferred. */
340 fputs_filtered (&exp->elts[pc + 2].string, stream);
341 fputs_filtered (": ", stream);
343 fputs_filtered (".", stream);
344 fputs_filtered (&exp->elts[pc + 2].string, stream);
345 fputs_filtered ("=", stream);
347 print_subexp (exp, pos, stream, PREC_SUFFIX);
351 if ((int) prec > (int) PREC_COMMA)
352 fputs_filtered ("(", stream);
353 /* Print the subexpressions, forcing parentheses
354 around any binary operations within them.
355 This is more parentheses than are strictly necessary,
356 but it looks clearer. */
357 print_subexp (exp, pos, stream, PREC_HYPER);
358 fputs_filtered (" ? ", stream);
359 print_subexp (exp, pos, stream, PREC_HYPER);
360 fputs_filtered (" : ", stream);
361 print_subexp (exp, pos, stream, PREC_HYPER);
362 if ((int) prec > (int) PREC_COMMA)
363 fputs_filtered (")", stream);
367 case TERNOP_SLICE_COUNT:
368 print_subexp (exp, pos, stream, PREC_SUFFIX);
369 fputs_filtered ("(", stream);
370 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
371 fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
372 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
373 fputs_filtered (")", stream);
376 case STRUCTOP_STRUCT:
377 tem = longest_to_int (exp->elts[pc + 1].longconst);
378 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
379 print_subexp (exp, pos, stream, PREC_SUFFIX);
380 fputs_filtered (".", stream);
381 fputs_filtered (&exp->elts[pc + 2].string, stream);
384 /* Will not occur for Modula-2. */
386 tem = longest_to_int (exp->elts[pc + 1].longconst);
387 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
388 print_subexp (exp, pos, stream, PREC_SUFFIX);
389 fputs_filtered ("->", stream);
390 fputs_filtered (&exp->elts[pc + 2].string, stream);
393 case STRUCTOP_MEMBER:
394 print_subexp (exp, pos, stream, PREC_SUFFIX);
395 fputs_filtered (".*", stream);
396 print_subexp (exp, pos, stream, PREC_SUFFIX);
400 print_subexp (exp, pos, stream, PREC_SUFFIX);
401 fputs_filtered ("->*", stream);
402 print_subexp (exp, pos, stream, PREC_SUFFIX);
405 case BINOP_SUBSCRIPT:
406 print_subexp (exp, pos, stream, PREC_SUFFIX);
407 fputs_filtered ("[", stream);
408 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
409 fputs_filtered ("]", stream);
412 case UNOP_POSTINCREMENT:
413 print_subexp (exp, pos, stream, PREC_SUFFIX);
414 fputs_filtered ("++", stream);
417 case UNOP_POSTDECREMENT:
418 print_subexp (exp, pos, stream, PREC_SUFFIX);
419 fputs_filtered ("--", stream);
424 if ((int) prec > (int) PREC_PREFIX)
425 fputs_filtered ("(", stream);
426 fputs_filtered ("(", stream);
427 type_print (exp->elts[pc + 1].type, "", stream, 0);
428 fputs_filtered (") ", stream);
429 print_subexp (exp, pos, stream, PREC_PREFIX);
430 if ((int) prec > (int) PREC_PREFIX)
431 fputs_filtered (")", stream);
434 case UNOP_DYNAMIC_CAST:
435 case UNOP_REINTERPRET_CAST:
436 fputs_filtered (opcode == UNOP_DYNAMIC_CAST ? "dynamic_cast"
437 : "reinterpret_cast", stream);
438 fputs_filtered ("<", stream);
440 type_print (exp->elts[pc + 1].type, "", stream, 0);
441 fputs_filtered ("> (", stream);
442 print_subexp (exp, pos, stream, PREC_PREFIX);
443 fputs_filtered (")", stream);
448 if ((int) prec > (int) PREC_PREFIX)
449 fputs_filtered ("(", stream);
450 if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC
451 && exp->elts[pc + 3].opcode == OP_LONG)
453 struct value_print_options opts;
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. */
460 val = value_at_lazy (exp->elts[pc + 1].type,
461 (CORE_ADDR) exp->elts[pc + 5].longconst);
462 get_raw_print_options (&opts);
463 value_print (val, stream, &opts);
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);
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 sprintf (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 case TERNOP_SLICE_COUNT:
774 elt = dump_subexp (exp, stream, elt);
784 case BINOP_LOGICAL_AND:
785 case BINOP_LOGICAL_OR:
786 case BINOP_BITWISE_AND:
787 case BINOP_BITWISE_IOR:
788 case BINOP_BITWISE_XOR:
798 case BINOP_SUBSCRIPT:
803 case BINOP_ASSIGN_MODIFY:
809 case STRUCTOP_MEMBER:
811 elt = dump_subexp (exp, stream, elt);
814 case UNOP_LOGICAL_NOT:
815 case UNOP_COMPLEMENT:
818 case UNOP_PREINCREMENT:
819 case UNOP_POSTINCREMENT:
820 case UNOP_PREDECREMENT:
821 case UNOP_POSTDECREMENT:
834 elt = dump_subexp (exp, stream, elt);
837 fprintf_filtered (stream, "Type @");
838 gdb_print_host_address (exp->elts[elt].type, stream);
839 fprintf_filtered (stream, " (");
840 type_print (exp->elts[elt].type, NULL, stream, 0);
841 fprintf_filtered (stream, "), value %ld (0x%lx)",
842 (long) exp->elts[elt + 1].longconst,
843 (long) exp->elts[elt + 1].longconst);
847 fprintf_filtered (stream, "Type @");
848 gdb_print_host_address (exp->elts[elt].type, stream);
849 fprintf_filtered (stream, " (");
850 type_print (exp->elts[elt].type, NULL, stream, 0);
851 fprintf_filtered (stream, "), value %g",
852 (double) exp->elts[elt + 1].doubleconst);
856 fprintf_filtered (stream, "Block @");
857 gdb_print_host_address (exp->elts[elt].block, stream);
858 fprintf_filtered (stream, ", symbol @");
859 gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
860 fprintf_filtered (stream, " (%s)",
861 SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol));
864 case OP_VAR_ENTRY_VALUE:
865 fprintf_filtered (stream, "Entry value of symbol @");
866 gdb_print_host_address (exp->elts[elt].symbol, stream);
867 fprintf_filtered (stream, " (%s)",
868 SYMBOL_PRINT_NAME (exp->elts[elt].symbol));
872 fprintf_filtered (stream, "History element %ld",
873 (long) exp->elts[elt].longconst);
877 fprintf_filtered (stream, "Register $%s", &exp->elts[elt + 1].string);
878 elt += 3 + BYTES_TO_EXP_ELEM (exp->elts[elt].longconst + 1);
881 fprintf_filtered (stream, "Internal var @");
882 gdb_print_host_address (exp->elts[elt].internalvar, stream);
883 fprintf_filtered (stream, " (%s)",
884 internalvar_name (exp->elts[elt].internalvar));
891 nargs = longest_to_int (exp->elts[elt].longconst);
893 fprintf_filtered (stream, "Number of args: %d", nargs);
896 for (i = 1; i <= nargs + 1; i++)
897 elt = dump_subexp (exp, stream, elt);
905 lower = longest_to_int (exp->elts[elt].longconst);
906 upper = longest_to_int (exp->elts[elt + 1].longconst);
908 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
911 for (i = 1; i <= upper - lower + 1; i++)
912 elt = dump_subexp (exp, stream, elt);
917 case UNOP_DYNAMIC_CAST:
918 case UNOP_REINTERPRET_CAST:
919 fprintf_filtered (stream, "Type @");
920 gdb_print_host_address (exp->elts[elt].type, stream);
921 fprintf_filtered (stream, " (");
922 type_print (exp->elts[elt].type, NULL, stream, 0);
923 fprintf_filtered (stream, ")");
924 elt = dump_subexp (exp, stream, elt + 2);
926 case UNOP_MEMVAL_TLS:
927 fprintf_filtered (stream, "TLS type @");
928 gdb_print_host_address (exp->elts[elt + 1].type, stream);
929 fprintf_filtered (stream, " (__thread /* \"%s\" */ ",
930 (exp->elts[elt].objfile == NULL ? "(null)"
931 : exp->elts[elt].objfile->name));
932 type_print (exp->elts[elt + 1].type, NULL, stream, 0);
933 fprintf_filtered (stream, ")");
934 elt = dump_subexp (exp, stream, elt + 3);
937 fprintf_filtered (stream, "Type @");
938 gdb_print_host_address (exp->elts[elt].type, stream);
939 fprintf_filtered (stream, " (");
940 type_print (exp->elts[elt].type, NULL, stream, 0);
941 fprintf_filtered (stream, ")");
944 case STRUCTOP_STRUCT:
950 len = longest_to_int (exp->elts[elt].longconst);
951 elem_name = &exp->elts[elt + 1].string;
953 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
954 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
962 fprintf_filtered (stream, "Type @");
963 gdb_print_host_address (exp->elts[elt].type, stream);
964 fprintf_filtered (stream, " (");
965 type_print (exp->elts[elt].type, NULL, stream, 0);
966 fprintf_filtered (stream, ") ");
968 len = longest_to_int (exp->elts[elt + 1].longconst);
969 elem_name = &exp->elts[elt + 2].string;
971 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
972 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
980 len = exp->elts[elt++].longconst;
981 fprintf_filtered (stream, "%s TypeInstance: ", plongest (len));
984 fprintf_filtered (stream, "Type @");
985 gdb_print_host_address (exp->elts[elt].type, stream);
986 fprintf_filtered (stream, " (");
987 type_print (exp->elts[elt].type, NULL, stream, 0);
988 fprintf_filtered (stream, ")");
991 fputs_filtered (", ", stream);
993 /* Ending LEN and ending TYPE_INSTANCE. */
995 elt = dump_subexp (exp, stream, elt);
1000 case MULTI_SUBSCRIPT:
1001 case OP_F77_UNDETERMINED_ARGLIST:
1010 fprintf_filtered (stream, "Unknown format");
1017 dump_prefix_expression (struct expression *exp, struct ui_file *stream)
1021 fprintf_filtered (stream, "Dump of expression @ ");
1022 gdb_print_host_address (exp, stream);
1023 fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
1024 if (exp->elts[0].opcode != OP_TYPE)
1025 print_expression (exp, stream);
1027 fputs_filtered ("Type printing not yet supported....", stream);
1028 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
1029 exp->language_defn->la_name, exp->nelts,
1030 (long) sizeof (union exp_element));
1031 fputs_filtered ("\n", stream);
1033 for (elt = 0; elt < exp->nelts;)
1034 elt = dump_subexp (exp, stream, elt);
1035 fputs_filtered ("\n", stream);