xref: /dflybsd-src/contrib/gdb-7/gdb/expprint.c (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Print in infix form a struct expression.
25796c8dcSSimon Schubert 
3*ef5ccd6cSJohn Marino    Copyright (C) 1986-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert    This file is part of GDB.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
85796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
95796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
105796c8dcSSimon Schubert    (at your option) any later version.
115796c8dcSSimon Schubert 
125796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
135796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
145796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
155796c8dcSSimon Schubert    GNU General Public License for more details.
165796c8dcSSimon Schubert 
175796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
185796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
195796c8dcSSimon Schubert 
205796c8dcSSimon Schubert #include "defs.h"
215796c8dcSSimon Schubert #include "symtab.h"
225796c8dcSSimon Schubert #include "gdbtypes.h"
235796c8dcSSimon Schubert #include "expression.h"
245796c8dcSSimon Schubert #include "value.h"
255796c8dcSSimon Schubert #include "language.h"
265796c8dcSSimon Schubert #include "parser-defs.h"
275796c8dcSSimon Schubert #include "user-regs.h"		/* For user_reg_map_regnum_to_name.  */
285796c8dcSSimon Schubert #include "target.h"
295796c8dcSSimon Schubert #include "gdb_string.h"
305796c8dcSSimon Schubert #include "block.h"
315796c8dcSSimon Schubert #include "objfiles.h"
325796c8dcSSimon Schubert #include "gdb_assert.h"
335796c8dcSSimon Schubert #include "valprint.h"
345796c8dcSSimon Schubert 
355796c8dcSSimon Schubert #include <ctype.h>
365796c8dcSSimon Schubert 
375796c8dcSSimon Schubert void
print_expression(struct expression * exp,struct ui_file * stream)385796c8dcSSimon Schubert print_expression (struct expression *exp, struct ui_file *stream)
395796c8dcSSimon Schubert {
405796c8dcSSimon Schubert   int pc = 0;
41cf7f2e2dSJohn Marino 
425796c8dcSSimon Schubert   print_subexp (exp, &pc, stream, PREC_NULL);
435796c8dcSSimon Schubert }
445796c8dcSSimon Schubert 
455796c8dcSSimon Schubert /* Print the subexpression of EXP that starts in position POS, on STREAM.
465796c8dcSSimon Schubert    PREC is the precedence of the surrounding operator;
475796c8dcSSimon Schubert    if the precedence of the main operator of this subexpression is less,
485796c8dcSSimon Schubert    parentheses are needed here.  */
495796c8dcSSimon Schubert 
505796c8dcSSimon Schubert void
print_subexp(struct expression * exp,int * pos,struct ui_file * stream,enum precedence prec)515796c8dcSSimon Schubert print_subexp (struct expression *exp, int *pos,
525796c8dcSSimon Schubert 	      struct ui_file *stream, enum precedence prec)
535796c8dcSSimon Schubert {
545796c8dcSSimon Schubert   exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
555796c8dcSSimon Schubert }
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert /* Standard implementation of print_subexp for use in language_defn
585796c8dcSSimon Schubert    vectors.  */
595796c8dcSSimon Schubert void
print_subexp_standard(struct expression * exp,int * pos,struct ui_file * stream,enum precedence prec)605796c8dcSSimon Schubert print_subexp_standard (struct expression *exp, int *pos,
615796c8dcSSimon Schubert 		       struct ui_file *stream, enum precedence prec)
625796c8dcSSimon Schubert {
635796c8dcSSimon Schubert   unsigned tem;
645796c8dcSSimon Schubert   const struct op_print *op_print_tab;
655796c8dcSSimon Schubert   int pc;
665796c8dcSSimon Schubert   unsigned nargs;
675796c8dcSSimon Schubert   char *op_str;
685796c8dcSSimon Schubert   int assign_modify = 0;
695796c8dcSSimon Schubert   enum exp_opcode opcode;
705796c8dcSSimon Schubert   enum precedence myprec = PREC_NULL;
715796c8dcSSimon Schubert   /* Set to 1 for a right-associative operator.  */
725796c8dcSSimon Schubert   int assoc = 0;
735796c8dcSSimon Schubert   struct value *val;
745796c8dcSSimon Schubert   char *tempstr = NULL;
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert   op_print_tab = exp->language_defn->la_op_print_tab;
775796c8dcSSimon Schubert   pc = (*pos)++;
785796c8dcSSimon Schubert   opcode = exp->elts[pc].opcode;
795796c8dcSSimon Schubert   switch (opcode)
805796c8dcSSimon Schubert     {
815796c8dcSSimon Schubert       /* Common ops */
825796c8dcSSimon Schubert 
83*ef5ccd6cSJohn Marino     case OP_TYPE:
84*ef5ccd6cSJohn Marino       (*pos) += 2;
85*ef5ccd6cSJohn Marino       type_print (exp->elts[pc + 1].type, "", stream, 0);
86*ef5ccd6cSJohn Marino       return;
87*ef5ccd6cSJohn Marino 
885796c8dcSSimon Schubert     case OP_SCOPE:
895796c8dcSSimon Schubert       myprec = PREC_PREFIX;
905796c8dcSSimon Schubert       assoc = 0;
915796c8dcSSimon Schubert       fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
925796c8dcSSimon Schubert       fputs_filtered ("::", stream);
935796c8dcSSimon Schubert       nargs = longest_to_int (exp->elts[pc + 2].longconst);
945796c8dcSSimon Schubert       (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
955796c8dcSSimon Schubert       fputs_filtered (&exp->elts[pc + 3].string, stream);
965796c8dcSSimon Schubert       return;
975796c8dcSSimon Schubert 
985796c8dcSSimon Schubert     case OP_LONG:
995796c8dcSSimon Schubert       {
1005796c8dcSSimon Schubert 	struct value_print_options opts;
101cf7f2e2dSJohn Marino 
1025796c8dcSSimon Schubert 	get_raw_print_options (&opts);
1035796c8dcSSimon Schubert 	(*pos) += 3;
1045796c8dcSSimon Schubert 	value_print (value_from_longest (exp->elts[pc + 1].type,
1055796c8dcSSimon Schubert 					 exp->elts[pc + 2].longconst),
1065796c8dcSSimon Schubert 		     stream, &opts);
1075796c8dcSSimon Schubert       }
1085796c8dcSSimon Schubert       return;
1095796c8dcSSimon Schubert 
1105796c8dcSSimon Schubert     case OP_DOUBLE:
1115796c8dcSSimon Schubert       {
1125796c8dcSSimon Schubert 	struct value_print_options opts;
113cf7f2e2dSJohn Marino 
1145796c8dcSSimon Schubert 	get_raw_print_options (&opts);
1155796c8dcSSimon Schubert 	(*pos) += 3;
1165796c8dcSSimon Schubert 	value_print (value_from_double (exp->elts[pc + 1].type,
1175796c8dcSSimon Schubert 					exp->elts[pc + 2].doubleconst),
1185796c8dcSSimon Schubert 		     stream, &opts);
1195796c8dcSSimon Schubert       }
1205796c8dcSSimon Schubert       return;
1215796c8dcSSimon Schubert 
1225796c8dcSSimon Schubert     case OP_VAR_VALUE:
1235796c8dcSSimon Schubert       {
124*ef5ccd6cSJohn Marino 	const struct block *b;
125cf7f2e2dSJohn Marino 
1265796c8dcSSimon Schubert 	(*pos) += 3;
1275796c8dcSSimon Schubert 	b = exp->elts[pc + 1].block;
1285796c8dcSSimon Schubert 	if (b != NULL
1295796c8dcSSimon Schubert 	    && BLOCK_FUNCTION (b) != NULL
1305796c8dcSSimon Schubert 	    && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
1315796c8dcSSimon Schubert 	  {
1325796c8dcSSimon Schubert 	    fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
1335796c8dcSSimon Schubert 	    fputs_filtered ("::", stream);
1345796c8dcSSimon Schubert 	  }
1355796c8dcSSimon Schubert 	fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
1365796c8dcSSimon Schubert       }
1375796c8dcSSimon Schubert       return;
1385796c8dcSSimon Schubert 
139a45ae5f8SJohn Marino     case OP_VAR_ENTRY_VALUE:
140a45ae5f8SJohn Marino       {
141a45ae5f8SJohn Marino 	(*pos) += 2;
142a45ae5f8SJohn Marino 	fprintf_filtered (stream, "%s@entry",
143a45ae5f8SJohn Marino 			  SYMBOL_PRINT_NAME (exp->elts[pc + 1].symbol));
144a45ae5f8SJohn Marino       }
145a45ae5f8SJohn Marino       return;
146a45ae5f8SJohn Marino 
1475796c8dcSSimon Schubert     case OP_LAST:
1485796c8dcSSimon Schubert       (*pos) += 2;
1495796c8dcSSimon Schubert       fprintf_filtered (stream, "$%d",
1505796c8dcSSimon Schubert 			longest_to_int (exp->elts[pc + 1].longconst));
1515796c8dcSSimon Schubert       return;
1525796c8dcSSimon Schubert 
1535796c8dcSSimon Schubert     case OP_REGISTER:
1545796c8dcSSimon Schubert       {
1555796c8dcSSimon Schubert 	const char *name = &exp->elts[pc + 2].string;
156cf7f2e2dSJohn Marino 
1575796c8dcSSimon Schubert 	(*pos) += 3 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
1585796c8dcSSimon Schubert 	fprintf_filtered (stream, "$%s", name);
1595796c8dcSSimon Schubert 	return;
1605796c8dcSSimon Schubert       }
1615796c8dcSSimon Schubert 
1625796c8dcSSimon Schubert     case OP_BOOL:
1635796c8dcSSimon Schubert       (*pos) += 2;
1645796c8dcSSimon Schubert       fprintf_filtered (stream, "%s",
1655796c8dcSSimon Schubert 			longest_to_int (exp->elts[pc + 1].longconst)
1665796c8dcSSimon Schubert 			? "TRUE" : "FALSE");
1675796c8dcSSimon Schubert       return;
1685796c8dcSSimon Schubert 
1695796c8dcSSimon Schubert     case OP_INTERNALVAR:
1705796c8dcSSimon Schubert       (*pos) += 2;
1715796c8dcSSimon Schubert       fprintf_filtered (stream, "$%s",
1725796c8dcSSimon Schubert 			internalvar_name (exp->elts[pc + 1].internalvar));
1735796c8dcSSimon Schubert       return;
1745796c8dcSSimon Schubert 
1755796c8dcSSimon Schubert     case OP_FUNCALL:
1765796c8dcSSimon Schubert       (*pos) += 2;
1775796c8dcSSimon Schubert       nargs = longest_to_int (exp->elts[pc + 1].longconst);
1785796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
1795796c8dcSSimon Schubert       fputs_filtered (" (", stream);
1805796c8dcSSimon Schubert       for (tem = 0; tem < nargs; tem++)
1815796c8dcSSimon Schubert 	{
1825796c8dcSSimon Schubert 	  if (tem != 0)
1835796c8dcSSimon Schubert 	    fputs_filtered (", ", stream);
1845796c8dcSSimon Schubert 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
1855796c8dcSSimon Schubert 	}
1865796c8dcSSimon Schubert       fputs_filtered (")", stream);
1875796c8dcSSimon Schubert       return;
1885796c8dcSSimon Schubert 
1895796c8dcSSimon Schubert     case OP_NAME:
1905796c8dcSSimon Schubert       nargs = longest_to_int (exp->elts[pc + 1].longconst);
1915796c8dcSSimon Schubert       (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
1925796c8dcSSimon Schubert       fputs_filtered (&exp->elts[pc + 2].string, stream);
1935796c8dcSSimon Schubert       return;
1945796c8dcSSimon Schubert 
1955796c8dcSSimon Schubert     case OP_STRING:
1965796c8dcSSimon Schubert       {
1975796c8dcSSimon Schubert 	struct value_print_options opts;
198cf7f2e2dSJohn Marino 
1995796c8dcSSimon Schubert 	nargs = longest_to_int (exp->elts[pc + 1].longconst);
2005796c8dcSSimon Schubert 	(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
2015796c8dcSSimon Schubert 	/* LA_PRINT_STRING will print using the current repeat count threshold.
2025796c8dcSSimon Schubert 	   If necessary, we can temporarily set it to zero, or pass it as an
2035796c8dcSSimon Schubert 	   additional parameter to LA_PRINT_STRING.  -fnf */
2045796c8dcSSimon Schubert 	get_user_print_options (&opts);
2055796c8dcSSimon Schubert 	LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
206*ef5ccd6cSJohn Marino 			 (gdb_byte *) &exp->elts[pc + 2].string, nargs,
207*ef5ccd6cSJohn Marino 			 NULL, 0, &opts);
2085796c8dcSSimon Schubert       }
2095796c8dcSSimon Schubert       return;
2105796c8dcSSimon Schubert 
211c50c785cSJohn Marino     case OP_OBJC_NSSTRING:	/* Objective-C Foundation Class
212c50c785cSJohn Marino 				   NSString constant.  */
2135796c8dcSSimon Schubert       {
2145796c8dcSSimon Schubert 	struct value_print_options opts;
215cf7f2e2dSJohn Marino 
2165796c8dcSSimon Schubert 	nargs = longest_to_int (exp->elts[pc + 1].longconst);
2175796c8dcSSimon Schubert 	(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
2185796c8dcSSimon Schubert 	fputs_filtered ("@\"", stream);
2195796c8dcSSimon Schubert 	get_user_print_options (&opts);
2205796c8dcSSimon Schubert 	LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
221*ef5ccd6cSJohn Marino 			 (gdb_byte *) &exp->elts[pc + 2].string, nargs,
222*ef5ccd6cSJohn Marino 			 NULL, 0, &opts);
2235796c8dcSSimon Schubert 	fputs_filtered ("\"", stream);
2245796c8dcSSimon Schubert       }
2255796c8dcSSimon Schubert       return;
2265796c8dcSSimon Schubert 
2275796c8dcSSimon Schubert     case OP_OBJC_MSGCALL:
2285796c8dcSSimon Schubert       {			/* Objective C message (method) call.  */
2295796c8dcSSimon Schubert 	char *selector;
230cf7f2e2dSJohn Marino 
2315796c8dcSSimon Schubert 	(*pos) += 3;
2325796c8dcSSimon Schubert 	nargs = longest_to_int (exp->elts[pc + 2].longconst);
2335796c8dcSSimon Schubert 	fprintf_unfiltered (stream, "[");
2345796c8dcSSimon Schubert 	print_subexp (exp, pos, stream, PREC_SUFFIX);
2355796c8dcSSimon Schubert 	if (0 == target_read_string (exp->elts[pc + 1].longconst,
2365796c8dcSSimon Schubert 				     &selector, 1024, NULL))
2375796c8dcSSimon Schubert 	  {
2385796c8dcSSimon Schubert 	    error (_("bad selector"));
2395796c8dcSSimon Schubert 	    return;
2405796c8dcSSimon Schubert 	  }
2415796c8dcSSimon Schubert 	if (nargs)
2425796c8dcSSimon Schubert 	  {
2435796c8dcSSimon Schubert 	    char *s, *nextS;
244cf7f2e2dSJohn Marino 
2455796c8dcSSimon Schubert 	    s = alloca (strlen (selector) + 1);
2465796c8dcSSimon Schubert 	    strcpy (s, selector);
2475796c8dcSSimon Schubert 	    for (tem = 0; tem < nargs; tem++)
2485796c8dcSSimon Schubert 	      {
2495796c8dcSSimon Schubert 		nextS = strchr (s, ':');
2505796c8dcSSimon Schubert 		gdb_assert (nextS);	/* Make sure we found ':'.  */
2515796c8dcSSimon Schubert 		*nextS = '\0';
2525796c8dcSSimon Schubert 		fprintf_unfiltered (stream, " %s: ", s);
2535796c8dcSSimon Schubert 		s = nextS + 1;
2545796c8dcSSimon Schubert 		print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
2555796c8dcSSimon Schubert 	      }
2565796c8dcSSimon Schubert 	  }
2575796c8dcSSimon Schubert 	else
2585796c8dcSSimon Schubert 	  {
2595796c8dcSSimon Schubert 	    fprintf_unfiltered (stream, " %s", selector);
2605796c8dcSSimon Schubert 	  }
2615796c8dcSSimon Schubert 	fprintf_unfiltered (stream, "]");
2625796c8dcSSimon Schubert 	/* "selector" was malloc'd by target_read_string.  Free it.  */
2635796c8dcSSimon Schubert 	xfree (selector);
2645796c8dcSSimon Schubert 	return;
2655796c8dcSSimon Schubert       }
2665796c8dcSSimon Schubert 
2675796c8dcSSimon Schubert     case OP_ARRAY:
2685796c8dcSSimon Schubert       (*pos) += 3;
2695796c8dcSSimon Schubert       nargs = longest_to_int (exp->elts[pc + 2].longconst);
2705796c8dcSSimon Schubert       nargs -= longest_to_int (exp->elts[pc + 1].longconst);
2715796c8dcSSimon Schubert       nargs++;
2725796c8dcSSimon Schubert       tem = 0;
2735796c8dcSSimon Schubert       if (exp->elts[pc + 4].opcode == OP_LONG
2745796c8dcSSimon Schubert 	  && exp->elts[pc + 5].type
2755796c8dcSSimon Schubert 	     == builtin_type (exp->gdbarch)->builtin_char
2765796c8dcSSimon Schubert 	  && exp->language_defn->la_language == language_c)
2775796c8dcSSimon Schubert 	{
2785796c8dcSSimon Schubert 	  /* Attempt to print C character arrays using string syntax.
2795796c8dcSSimon Schubert 	     Walk through the args, picking up one character from each
2805796c8dcSSimon Schubert 	     of the OP_LONG expression elements.  If any array element
2815796c8dcSSimon Schubert 	     does not match our expection of what we should find for
2825796c8dcSSimon Schubert 	     a simple string, revert back to array printing.  Note that
2835796c8dcSSimon Schubert 	     the last expression element is an explicit null terminator
2845796c8dcSSimon Schubert 	     byte, which doesn't get printed.  */
2855796c8dcSSimon Schubert 	  tempstr = alloca (nargs);
2865796c8dcSSimon Schubert 	  pc += 4;
2875796c8dcSSimon Schubert 	  while (tem < nargs)
2885796c8dcSSimon Schubert 	    {
2895796c8dcSSimon Schubert 	      if (exp->elts[pc].opcode != OP_LONG
2905796c8dcSSimon Schubert 		  || exp->elts[pc + 1].type
2915796c8dcSSimon Schubert 		     != builtin_type (exp->gdbarch)->builtin_char)
2925796c8dcSSimon Schubert 		{
293c50c785cSJohn Marino 		  /* Not a simple array of char, use regular array
294c50c785cSJohn Marino 		     printing.  */
2955796c8dcSSimon Schubert 		  tem = 0;
2965796c8dcSSimon Schubert 		  break;
2975796c8dcSSimon Schubert 		}
2985796c8dcSSimon Schubert 	      else
2995796c8dcSSimon Schubert 		{
3005796c8dcSSimon Schubert 		  tempstr[tem++] =
3015796c8dcSSimon Schubert 		    longest_to_int (exp->elts[pc + 2].longconst);
3025796c8dcSSimon Schubert 		  pc += 4;
3035796c8dcSSimon Schubert 		}
3045796c8dcSSimon Schubert 	    }
3055796c8dcSSimon Schubert 	}
3065796c8dcSSimon Schubert       if (tem > 0)
3075796c8dcSSimon Schubert 	{
3085796c8dcSSimon Schubert 	  struct value_print_options opts;
309cf7f2e2dSJohn Marino 
3105796c8dcSSimon Schubert 	  get_user_print_options (&opts);
3115796c8dcSSimon Schubert 	  LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
312*ef5ccd6cSJohn Marino 			   (gdb_byte *) tempstr, nargs - 1, NULL, 0, &opts);
3135796c8dcSSimon Schubert 	  (*pos) = pc;
3145796c8dcSSimon Schubert 	}
3155796c8dcSSimon Schubert       else
3165796c8dcSSimon Schubert 	{
3175796c8dcSSimon Schubert 	  fputs_filtered (" {", stream);
3185796c8dcSSimon Schubert 	  for (tem = 0; tem < nargs; tem++)
3195796c8dcSSimon Schubert 	    {
3205796c8dcSSimon Schubert 	      if (tem != 0)
3215796c8dcSSimon Schubert 		{
3225796c8dcSSimon Schubert 		  fputs_filtered (", ", stream);
3235796c8dcSSimon Schubert 		}
3245796c8dcSSimon Schubert 	      print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
3255796c8dcSSimon Schubert 	    }
3265796c8dcSSimon Schubert 	  fputs_filtered ("}", stream);
3275796c8dcSSimon Schubert 	}
3285796c8dcSSimon Schubert       return;
3295796c8dcSSimon Schubert 
3305796c8dcSSimon Schubert     case TERNOP_COND:
3315796c8dcSSimon Schubert       if ((int) prec > (int) PREC_COMMA)
3325796c8dcSSimon Schubert 	fputs_filtered ("(", stream);
3335796c8dcSSimon Schubert       /* Print the subexpressions, forcing parentheses
3345796c8dcSSimon Schubert          around any binary operations within them.
3355796c8dcSSimon Schubert          This is more parentheses than are strictly necessary,
3365796c8dcSSimon Schubert          but it looks clearer.  */
3375796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_HYPER);
3385796c8dcSSimon Schubert       fputs_filtered (" ? ", stream);
3395796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_HYPER);
3405796c8dcSSimon Schubert       fputs_filtered (" : ", stream);
3415796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_HYPER);
3425796c8dcSSimon Schubert       if ((int) prec > (int) PREC_COMMA)
3435796c8dcSSimon Schubert 	fputs_filtered (")", stream);
3445796c8dcSSimon Schubert       return;
3455796c8dcSSimon Schubert 
3465796c8dcSSimon Schubert     case TERNOP_SLICE:
3475796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3485796c8dcSSimon Schubert       fputs_filtered ("(", stream);
3495796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
3505796c8dcSSimon Schubert       fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
3515796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
3525796c8dcSSimon Schubert       fputs_filtered (")", stream);
3535796c8dcSSimon Schubert       return;
3545796c8dcSSimon Schubert 
3555796c8dcSSimon Schubert     case STRUCTOP_STRUCT:
3565796c8dcSSimon Schubert       tem = longest_to_int (exp->elts[pc + 1].longconst);
3575796c8dcSSimon Schubert       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
3585796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3595796c8dcSSimon Schubert       fputs_filtered (".", stream);
3605796c8dcSSimon Schubert       fputs_filtered (&exp->elts[pc + 2].string, stream);
3615796c8dcSSimon Schubert       return;
3625796c8dcSSimon Schubert 
363c50c785cSJohn Marino       /* Will not occur for Modula-2.  */
3645796c8dcSSimon Schubert     case STRUCTOP_PTR:
3655796c8dcSSimon Schubert       tem = longest_to_int (exp->elts[pc + 1].longconst);
3665796c8dcSSimon Schubert       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
3675796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3685796c8dcSSimon Schubert       fputs_filtered ("->", stream);
3695796c8dcSSimon Schubert       fputs_filtered (&exp->elts[pc + 2].string, stream);
3705796c8dcSSimon Schubert       return;
3715796c8dcSSimon Schubert 
3725796c8dcSSimon Schubert     case STRUCTOP_MEMBER:
3735796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3745796c8dcSSimon Schubert       fputs_filtered (".*", stream);
3755796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3765796c8dcSSimon Schubert       return;
3775796c8dcSSimon Schubert 
3785796c8dcSSimon Schubert     case STRUCTOP_MPTR:
3795796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3805796c8dcSSimon Schubert       fputs_filtered ("->*", stream);
3815796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3825796c8dcSSimon Schubert       return;
3835796c8dcSSimon Schubert 
3845796c8dcSSimon Schubert     case BINOP_SUBSCRIPT:
3855796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3865796c8dcSSimon Schubert       fputs_filtered ("[", stream);
3875796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
3885796c8dcSSimon Schubert       fputs_filtered ("]", stream);
3895796c8dcSSimon Schubert       return;
3905796c8dcSSimon Schubert 
3915796c8dcSSimon Schubert     case UNOP_POSTINCREMENT:
3925796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3935796c8dcSSimon Schubert       fputs_filtered ("++", stream);
3945796c8dcSSimon Schubert       return;
3955796c8dcSSimon Schubert 
3965796c8dcSSimon Schubert     case UNOP_POSTDECREMENT:
3975796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
3985796c8dcSSimon Schubert       fputs_filtered ("--", stream);
3995796c8dcSSimon Schubert       return;
4005796c8dcSSimon Schubert 
4015796c8dcSSimon Schubert     case UNOP_CAST:
4025796c8dcSSimon Schubert       (*pos) += 2;
4035796c8dcSSimon Schubert       if ((int) prec > (int) PREC_PREFIX)
4045796c8dcSSimon Schubert 	fputs_filtered ("(", stream);
4055796c8dcSSimon Schubert       fputs_filtered ("(", stream);
4065796c8dcSSimon Schubert       type_print (exp->elts[pc + 1].type, "", stream, 0);
4075796c8dcSSimon Schubert       fputs_filtered (") ", stream);
4085796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_PREFIX);
4095796c8dcSSimon Schubert       if ((int) prec > (int) PREC_PREFIX)
4105796c8dcSSimon Schubert 	fputs_filtered (")", stream);
4115796c8dcSSimon Schubert       return;
4125796c8dcSSimon Schubert 
413*ef5ccd6cSJohn Marino     case UNOP_CAST_TYPE:
414*ef5ccd6cSJohn Marino       if ((int) prec > (int) PREC_PREFIX)
415*ef5ccd6cSJohn Marino 	fputs_filtered ("(", stream);
416*ef5ccd6cSJohn Marino       fputs_filtered ("(", stream);
417*ef5ccd6cSJohn Marino       print_subexp (exp, pos, stream, PREC_PREFIX);
418*ef5ccd6cSJohn Marino       fputs_filtered (") ", stream);
419*ef5ccd6cSJohn Marino       print_subexp (exp, pos, stream, PREC_PREFIX);
420*ef5ccd6cSJohn Marino       if ((int) prec > (int) PREC_PREFIX)
421*ef5ccd6cSJohn Marino 	fputs_filtered (")", stream);
422*ef5ccd6cSJohn Marino       return;
423*ef5ccd6cSJohn Marino 
424cf7f2e2dSJohn Marino     case UNOP_DYNAMIC_CAST:
425cf7f2e2dSJohn Marino     case UNOP_REINTERPRET_CAST:
426cf7f2e2dSJohn Marino       fputs_filtered (opcode == UNOP_DYNAMIC_CAST ? "dynamic_cast"
427cf7f2e2dSJohn Marino 		      : "reinterpret_cast", stream);
428cf7f2e2dSJohn Marino       fputs_filtered ("<", stream);
429*ef5ccd6cSJohn Marino       print_subexp (exp, pos, stream, PREC_PREFIX);
430cf7f2e2dSJohn Marino       fputs_filtered ("> (", stream);
431cf7f2e2dSJohn Marino       print_subexp (exp, pos, stream, PREC_PREFIX);
432cf7f2e2dSJohn Marino       fputs_filtered (")", stream);
433cf7f2e2dSJohn Marino       return;
434cf7f2e2dSJohn Marino 
4355796c8dcSSimon Schubert     case UNOP_MEMVAL:
4365796c8dcSSimon Schubert       (*pos) += 2;
4375796c8dcSSimon Schubert       if ((int) prec > (int) PREC_PREFIX)
4385796c8dcSSimon Schubert 	fputs_filtered ("(", stream);
439cf7f2e2dSJohn Marino       if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC
440cf7f2e2dSJohn Marino 	  && exp->elts[pc + 3].opcode == OP_LONG)
4415796c8dcSSimon Schubert 	{
4425796c8dcSSimon Schubert 	  struct value_print_options opts;
4435796c8dcSSimon Schubert 
4445796c8dcSSimon Schubert 	  /* We have a minimal symbol fn, probably.  It's encoded
4455796c8dcSSimon Schubert 	     as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
4465796c8dcSSimon Schubert 	     Swallow the OP_LONG (including both its opcodes); ignore
4475796c8dcSSimon Schubert 	     its type; print the value in the type of the MEMVAL.  */
4485796c8dcSSimon Schubert 	  (*pos) += 4;
4495796c8dcSSimon Schubert 	  val = value_at_lazy (exp->elts[pc + 1].type,
4505796c8dcSSimon Schubert 			       (CORE_ADDR) exp->elts[pc + 5].longconst);
4515796c8dcSSimon Schubert 	  get_raw_print_options (&opts);
4525796c8dcSSimon Schubert 	  value_print (val, stream, &opts);
4535796c8dcSSimon Schubert 	}
4545796c8dcSSimon Schubert       else
4555796c8dcSSimon Schubert 	{
4565796c8dcSSimon Schubert 	  fputs_filtered ("{", stream);
4575796c8dcSSimon Schubert 	  type_print (exp->elts[pc + 1].type, "", stream, 0);
4585796c8dcSSimon Schubert 	  fputs_filtered ("} ", stream);
4595796c8dcSSimon Schubert 	  print_subexp (exp, pos, stream, PREC_PREFIX);
4605796c8dcSSimon Schubert 	}
4615796c8dcSSimon Schubert       if ((int) prec > (int) PREC_PREFIX)
4625796c8dcSSimon Schubert 	fputs_filtered (")", stream);
4635796c8dcSSimon Schubert       return;
4645796c8dcSSimon Schubert 
465*ef5ccd6cSJohn Marino     case UNOP_MEMVAL_TYPE:
466*ef5ccd6cSJohn Marino       if ((int) prec > (int) PREC_PREFIX)
467*ef5ccd6cSJohn Marino 	fputs_filtered ("(", stream);
468*ef5ccd6cSJohn Marino       fputs_filtered ("{", stream);
469*ef5ccd6cSJohn Marino       print_subexp (exp, pos, stream, PREC_PREFIX);
470*ef5ccd6cSJohn Marino       fputs_filtered ("} ", stream);
471*ef5ccd6cSJohn Marino       print_subexp (exp, pos, stream, PREC_PREFIX);
472*ef5ccd6cSJohn Marino       if ((int) prec > (int) PREC_PREFIX)
473*ef5ccd6cSJohn Marino 	fputs_filtered (")", stream);
474*ef5ccd6cSJohn Marino       return;
475*ef5ccd6cSJohn Marino 
4765796c8dcSSimon Schubert     case UNOP_MEMVAL_TLS:
4775796c8dcSSimon Schubert       (*pos) += 3;
4785796c8dcSSimon Schubert       if ((int) prec > (int) PREC_PREFIX)
4795796c8dcSSimon Schubert 	fputs_filtered ("(", stream);
4805796c8dcSSimon Schubert       fputs_filtered ("{", stream);
4815796c8dcSSimon Schubert       type_print (exp->elts[pc + 2].type, "", stream, 0);
4825796c8dcSSimon Schubert       fputs_filtered ("} ", stream);
4835796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_PREFIX);
4845796c8dcSSimon Schubert       if ((int) prec > (int) PREC_PREFIX)
4855796c8dcSSimon Schubert 	fputs_filtered (")", stream);
4865796c8dcSSimon Schubert       return;
4875796c8dcSSimon Schubert 
4885796c8dcSSimon Schubert     case BINOP_ASSIGN_MODIFY:
4895796c8dcSSimon Schubert       opcode = exp->elts[pc + 1].opcode;
4905796c8dcSSimon Schubert       (*pos) += 2;
4915796c8dcSSimon Schubert       myprec = PREC_ASSIGN;
4925796c8dcSSimon Schubert       assoc = 1;
4935796c8dcSSimon Schubert       assign_modify = 1;
4945796c8dcSSimon Schubert       op_str = "???";
4955796c8dcSSimon Schubert       for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
4965796c8dcSSimon Schubert 	if (op_print_tab[tem].opcode == opcode)
4975796c8dcSSimon Schubert 	  {
4985796c8dcSSimon Schubert 	    op_str = op_print_tab[tem].string;
4995796c8dcSSimon Schubert 	    break;
5005796c8dcSSimon Schubert 	  }
5015796c8dcSSimon Schubert       if (op_print_tab[tem].opcode != opcode)
5025796c8dcSSimon Schubert 	/* Not found; don't try to keep going because we don't know how
5035796c8dcSSimon Schubert 	   to interpret further elements.  */
5045796c8dcSSimon Schubert 	error (_("Invalid expression"));
5055796c8dcSSimon Schubert       break;
5065796c8dcSSimon Schubert 
5075796c8dcSSimon Schubert       /* C++ ops */
5085796c8dcSSimon Schubert 
5095796c8dcSSimon Schubert     case OP_THIS:
5105796c8dcSSimon Schubert       ++(*pos);
511a45ae5f8SJohn Marino       if (exp->language_defn->la_name_of_this)
512a45ae5f8SJohn Marino 	fputs_filtered (exp->language_defn->la_name_of_this, stream);
513a45ae5f8SJohn Marino       else
514a45ae5f8SJohn Marino 	fprintf_filtered (stream, _("<language %s has no 'this'>"),
515a45ae5f8SJohn Marino 			  exp->language_defn->la_name);
5165796c8dcSSimon Schubert       return;
5175796c8dcSSimon Schubert 
5185796c8dcSSimon Schubert       /* Modula-2 ops */
5195796c8dcSSimon Schubert 
5205796c8dcSSimon Schubert     case MULTI_SUBSCRIPT:
5215796c8dcSSimon Schubert       (*pos) += 2;
5225796c8dcSSimon Schubert       nargs = longest_to_int (exp->elts[pc + 1].longconst);
5235796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_SUFFIX);
5245796c8dcSSimon Schubert       fprintf_unfiltered (stream, " [");
5255796c8dcSSimon Schubert       for (tem = 0; tem < nargs; tem++)
5265796c8dcSSimon Schubert 	{
5275796c8dcSSimon Schubert 	  if (tem != 0)
5285796c8dcSSimon Schubert 	    fprintf_unfiltered (stream, ", ");
5295796c8dcSSimon Schubert 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
5305796c8dcSSimon Schubert 	}
5315796c8dcSSimon Schubert       fprintf_unfiltered (stream, "]");
5325796c8dcSSimon Schubert       return;
5335796c8dcSSimon Schubert 
5345796c8dcSSimon Schubert     case BINOP_VAL:
5355796c8dcSSimon Schubert       (*pos) += 2;
5365796c8dcSSimon Schubert       fprintf_unfiltered (stream, "VAL(");
5375796c8dcSSimon Schubert       type_print (exp->elts[pc + 1].type, "", stream, 0);
5385796c8dcSSimon Schubert       fprintf_unfiltered (stream, ",");
5395796c8dcSSimon Schubert       print_subexp (exp, pos, stream, PREC_PREFIX);
5405796c8dcSSimon Schubert       fprintf_unfiltered (stream, ")");
5415796c8dcSSimon Schubert       return;
5425796c8dcSSimon Schubert 
543c50c785cSJohn Marino     case TYPE_INSTANCE:
544c50c785cSJohn Marino       {
545c50c785cSJohn Marino 	LONGEST count = exp->elts[pc + 1].longconst;
546c50c785cSJohn Marino 
547c50c785cSJohn Marino 	/* The COUNT.  */
548c50c785cSJohn Marino 	(*pos)++;
549c50c785cSJohn Marino 	fputs_unfiltered ("TypesInstance(", stream);
550c50c785cSJohn Marino 	while (count-- > 0)
551c50c785cSJohn Marino 	  {
552c50c785cSJohn Marino 	    type_print (exp->elts[(*pos)++].type, "", stream, 0);
553c50c785cSJohn Marino 	    if (count > 0)
554c50c785cSJohn Marino 	      fputs_unfiltered (",", stream);
555c50c785cSJohn Marino 	  }
556c50c785cSJohn Marino 	fputs_unfiltered (",", stream);
557c50c785cSJohn Marino 	/* Ending COUNT and ending TYPE_INSTANCE.  */
558c50c785cSJohn Marino 	(*pos) += 2;
559c50c785cSJohn Marino 	print_subexp (exp, pos, stream, PREC_PREFIX);
560c50c785cSJohn Marino 	fputs_unfiltered (")", stream);
561c50c785cSJohn Marino 	return;
562c50c785cSJohn Marino       }
563c50c785cSJohn Marino 
5645796c8dcSSimon Schubert       /* Default ops */
5655796c8dcSSimon Schubert 
5665796c8dcSSimon Schubert     default:
5675796c8dcSSimon Schubert       op_str = "???";
5685796c8dcSSimon Schubert       for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
5695796c8dcSSimon Schubert 	if (op_print_tab[tem].opcode == opcode)
5705796c8dcSSimon Schubert 	  {
5715796c8dcSSimon Schubert 	    op_str = op_print_tab[tem].string;
5725796c8dcSSimon Schubert 	    myprec = op_print_tab[tem].precedence;
5735796c8dcSSimon Schubert 	    assoc = op_print_tab[tem].right_assoc;
5745796c8dcSSimon Schubert 	    break;
5755796c8dcSSimon Schubert 	  }
5765796c8dcSSimon Schubert       if (op_print_tab[tem].opcode != opcode)
5775796c8dcSSimon Schubert 	/* Not found; don't try to keep going because we don't know how
5785796c8dcSSimon Schubert 	   to interpret further elements.  For example, this happens
5795796c8dcSSimon Schubert 	   if opcode is OP_TYPE.  */
5805796c8dcSSimon Schubert 	error (_("Invalid expression"));
5815796c8dcSSimon Schubert     }
5825796c8dcSSimon Schubert 
5835796c8dcSSimon Schubert   /* Note that PREC_BUILTIN will always emit parentheses.  */
5845796c8dcSSimon Schubert   if ((int) myprec < (int) prec)
5855796c8dcSSimon Schubert     fputs_filtered ("(", stream);
5865796c8dcSSimon Schubert   if ((int) opcode > (int) BINOP_END)
5875796c8dcSSimon Schubert     {
5885796c8dcSSimon Schubert       if (assoc)
5895796c8dcSSimon Schubert 	{
5905796c8dcSSimon Schubert 	  /* Unary postfix operator.  */
5915796c8dcSSimon Schubert 	  print_subexp (exp, pos, stream, PREC_SUFFIX);
5925796c8dcSSimon Schubert 	  fputs_filtered (op_str, stream);
5935796c8dcSSimon Schubert 	}
5945796c8dcSSimon Schubert       else
5955796c8dcSSimon Schubert 	{
5965796c8dcSSimon Schubert 	  /* Unary prefix operator.  */
5975796c8dcSSimon Schubert 	  fputs_filtered (op_str, stream);
5985796c8dcSSimon Schubert 	  if (myprec == PREC_BUILTIN_FUNCTION)
5995796c8dcSSimon Schubert 	    fputs_filtered ("(", stream);
6005796c8dcSSimon Schubert 	  print_subexp (exp, pos, stream, PREC_PREFIX);
6015796c8dcSSimon Schubert 	  if (myprec == PREC_BUILTIN_FUNCTION)
6025796c8dcSSimon Schubert 	    fputs_filtered (")", stream);
6035796c8dcSSimon Schubert 	}
6045796c8dcSSimon Schubert     }
6055796c8dcSSimon Schubert   else
6065796c8dcSSimon Schubert     {
6075796c8dcSSimon Schubert       /* Binary operator.  */
6085796c8dcSSimon Schubert       /* Print left operand.
6095796c8dcSSimon Schubert          If operator is right-associative,
6105796c8dcSSimon Schubert          increment precedence for this operand.  */
6115796c8dcSSimon Schubert       print_subexp (exp, pos, stream,
6125796c8dcSSimon Schubert 		    (enum precedence) ((int) myprec + assoc));
6135796c8dcSSimon Schubert       /* Print the operator itself.  */
6145796c8dcSSimon Schubert       if (assign_modify)
6155796c8dcSSimon Schubert 	fprintf_filtered (stream, " %s= ", op_str);
6165796c8dcSSimon Schubert       else if (op_str[0] == ',')
6175796c8dcSSimon Schubert 	fprintf_filtered (stream, "%s ", op_str);
6185796c8dcSSimon Schubert       else
6195796c8dcSSimon Schubert 	fprintf_filtered (stream, " %s ", op_str);
6205796c8dcSSimon Schubert       /* Print right operand.
6215796c8dcSSimon Schubert          If operator is left-associative,
6225796c8dcSSimon Schubert          increment precedence for this operand.  */
6235796c8dcSSimon Schubert       print_subexp (exp, pos, stream,
6245796c8dcSSimon Schubert 		    (enum precedence) ((int) myprec + !assoc));
6255796c8dcSSimon Schubert     }
6265796c8dcSSimon Schubert 
6275796c8dcSSimon Schubert   if ((int) myprec < (int) prec)
6285796c8dcSSimon Schubert     fputs_filtered (")", stream);
6295796c8dcSSimon Schubert }
6305796c8dcSSimon Schubert 
6315796c8dcSSimon Schubert /* Return the operator corresponding to opcode OP as
6325796c8dcSSimon Schubert    a string.   NULL indicates that the opcode was not found in the
6335796c8dcSSimon Schubert    current language table.  */
6345796c8dcSSimon Schubert char *
op_string(enum exp_opcode op)6355796c8dcSSimon Schubert op_string (enum exp_opcode op)
6365796c8dcSSimon Schubert {
6375796c8dcSSimon Schubert   int tem;
6385796c8dcSSimon Schubert   const struct op_print *op_print_tab;
6395796c8dcSSimon Schubert 
6405796c8dcSSimon Schubert   op_print_tab = current_language->la_op_print_tab;
6415796c8dcSSimon Schubert   for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
6425796c8dcSSimon Schubert     if (op_print_tab[tem].opcode == op)
6435796c8dcSSimon Schubert       return op_print_tab[tem].string;
6445796c8dcSSimon Schubert   return NULL;
6455796c8dcSSimon Schubert }
6465796c8dcSSimon Schubert 
6475796c8dcSSimon Schubert /* Support for dumping the raw data from expressions in a human readable
6485796c8dcSSimon Schubert    form.  */
6495796c8dcSSimon Schubert 
6505796c8dcSSimon Schubert static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
6515796c8dcSSimon Schubert 
6525796c8dcSSimon Schubert /* Name for OPCODE, when it appears in expression EXP.  */
6535796c8dcSSimon Schubert 
654*ef5ccd6cSJohn Marino char *
op_name(struct expression * exp,enum exp_opcode opcode)6555796c8dcSSimon Schubert op_name (struct expression *exp, enum exp_opcode opcode)
6565796c8dcSSimon Schubert {
6575796c8dcSSimon Schubert   return exp->language_defn->la_exp_desc->op_name (opcode);
6585796c8dcSSimon Schubert }
6595796c8dcSSimon Schubert 
6605796c8dcSSimon Schubert /* Default name for the standard operator OPCODE (i.e., one defined in
6615796c8dcSSimon Schubert    the definition of enum exp_opcode).  */
6625796c8dcSSimon Schubert 
6635796c8dcSSimon Schubert char *
op_name_standard(enum exp_opcode opcode)6645796c8dcSSimon Schubert op_name_standard (enum exp_opcode opcode)
6655796c8dcSSimon Schubert {
6665796c8dcSSimon Schubert   switch (opcode)
6675796c8dcSSimon Schubert     {
6685796c8dcSSimon Schubert     default:
6695796c8dcSSimon Schubert       {
6705796c8dcSSimon Schubert 	static char buf[30];
6715796c8dcSSimon Schubert 
672*ef5ccd6cSJohn Marino 	xsnprintf (buf, sizeof (buf), "<unknown %d>", opcode);
6735796c8dcSSimon Schubert 	return buf;
6745796c8dcSSimon Schubert       }
675c50c785cSJohn Marino #define OP(name)	\
676c50c785cSJohn Marino     case name:		\
677c50c785cSJohn Marino       return #name ;
678c50c785cSJohn Marino #include "std-operator.def"
679c50c785cSJohn Marino #undef OP
6805796c8dcSSimon Schubert     }
6815796c8dcSSimon Schubert }
6825796c8dcSSimon Schubert 
6835796c8dcSSimon Schubert /* Print a raw dump of expression EXP to STREAM.
6845796c8dcSSimon Schubert    NOTE, if non-NULL, is printed as extra explanatory text.  */
6855796c8dcSSimon Schubert 
6865796c8dcSSimon Schubert void
dump_raw_expression(struct expression * exp,struct ui_file * stream,char * note)6875796c8dcSSimon Schubert dump_raw_expression (struct expression *exp, struct ui_file *stream,
6885796c8dcSSimon Schubert 		     char *note)
6895796c8dcSSimon Schubert {
6905796c8dcSSimon Schubert   int elt;
6915796c8dcSSimon Schubert   char *opcode_name;
6925796c8dcSSimon Schubert   char *eltscan;
6935796c8dcSSimon Schubert   int eltsize;
6945796c8dcSSimon Schubert 
6955796c8dcSSimon Schubert   fprintf_filtered (stream, "Dump of expression @ ");
6965796c8dcSSimon Schubert   gdb_print_host_address (exp, stream);
6975796c8dcSSimon Schubert   if (note)
6985796c8dcSSimon Schubert     fprintf_filtered (stream, ", %s:", note);
6995796c8dcSSimon Schubert   fprintf_filtered (stream, "\n\tLanguage %s, %d elements, %ld bytes each.\n",
7005796c8dcSSimon Schubert 		    exp->language_defn->la_name, exp->nelts,
7015796c8dcSSimon Schubert 		    (long) sizeof (union exp_element));
7025796c8dcSSimon Schubert   fprintf_filtered (stream, "\t%5s  %20s  %16s  %s\n", "Index", "Opcode",
7035796c8dcSSimon Schubert 		    "Hex Value", "String Value");
7045796c8dcSSimon Schubert   for (elt = 0; elt < exp->nelts; elt++)
7055796c8dcSSimon Schubert     {
7065796c8dcSSimon Schubert       fprintf_filtered (stream, "\t%5d  ", elt);
7075796c8dcSSimon Schubert       opcode_name = op_name (exp, exp->elts[elt].opcode);
7085796c8dcSSimon Schubert 
7095796c8dcSSimon Schubert       fprintf_filtered (stream, "%20s  ", opcode_name);
7105796c8dcSSimon Schubert       print_longest (stream, 'd', 0, exp->elts[elt].longconst);
7115796c8dcSSimon Schubert       fprintf_filtered (stream, "  ");
7125796c8dcSSimon Schubert 
7135796c8dcSSimon Schubert       for (eltscan = (char *) &exp->elts[elt],
7145796c8dcSSimon Schubert 	   eltsize = sizeof (union exp_element);
7155796c8dcSSimon Schubert 	   eltsize-- > 0;
7165796c8dcSSimon Schubert 	   eltscan++)
7175796c8dcSSimon Schubert 	{
7185796c8dcSSimon Schubert 	  fprintf_filtered (stream, "%c",
7195796c8dcSSimon Schubert 			    isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
7205796c8dcSSimon Schubert 	}
7215796c8dcSSimon Schubert       fprintf_filtered (stream, "\n");
7225796c8dcSSimon Schubert     }
7235796c8dcSSimon Schubert }
7245796c8dcSSimon Schubert 
7255796c8dcSSimon Schubert /* Dump the subexpression of prefix expression EXP whose operator is at
7265796c8dcSSimon Schubert    position ELT onto STREAM.  Returns the position of the next
7275796c8dcSSimon Schubert    subexpression in EXP.  */
7285796c8dcSSimon Schubert 
7295796c8dcSSimon Schubert int
dump_subexp(struct expression * exp,struct ui_file * stream,int elt)7305796c8dcSSimon Schubert dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
7315796c8dcSSimon Schubert {
7325796c8dcSSimon Schubert   static int indent = 0;
7335796c8dcSSimon Schubert   int i;
7345796c8dcSSimon Schubert 
7355796c8dcSSimon Schubert   fprintf_filtered (stream, "\n");
7365796c8dcSSimon Schubert   fprintf_filtered (stream, "\t%5d  ", elt);
7375796c8dcSSimon Schubert 
7385796c8dcSSimon Schubert   for (i = 1; i <= indent; i++)
7395796c8dcSSimon Schubert     fprintf_filtered (stream, " ");
7405796c8dcSSimon Schubert   indent += 2;
7415796c8dcSSimon Schubert 
7425796c8dcSSimon Schubert   fprintf_filtered (stream, "%-20s  ", op_name (exp, exp->elts[elt].opcode));
7435796c8dcSSimon Schubert 
7445796c8dcSSimon Schubert   elt = dump_subexp_body (exp, stream, elt);
7455796c8dcSSimon Schubert 
7465796c8dcSSimon Schubert   indent -= 2;
7475796c8dcSSimon Schubert 
7485796c8dcSSimon Schubert   return elt;
7495796c8dcSSimon Schubert }
7505796c8dcSSimon Schubert 
7515796c8dcSSimon Schubert /* Dump the operands of prefix expression EXP whose opcode is at
7525796c8dcSSimon Schubert    position ELT onto STREAM.  Returns the position of the next
7535796c8dcSSimon Schubert    subexpression in EXP.  */
7545796c8dcSSimon Schubert 
7555796c8dcSSimon Schubert static int
dump_subexp_body(struct expression * exp,struct ui_file * stream,int elt)7565796c8dcSSimon Schubert dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
7575796c8dcSSimon Schubert {
7585796c8dcSSimon Schubert   return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
7595796c8dcSSimon Schubert }
7605796c8dcSSimon Schubert 
7615796c8dcSSimon Schubert /* Default value for subexp_body in exp_descriptor vector.  */
7625796c8dcSSimon Schubert 
7635796c8dcSSimon Schubert int
dump_subexp_body_standard(struct expression * exp,struct ui_file * stream,int elt)7645796c8dcSSimon Schubert dump_subexp_body_standard (struct expression *exp,
7655796c8dcSSimon Schubert 			   struct ui_file *stream, int elt)
7665796c8dcSSimon Schubert {
7675796c8dcSSimon Schubert   int opcode = exp->elts[elt++].opcode;
7685796c8dcSSimon Schubert 
7695796c8dcSSimon Schubert   switch (opcode)
7705796c8dcSSimon Schubert     {
7715796c8dcSSimon Schubert     case TERNOP_COND:
7725796c8dcSSimon Schubert     case TERNOP_SLICE:
7735796c8dcSSimon Schubert       elt = dump_subexp (exp, stream, elt);
774c50c785cSJohn Marino       /* FALL THROUGH */
7755796c8dcSSimon Schubert     case BINOP_ADD:
7765796c8dcSSimon Schubert     case BINOP_SUB:
7775796c8dcSSimon Schubert     case BINOP_MUL:
7785796c8dcSSimon Schubert     case BINOP_DIV:
7795796c8dcSSimon Schubert     case BINOP_REM:
7805796c8dcSSimon Schubert     case BINOP_MOD:
7815796c8dcSSimon Schubert     case BINOP_LSH:
7825796c8dcSSimon Schubert     case BINOP_RSH:
7835796c8dcSSimon Schubert     case BINOP_LOGICAL_AND:
7845796c8dcSSimon Schubert     case BINOP_LOGICAL_OR:
7855796c8dcSSimon Schubert     case BINOP_BITWISE_AND:
7865796c8dcSSimon Schubert     case BINOP_BITWISE_IOR:
7875796c8dcSSimon Schubert     case BINOP_BITWISE_XOR:
7885796c8dcSSimon Schubert     case BINOP_EQUAL:
7895796c8dcSSimon Schubert     case BINOP_NOTEQUAL:
7905796c8dcSSimon Schubert     case BINOP_LESS:
7915796c8dcSSimon Schubert     case BINOP_GTR:
7925796c8dcSSimon Schubert     case BINOP_LEQ:
7935796c8dcSSimon Schubert     case BINOP_GEQ:
7945796c8dcSSimon Schubert     case BINOP_REPEAT:
7955796c8dcSSimon Schubert     case BINOP_ASSIGN:
7965796c8dcSSimon Schubert     case BINOP_COMMA:
7975796c8dcSSimon Schubert     case BINOP_SUBSCRIPT:
7985796c8dcSSimon Schubert     case BINOP_EXP:
7995796c8dcSSimon Schubert     case BINOP_MIN:
8005796c8dcSSimon Schubert     case BINOP_MAX:
8015796c8dcSSimon Schubert     case BINOP_INTDIV:
8025796c8dcSSimon Schubert     case BINOP_ASSIGN_MODIFY:
8035796c8dcSSimon Schubert     case BINOP_VAL:
8045796c8dcSSimon Schubert     case BINOP_CONCAT:
8055796c8dcSSimon Schubert     case BINOP_IN:
8065796c8dcSSimon Schubert     case BINOP_RANGE:
8075796c8dcSSimon Schubert     case BINOP_END:
8085796c8dcSSimon Schubert     case STRUCTOP_MEMBER:
8095796c8dcSSimon Schubert     case STRUCTOP_MPTR:
8105796c8dcSSimon Schubert       elt = dump_subexp (exp, stream, elt);
811c50c785cSJohn Marino       /* FALL THROUGH */
8125796c8dcSSimon Schubert     case UNOP_NEG:
8135796c8dcSSimon Schubert     case UNOP_LOGICAL_NOT:
8145796c8dcSSimon Schubert     case UNOP_COMPLEMENT:
8155796c8dcSSimon Schubert     case UNOP_IND:
8165796c8dcSSimon Schubert     case UNOP_ADDR:
8175796c8dcSSimon Schubert     case UNOP_PREINCREMENT:
8185796c8dcSSimon Schubert     case UNOP_POSTINCREMENT:
8195796c8dcSSimon Schubert     case UNOP_PREDECREMENT:
8205796c8dcSSimon Schubert     case UNOP_POSTDECREMENT:
8215796c8dcSSimon Schubert     case UNOP_SIZEOF:
8225796c8dcSSimon Schubert     case UNOP_PLUS:
8235796c8dcSSimon Schubert     case UNOP_CAP:
8245796c8dcSSimon Schubert     case UNOP_CHR:
8255796c8dcSSimon Schubert     case UNOP_ORD:
8265796c8dcSSimon Schubert     case UNOP_ABS:
8275796c8dcSSimon Schubert     case UNOP_FLOAT:
8285796c8dcSSimon Schubert     case UNOP_HIGH:
8295796c8dcSSimon Schubert     case UNOP_MAX:
8305796c8dcSSimon Schubert     case UNOP_MIN:
8315796c8dcSSimon Schubert     case UNOP_ODD:
8325796c8dcSSimon Schubert     case UNOP_TRUNC:
8335796c8dcSSimon Schubert       elt = dump_subexp (exp, stream, elt);
8345796c8dcSSimon Schubert       break;
8355796c8dcSSimon Schubert     case OP_LONG:
8365796c8dcSSimon Schubert       fprintf_filtered (stream, "Type @");
8375796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt].type, stream);
8385796c8dcSSimon Schubert       fprintf_filtered (stream, " (");
8395796c8dcSSimon Schubert       type_print (exp->elts[elt].type, NULL, stream, 0);
8405796c8dcSSimon Schubert       fprintf_filtered (stream, "), value %ld (0x%lx)",
8415796c8dcSSimon Schubert 			(long) exp->elts[elt + 1].longconst,
8425796c8dcSSimon Schubert 			(long) exp->elts[elt + 1].longconst);
8435796c8dcSSimon Schubert       elt += 3;
8445796c8dcSSimon Schubert       break;
8455796c8dcSSimon Schubert     case OP_DOUBLE:
8465796c8dcSSimon Schubert       fprintf_filtered (stream, "Type @");
8475796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt].type, stream);
8485796c8dcSSimon Schubert       fprintf_filtered (stream, " (");
8495796c8dcSSimon Schubert       type_print (exp->elts[elt].type, NULL, stream, 0);
8505796c8dcSSimon Schubert       fprintf_filtered (stream, "), value %g",
8515796c8dcSSimon Schubert 			(double) exp->elts[elt + 1].doubleconst);
8525796c8dcSSimon Schubert       elt += 3;
8535796c8dcSSimon Schubert       break;
8545796c8dcSSimon Schubert     case OP_VAR_VALUE:
8555796c8dcSSimon Schubert       fprintf_filtered (stream, "Block @");
8565796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt].block, stream);
8575796c8dcSSimon Schubert       fprintf_filtered (stream, ", symbol @");
8585796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
8595796c8dcSSimon Schubert       fprintf_filtered (stream, " (%s)",
8605796c8dcSSimon Schubert 			SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol));
8615796c8dcSSimon Schubert       elt += 3;
8625796c8dcSSimon Schubert       break;
863a45ae5f8SJohn Marino     case OP_VAR_ENTRY_VALUE:
864a45ae5f8SJohn Marino       fprintf_filtered (stream, "Entry value of symbol @");
865a45ae5f8SJohn Marino       gdb_print_host_address (exp->elts[elt].symbol, stream);
866a45ae5f8SJohn Marino       fprintf_filtered (stream, " (%s)",
867a45ae5f8SJohn Marino 			SYMBOL_PRINT_NAME (exp->elts[elt].symbol));
868a45ae5f8SJohn Marino       elt += 2;
869a45ae5f8SJohn Marino       break;
8705796c8dcSSimon Schubert     case OP_LAST:
8715796c8dcSSimon Schubert       fprintf_filtered (stream, "History element %ld",
8725796c8dcSSimon Schubert 			(long) exp->elts[elt].longconst);
8735796c8dcSSimon Schubert       elt += 2;
8745796c8dcSSimon Schubert       break;
8755796c8dcSSimon Schubert     case OP_REGISTER:
8765796c8dcSSimon Schubert       fprintf_filtered (stream, "Register $%s", &exp->elts[elt + 1].string);
8775796c8dcSSimon Schubert       elt += 3 + BYTES_TO_EXP_ELEM (exp->elts[elt].longconst + 1);
8785796c8dcSSimon Schubert       break;
8795796c8dcSSimon Schubert     case OP_INTERNALVAR:
8805796c8dcSSimon Schubert       fprintf_filtered (stream, "Internal var @");
8815796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt].internalvar, stream);
8825796c8dcSSimon Schubert       fprintf_filtered (stream, " (%s)",
8835796c8dcSSimon Schubert 			internalvar_name (exp->elts[elt].internalvar));
8845796c8dcSSimon Schubert       elt += 2;
8855796c8dcSSimon Schubert       break;
8865796c8dcSSimon Schubert     case OP_FUNCALL:
8875796c8dcSSimon Schubert       {
8885796c8dcSSimon Schubert 	int i, nargs;
8895796c8dcSSimon Schubert 
8905796c8dcSSimon Schubert 	nargs = longest_to_int (exp->elts[elt].longconst);
8915796c8dcSSimon Schubert 
8925796c8dcSSimon Schubert 	fprintf_filtered (stream, "Number of args: %d", nargs);
8935796c8dcSSimon Schubert 	elt += 2;
8945796c8dcSSimon Schubert 
8955796c8dcSSimon Schubert 	for (i = 1; i <= nargs + 1; i++)
8965796c8dcSSimon Schubert 	  elt = dump_subexp (exp, stream, elt);
8975796c8dcSSimon Schubert       }
8985796c8dcSSimon Schubert       break;
8995796c8dcSSimon Schubert     case OP_ARRAY:
9005796c8dcSSimon Schubert       {
9015796c8dcSSimon Schubert 	int lower, upper;
9025796c8dcSSimon Schubert 	int i;
9035796c8dcSSimon Schubert 
9045796c8dcSSimon Schubert 	lower = longest_to_int (exp->elts[elt].longconst);
9055796c8dcSSimon Schubert 	upper = longest_to_int (exp->elts[elt + 1].longconst);
9065796c8dcSSimon Schubert 
9075796c8dcSSimon Schubert 	fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
9085796c8dcSSimon Schubert 	elt += 3;
9095796c8dcSSimon Schubert 
9105796c8dcSSimon Schubert 	for (i = 1; i <= upper - lower + 1; i++)
9115796c8dcSSimon Schubert 	  elt = dump_subexp (exp, stream, elt);
9125796c8dcSSimon Schubert       }
9135796c8dcSSimon Schubert       break;
914cf7f2e2dSJohn Marino     case UNOP_DYNAMIC_CAST:
915cf7f2e2dSJohn Marino     case UNOP_REINTERPRET_CAST:
916*ef5ccd6cSJohn Marino     case UNOP_CAST_TYPE:
917*ef5ccd6cSJohn Marino     case UNOP_MEMVAL_TYPE:
918*ef5ccd6cSJohn Marino       fprintf_filtered (stream, " (");
919*ef5ccd6cSJohn Marino       elt = dump_subexp (exp, stream, elt);
920*ef5ccd6cSJohn Marino       fprintf_filtered (stream, ")");
921*ef5ccd6cSJohn Marino       elt = dump_subexp (exp, stream, elt);
922*ef5ccd6cSJohn Marino       break;
923*ef5ccd6cSJohn Marino     case UNOP_MEMVAL:
924*ef5ccd6cSJohn Marino     case UNOP_CAST:
9255796c8dcSSimon Schubert       fprintf_filtered (stream, "Type @");
9265796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt].type, stream);
9275796c8dcSSimon Schubert       fprintf_filtered (stream, " (");
9285796c8dcSSimon Schubert       type_print (exp->elts[elt].type, NULL, stream, 0);
9295796c8dcSSimon Schubert       fprintf_filtered (stream, ")");
9305796c8dcSSimon Schubert       elt = dump_subexp (exp, stream, elt + 2);
9315796c8dcSSimon Schubert       break;
9325796c8dcSSimon Schubert     case UNOP_MEMVAL_TLS:
9335796c8dcSSimon Schubert       fprintf_filtered (stream, "TLS type @");
9345796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt + 1].type, stream);
9355796c8dcSSimon Schubert       fprintf_filtered (stream, " (__thread /* \"%s\" */ ",
9365796c8dcSSimon Schubert                         (exp->elts[elt].objfile == NULL ? "(null)"
9375796c8dcSSimon Schubert 			 : exp->elts[elt].objfile->name));
9385796c8dcSSimon Schubert       type_print (exp->elts[elt + 1].type, NULL, stream, 0);
9395796c8dcSSimon Schubert       fprintf_filtered (stream, ")");
9405796c8dcSSimon Schubert       elt = dump_subexp (exp, stream, elt + 3);
9415796c8dcSSimon Schubert       break;
9425796c8dcSSimon Schubert     case OP_TYPE:
9435796c8dcSSimon Schubert       fprintf_filtered (stream, "Type @");
9445796c8dcSSimon Schubert       gdb_print_host_address (exp->elts[elt].type, stream);
9455796c8dcSSimon Schubert       fprintf_filtered (stream, " (");
9465796c8dcSSimon Schubert       type_print (exp->elts[elt].type, NULL, stream, 0);
9475796c8dcSSimon Schubert       fprintf_filtered (stream, ")");
9485796c8dcSSimon Schubert       elt += 2;
9495796c8dcSSimon Schubert       break;
950*ef5ccd6cSJohn Marino     case OP_TYPEOF:
951*ef5ccd6cSJohn Marino     case OP_DECLTYPE:
952*ef5ccd6cSJohn Marino       fprintf_filtered (stream, "Typeof (");
953*ef5ccd6cSJohn Marino       elt = dump_subexp (exp, stream, elt);
954*ef5ccd6cSJohn Marino       fprintf_filtered (stream, ")");
955*ef5ccd6cSJohn Marino       break;
9565796c8dcSSimon Schubert     case STRUCTOP_STRUCT:
9575796c8dcSSimon Schubert     case STRUCTOP_PTR:
9585796c8dcSSimon Schubert       {
9595796c8dcSSimon Schubert 	char *elem_name;
9605796c8dcSSimon Schubert 	int len;
9615796c8dcSSimon Schubert 
9625796c8dcSSimon Schubert 	len = longest_to_int (exp->elts[elt].longconst);
9635796c8dcSSimon Schubert 	elem_name = &exp->elts[elt + 1].string;
9645796c8dcSSimon Schubert 
9655796c8dcSSimon Schubert 	fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
9665796c8dcSSimon Schubert 	elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
9675796c8dcSSimon Schubert       }
9685796c8dcSSimon Schubert       break;
9695796c8dcSSimon Schubert     case OP_SCOPE:
9705796c8dcSSimon Schubert       {
9715796c8dcSSimon Schubert 	char *elem_name;
9725796c8dcSSimon Schubert 	int len;
9735796c8dcSSimon Schubert 
9745796c8dcSSimon Schubert 	fprintf_filtered (stream, "Type @");
9755796c8dcSSimon Schubert 	gdb_print_host_address (exp->elts[elt].type, stream);
9765796c8dcSSimon Schubert 	fprintf_filtered (stream, " (");
9775796c8dcSSimon Schubert 	type_print (exp->elts[elt].type, NULL, stream, 0);
9785796c8dcSSimon Schubert 	fprintf_filtered (stream, ") ");
9795796c8dcSSimon Schubert 
9805796c8dcSSimon Schubert 	len = longest_to_int (exp->elts[elt + 1].longconst);
9815796c8dcSSimon Schubert 	elem_name = &exp->elts[elt + 2].string;
9825796c8dcSSimon Schubert 
9835796c8dcSSimon Schubert 	fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
9845796c8dcSSimon Schubert 	elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
9855796c8dcSSimon Schubert       }
9865796c8dcSSimon Schubert       break;
987c50c785cSJohn Marino     case TYPE_INSTANCE:
988c50c785cSJohn Marino       {
989c50c785cSJohn Marino 	LONGEST len;
990c50c785cSJohn Marino 
991c50c785cSJohn Marino 	len = exp->elts[elt++].longconst;
992c50c785cSJohn Marino 	fprintf_filtered (stream, "%s TypeInstance: ", plongest (len));
993c50c785cSJohn Marino 	while (len-- > 0)
994c50c785cSJohn Marino 	  {
995c50c785cSJohn Marino 	    fprintf_filtered (stream, "Type @");
996c50c785cSJohn Marino 	    gdb_print_host_address (exp->elts[elt].type, stream);
997c50c785cSJohn Marino 	    fprintf_filtered (stream, " (");
998c50c785cSJohn Marino 	    type_print (exp->elts[elt].type, NULL, stream, 0);
999c50c785cSJohn Marino 	    fprintf_filtered (stream, ")");
1000c50c785cSJohn Marino 	    elt++;
1001c50c785cSJohn Marino 	    if (len > 0)
1002c50c785cSJohn Marino 	      fputs_filtered (", ", stream);
1003c50c785cSJohn Marino 	  }
1004c50c785cSJohn Marino 	/* Ending LEN and ending TYPE_INSTANCE.  */
1005c50c785cSJohn Marino 	elt += 2;
1006c50c785cSJohn Marino 	elt = dump_subexp (exp, stream, elt);
1007c50c785cSJohn Marino       }
1008c50c785cSJohn Marino       break;
10095796c8dcSSimon Schubert     default:
10105796c8dcSSimon Schubert     case OP_NULL:
10115796c8dcSSimon Schubert     case MULTI_SUBSCRIPT:
10125796c8dcSSimon Schubert     case OP_F77_UNDETERMINED_ARGLIST:
10135796c8dcSSimon Schubert     case OP_COMPLEX:
10145796c8dcSSimon Schubert     case OP_STRING:
10155796c8dcSSimon Schubert     case OP_BOOL:
10165796c8dcSSimon Schubert     case OP_M2_STRING:
10175796c8dcSSimon Schubert     case OP_THIS:
10185796c8dcSSimon Schubert     case OP_NAME:
10195796c8dcSSimon Schubert       fprintf_filtered (stream, "Unknown format");
10205796c8dcSSimon Schubert     }
10215796c8dcSSimon Schubert 
10225796c8dcSSimon Schubert   return elt;
10235796c8dcSSimon Schubert }
10245796c8dcSSimon Schubert 
10255796c8dcSSimon Schubert void
dump_prefix_expression(struct expression * exp,struct ui_file * stream)10265796c8dcSSimon Schubert dump_prefix_expression (struct expression *exp, struct ui_file *stream)
10275796c8dcSSimon Schubert {
10285796c8dcSSimon Schubert   int elt;
10295796c8dcSSimon Schubert 
10305796c8dcSSimon Schubert   fprintf_filtered (stream, "Dump of expression @ ");
10315796c8dcSSimon Schubert   gdb_print_host_address (exp, stream);
10325796c8dcSSimon Schubert   fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
10335796c8dcSSimon Schubert   print_expression (exp, stream);
10345796c8dcSSimon Schubert   fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
10355796c8dcSSimon Schubert 		    exp->language_defn->la_name, exp->nelts,
10365796c8dcSSimon Schubert 		    (long) sizeof (union exp_element));
10375796c8dcSSimon Schubert   fputs_filtered ("\n", stream);
10385796c8dcSSimon Schubert 
10395796c8dcSSimon Schubert   for (elt = 0; elt < exp->nelts;)
10405796c8dcSSimon Schubert     elt = dump_subexp (exp, stream, elt);
10415796c8dcSSimon Schubert   fputs_filtered ("\n", stream);
10425796c8dcSSimon Schubert }
1043