1 /* Print in infix form a struct expression.
3 Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
4 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
26 #include "expression.h"
29 #include "parser-defs.h"
30 #include "user-regs.h" /* For user_reg_map_regnum_to_name. */
32 #include "gdb_string.h"
39 /* Prototypes for local functions */
41 static void print_subexp (struct expression *, int *, struct ui_file *,
45 print_expression (struct expression *exp, struct ui_file *stream)
48 print_subexp (exp, &pc, stream, PREC_NULL);
51 /* Print the subexpression of EXP that starts in position POS, on STREAM.
52 PREC is the precedence of the surrounding operator;
53 if the precedence of the main operator of this subexpression is less,
54 parentheses are needed here. */
57 print_subexp (struct expression *exp, int *pos,
58 struct ui_file *stream, enum precedence prec)
61 const struct op_print *op_print_tab;
65 int assign_modify = 0;
66 enum exp_opcode opcode;
67 enum precedence myprec = PREC_NULL;
68 /* Set to 1 for a right-associative operator. */
73 op_print_tab = exp->language_defn->la_op_print_tab;
75 opcode = exp->elts[pc].opcode;
83 fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
84 fputs_filtered ("::", stream);
85 nargs = longest_to_int (exp->elts[pc + 2].longconst);
86 (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
87 fputs_filtered (&exp->elts[pc + 3].string, stream);
92 value_print (value_from_longest (exp->elts[pc + 1].type,
93 exp->elts[pc + 2].longconst),
94 stream, 0, Val_no_prettyprint);
99 value_print (value_from_double (exp->elts[pc + 1].type,
100 exp->elts[pc + 2].doubleconst),
101 stream, 0, Val_no_prettyprint);
108 b = exp->elts[pc + 1].block;
110 && BLOCK_FUNCTION (b) != NULL
111 && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
113 fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
114 fputs_filtered ("::", stream);
116 fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
122 fprintf_filtered (stream, "$%d",
123 longest_to_int (exp->elts[pc + 1].longconst));
128 int regnum = longest_to_int (exp->elts[pc + 1].longconst);
129 const char *name = user_reg_map_regnum_to_name (current_gdbarch,
132 fprintf_filtered (stream, "$%s", name);
138 fprintf_filtered (stream, "%s",
139 longest_to_int (exp->elts[pc + 1].longconst)
145 fprintf_filtered (stream, "$%s",
146 internalvar_name (exp->elts[pc + 1].internalvar));
151 nargs = longest_to_int (exp->elts[pc + 1].longconst);
152 print_subexp (exp, pos, stream, PREC_SUFFIX);
153 fputs_filtered (" (", stream);
154 for (tem = 0; tem < nargs; tem++)
157 fputs_filtered (", ", stream);
158 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
160 fputs_filtered (")", stream);
165 nargs = longest_to_int (exp->elts[pc + 1].longconst);
166 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
167 fputs_filtered (&exp->elts[pc + 2].string, stream);
171 nargs = longest_to_int (exp->elts[pc + 1].longconst);
172 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
173 /* LA_PRINT_STRING will print using the current repeat count threshold.
174 If necessary, we can temporarily set it to zero, or pass it as an
175 additional parameter to LA_PRINT_STRING. -fnf */
176 LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
180 nargs = longest_to_int (exp->elts[pc + 1].longconst);
182 += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
183 fprintf_unfiltered (stream, "B'<unimplemented>'");
186 case OP_OBJC_NSSTRING: /* Objective-C Foundation Class NSString constant. */
187 nargs = longest_to_int (exp->elts[pc + 1].longconst);
188 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
189 fputs_filtered ("@\"", stream);
190 LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
191 fputs_filtered ("\"", stream);
194 case OP_OBJC_MSGCALL:
195 { /* Objective C message (method) call. */
198 nargs = longest_to_int (exp->elts[pc + 2].longconst);
199 fprintf_unfiltered (stream, "[");
200 print_subexp (exp, pos, stream, PREC_SUFFIX);
201 if (0 == target_read_string (exp->elts[pc + 1].longconst,
202 &selector, 1024, NULL))
204 error ("bad selector");
210 s = alloca (strlen (selector) + 1);
211 strcpy (s, selector);
212 for (tem = 0; tem < nargs; tem++)
214 nextS = strchr (s, ':');
216 fprintf_unfiltered (stream, " %s: ", s);
218 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
223 fprintf_unfiltered (stream, " %s", selector);
225 fprintf_unfiltered (stream, "]");
226 /* "selector" was malloc'd by target_read_string. Free it. */
233 nargs = longest_to_int (exp->elts[pc + 2].longconst);
234 nargs -= longest_to_int (exp->elts[pc + 1].longconst);
237 if (exp->elts[pc + 4].opcode == OP_LONG
238 && exp->elts[pc + 5].type == builtin_type_char
239 && exp->language_defn->la_language == language_c)
241 /* Attempt to print C character arrays using string syntax.
242 Walk through the args, picking up one character from each
243 of the OP_LONG expression elements. If any array element
244 does not match our expection of what we should find for
245 a simple string, revert back to array printing. Note that
246 the last expression element is an explicit null terminator
247 byte, which doesn't get printed. */
248 tempstr = alloca (nargs);
252 if (exp->elts[pc].opcode != OP_LONG
253 || exp->elts[pc + 1].type != builtin_type_char)
255 /* Not a simple array of char, use regular array printing. */
262 longest_to_int (exp->elts[pc + 2].longconst);
269 LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0);
274 fputs_filtered (" {", stream);
275 for (tem = 0; tem < nargs; tem++)
279 fputs_filtered (", ", stream);
281 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
283 fputs_filtered ("}", stream);
288 tem = longest_to_int (exp->elts[pc + 1].longconst);
289 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
290 /* Gcc support both these syntaxes. Unsure which is preferred. */
292 fputs_filtered (&exp->elts[pc + 2].string, stream);
293 fputs_filtered (": ", stream);
295 fputs_filtered (".", stream);
296 fputs_filtered (&exp->elts[pc + 2].string, stream);
297 fputs_filtered ("=", stream);
299 print_subexp (exp, pos, stream, PREC_SUFFIX);
303 if ((int) prec > (int) PREC_COMMA)
304 fputs_filtered ("(", stream);
305 /* Print the subexpressions, forcing parentheses
306 around any binary operations within them.
307 This is more parentheses than are strictly necessary,
308 but it looks clearer. */
309 print_subexp (exp, pos, stream, PREC_HYPER);
310 fputs_filtered (" ? ", stream);
311 print_subexp (exp, pos, stream, PREC_HYPER);
312 fputs_filtered (" : ", stream);
313 print_subexp (exp, pos, stream, PREC_HYPER);
314 if ((int) prec > (int) PREC_COMMA)
315 fputs_filtered (")", stream);
319 case TERNOP_SLICE_COUNT:
320 print_subexp (exp, pos, stream, PREC_SUFFIX);
321 fputs_filtered ("(", stream);
322 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
323 fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
324 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
325 fputs_filtered (")", stream);
328 case STRUCTOP_STRUCT:
329 tem = longest_to_int (exp->elts[pc + 1].longconst);
330 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
331 print_subexp (exp, pos, stream, PREC_SUFFIX);
332 fputs_filtered (".", stream);
333 fputs_filtered (&exp->elts[pc + 2].string, stream);
336 /* Will not occur for Modula-2 */
338 tem = longest_to_int (exp->elts[pc + 1].longconst);
339 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
340 print_subexp (exp, pos, stream, PREC_SUFFIX);
341 fputs_filtered ("->", stream);
342 fputs_filtered (&exp->elts[pc + 2].string, stream);
345 case BINOP_SUBSCRIPT:
346 print_subexp (exp, pos, stream, PREC_SUFFIX);
347 fputs_filtered ("[", stream);
348 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
349 fputs_filtered ("]", stream);
352 case UNOP_POSTINCREMENT:
353 print_subexp (exp, pos, stream, PREC_SUFFIX);
354 fputs_filtered ("++", stream);
357 case UNOP_POSTDECREMENT:
358 print_subexp (exp, pos, stream, PREC_SUFFIX);
359 fputs_filtered ("--", stream);
364 if ((int) prec > (int) PREC_PREFIX)
365 fputs_filtered ("(", stream);
366 fputs_filtered ("(", stream);
367 type_print (exp->elts[pc + 1].type, "", stream, 0);
368 fputs_filtered (") ", stream);
369 print_subexp (exp, pos, stream, PREC_PREFIX);
370 if ((int) prec > (int) PREC_PREFIX)
371 fputs_filtered (")", stream);
376 if ((int) prec > (int) PREC_PREFIX)
377 fputs_filtered ("(", stream);
378 if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC &&
379 exp->elts[pc + 3].opcode == OP_LONG)
381 /* We have a minimal symbol fn, probably. It's encoded
382 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
383 Swallow the OP_LONG (including both its opcodes); ignore
384 its type; print the value in the type of the MEMVAL. */
386 val = value_at_lazy (exp->elts[pc + 1].type,
387 (CORE_ADDR) exp->elts[pc + 5].longconst,
389 value_print (val, stream, 0, Val_no_prettyprint);
393 fputs_filtered ("{", stream);
394 type_print (exp->elts[pc + 1].type, "", stream, 0);
395 fputs_filtered ("} ", stream);
396 print_subexp (exp, pos, stream, PREC_PREFIX);
398 if ((int) prec > (int) PREC_PREFIX)
399 fputs_filtered (")", stream);
402 case BINOP_ASSIGN_MODIFY:
403 opcode = exp->elts[pc + 1].opcode;
405 myprec = PREC_ASSIGN;
409 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
410 if (op_print_tab[tem].opcode == opcode)
412 op_str = op_print_tab[tem].string;
415 if (op_print_tab[tem].opcode != opcode)
416 /* Not found; don't try to keep going because we don't know how
417 to interpret further elements. */
418 error ("Invalid expression");
425 fputs_filtered ("this", stream);
428 /* Objective-C ops */
432 fputs_filtered ("self", stream); /* The ObjC equivalent of "this". */
437 case MULTI_SUBSCRIPT:
439 nargs = longest_to_int (exp->elts[pc + 1].longconst);
440 print_subexp (exp, pos, stream, PREC_SUFFIX);
441 fprintf_unfiltered (stream, " [");
442 for (tem = 0; tem < nargs; tem++)
445 fprintf_unfiltered (stream, ", ");
446 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
448 fprintf_unfiltered (stream, "]");
453 fprintf_unfiltered (stream, "VAL(");
454 type_print (exp->elts[pc + 1].type, "", stream, 0);
455 fprintf_unfiltered (stream, ",");
456 print_subexp (exp, pos, stream, PREC_PREFIX);
457 fprintf_unfiltered (stream, ")");
462 error ("print_subexp: Not implemented.");
468 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
469 if (op_print_tab[tem].opcode == opcode)
471 op_str = op_print_tab[tem].string;
472 myprec = op_print_tab[tem].precedence;
473 assoc = op_print_tab[tem].right_assoc;
476 if (op_print_tab[tem].opcode != opcode)
477 /* Not found; don't try to keep going because we don't know how
478 to interpret further elements. For example, this happens
479 if opcode is OP_TYPE. */
480 error ("Invalid expression");
483 /* Note that PREC_BUILTIN will always emit parentheses. */
484 if ((int) myprec < (int) prec)
485 fputs_filtered ("(", stream);
486 if ((int) opcode > (int) BINOP_END)
490 /* Unary postfix operator. */
491 print_subexp (exp, pos, stream, PREC_SUFFIX);
492 fputs_filtered (op_str, stream);
496 /* Unary prefix operator. */
497 fputs_filtered (op_str, stream);
498 if (myprec == PREC_BUILTIN_FUNCTION)
499 fputs_filtered ("(", stream);
500 print_subexp (exp, pos, stream, PREC_PREFIX);
501 if (myprec == PREC_BUILTIN_FUNCTION)
502 fputs_filtered (")", stream);
507 /* Binary operator. */
508 /* Print left operand.
509 If operator is right-associative,
510 increment precedence for this operand. */
511 print_subexp (exp, pos, stream,
512 (enum precedence) ((int) myprec + assoc));
513 /* Print the operator itself. */
515 fprintf_filtered (stream, " %s= ", op_str);
516 else if (op_str[0] == ',')
517 fprintf_filtered (stream, "%s ", op_str);
519 fprintf_filtered (stream, " %s ", op_str);
520 /* Print right operand.
521 If operator is left-associative,
522 increment precedence for this operand. */
523 print_subexp (exp, pos, stream,
524 (enum precedence) ((int) myprec + !assoc));
527 if ((int) myprec < (int) prec)
528 fputs_filtered (")", stream);
531 /* Return the operator corresponding to opcode OP as
532 a string. NULL indicates that the opcode was not found in the
533 current language table. */
535 op_string (enum exp_opcode op)
538 const struct op_print *op_print_tab;
540 op_print_tab = current_language->la_op_print_tab;
541 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
542 if (op_print_tab[tem].opcode == op)
543 return op_print_tab[tem].string;
547 /* Support for dumping the raw data from expressions in a human readable
550 static char *op_name (int opcode);
551 static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
562 sprintf (buf, "<unknown %d>", opcode);
583 case BINOP_LOGICAL_AND:
584 return "BINOP_LOGICAL_AND";
585 case BINOP_LOGICAL_OR:
586 return "BINOP_LOGICAL_OR";
587 case BINOP_BITWISE_AND:
588 return "BINOP_BITWISE_AND";
589 case BINOP_BITWISE_IOR:
590 return "BINOP_BITWISE_IOR";
591 case BINOP_BITWISE_XOR:
592 return "BINOP_BITWISE_XOR";
594 return "BINOP_EQUAL";
596 return "BINOP_NOTEQUAL";
606 return "BINOP_REPEAT";
608 return "BINOP_ASSIGN";
610 return "BINOP_COMMA";
611 case BINOP_SUBSCRIPT:
612 return "BINOP_SUBSCRIPT";
613 case MULTI_SUBSCRIPT:
614 return "MULTI_SUBSCRIPT";
621 case STRUCTOP_MEMBER:
622 return "STRUCTOP_MEMBER";
624 return "STRUCTOP_MPTR";
626 return "BINOP_INTDIV";
627 case BINOP_ASSIGN_MODIFY:
628 return "BINOP_ASSIGN_MODIFY";
636 return "BINOP_CONCAT";
638 return "BINOP_RANGE";
642 return "TERNOP_COND";
644 return "TERNOP_SLICE";
645 case TERNOP_SLICE_COUNT:
646 return "TERNOP_SLICE_COUNT";
652 return "OP_VAR_VALUE";
656 return "OP_REGISTER";
658 return "OP_INTERNALVAR";
664 return "OP_BITSTRING";
670 return "UNOP_MEMVAL";
673 case UNOP_LOGICAL_NOT:
674 return "UNOP_LOGICAL_NOT";
675 case UNOP_COMPLEMENT:
676 return "UNOP_COMPLEMENT";
681 case UNOP_PREINCREMENT:
682 return "UNOP_PREINCREMENT";
683 case UNOP_POSTINCREMENT:
684 return "UNOP_POSTINCREMENT";
685 case UNOP_PREDECREMENT:
686 return "UNOP_PREDECREMENT";
687 case UNOP_POSTDECREMENT:
688 return "UNOP_POSTDECREMENT";
690 return "UNOP_SIZEOF";
696 return "UNOP_LENGTH";
722 return "OP_M2_STRING";
723 case STRUCTOP_STRUCT:
724 return "STRUCTOP_STRUCT";
726 return "STRUCTOP_PTR";
730 return "OP_OBJC_SELF";
741 dump_raw_expression (struct expression *exp, struct ui_file *stream,
749 fprintf_filtered (stream, "Dump of expression @ ");
750 gdb_print_host_address (exp, stream);
751 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
752 exp->language_defn->la_name, exp->nelts,
753 (long) sizeof (union exp_element));
754 fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode",
755 "Hex Value", "String Value");
756 for (elt = 0; elt < exp->nelts; elt++)
758 fprintf_filtered (stream, "\t%5d ", elt);
759 opcode_name = op_name (exp->elts[elt].opcode);
761 fprintf_filtered (stream, "%20s ", opcode_name);
762 print_longest (stream, 'd', 0, exp->elts[elt].longconst);
763 fprintf_filtered (stream, " ");
765 for (eltscan = (char *) &exp->elts[elt],
766 eltsize = sizeof (union exp_element);
770 fprintf_filtered (stream, "%c",
771 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
773 fprintf_filtered (stream, "\n");
777 /* Dump the subexpression of prefix expression EXP whose operator is at
778 position ELT onto STREAM. Returns the position of the next
779 subexpression in EXP. */
782 dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
784 static int indent = 0;
787 fprintf_filtered (stream, "\n");
788 fprintf_filtered (stream, "\t%5d ", elt);
790 for (i = 1; i <= indent; i++)
791 fprintf_filtered (stream, " ");
794 fprintf_filtered (stream, "%-20s ", op_name (exp->elts[elt].opcode));
796 elt = dump_subexp_body (exp, stream, elt);
803 /* Dump the operands of prefix expression EXP whose opcode is at
804 position ELT onto STREAM. Returns the position of the next
805 subexpression in EXP. */
808 dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
810 int opcode = exp->elts[elt++].opcode;
816 case TERNOP_SLICE_COUNT:
817 elt = dump_subexp (exp, stream, elt);
826 case BINOP_LOGICAL_AND:
827 case BINOP_LOGICAL_OR:
828 case BINOP_BITWISE_AND:
829 case BINOP_BITWISE_IOR:
830 case BINOP_BITWISE_XOR:
840 case BINOP_SUBSCRIPT:
845 case BINOP_ASSIGN_MODIFY:
853 elt = dump_subexp (exp, stream, elt);
855 case UNOP_LOGICAL_NOT:
856 case UNOP_COMPLEMENT:
859 case UNOP_PREINCREMENT:
860 case UNOP_POSTINCREMENT:
861 case UNOP_PREDECREMENT:
862 case UNOP_POSTDECREMENT:
881 elt = dump_subexp (exp, stream, elt);
884 fprintf_filtered (stream, "Type @");
885 gdb_print_host_address (exp->elts[elt].type, stream);
886 fprintf_filtered (stream, " (");
887 type_print (exp->elts[elt].type, NULL, stream, 0);
888 fprintf_filtered (stream, "), value %ld (0x%lx)",
889 (long) exp->elts[elt + 1].longconst,
890 (long) exp->elts[elt + 1].longconst);
894 fprintf_filtered (stream, "Type @");
895 gdb_print_host_address (exp->elts[elt].type, stream);
896 fprintf_filtered (stream, " (");
897 type_print (exp->elts[elt].type, NULL, stream, 0);
898 fprintf_filtered (stream, "), value %g",
899 (double) exp->elts[elt + 1].doubleconst);
903 fprintf_filtered (stream, "Block @");
904 gdb_print_host_address (exp->elts[elt].block, stream);
905 fprintf_filtered (stream, ", symbol @");
906 gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
907 fprintf_filtered (stream, " (%s)",
908 DEPRECATED_SYMBOL_NAME (exp->elts[elt + 1].symbol));
912 fprintf_filtered (stream, "History element %ld",
913 (long) exp->elts[elt].longconst);
917 fprintf_filtered (stream, "Register %ld",
918 (long) exp->elts[elt].longconst);
922 fprintf_filtered (stream, "Internal var @");
923 gdb_print_host_address (exp->elts[elt].internalvar, stream);
924 fprintf_filtered (stream, " (%s)",
925 exp->elts[elt].internalvar->name);
932 nargs = longest_to_int (exp->elts[elt].longconst);
934 fprintf_filtered (stream, "Number of args: %d", nargs);
937 for (i = 1; i <= nargs + 1; i++)
938 elt = dump_subexp (exp, stream, elt);
946 lower = longest_to_int (exp->elts[elt].longconst);
947 upper = longest_to_int (exp->elts[elt + 1].longconst);
949 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
952 for (i = 1; i <= upper - lower + 1; i++)
953 elt = dump_subexp (exp, stream, elt);
958 fprintf_filtered (stream, "Type @");
959 gdb_print_host_address (exp->elts[elt].type, stream);
960 fprintf_filtered (stream, " (");
961 type_print (exp->elts[elt].type, NULL, stream, 0);
962 fprintf_filtered (stream, ")");
963 elt = dump_subexp (exp, stream, elt + 2);
966 fprintf_filtered (stream, "Type @");
967 gdb_print_host_address (exp->elts[elt].type, stream);
968 fprintf_filtered (stream, " (");
969 type_print (exp->elts[elt].type, NULL, stream, 0);
970 fprintf_filtered (stream, ")");
973 case STRUCTOP_STRUCT:
979 len = longest_to_int (exp->elts[elt].longconst);
980 elem_name = &exp->elts[elt + 1].string;
982 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
983 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
991 fprintf_filtered (stream, "Type @");
992 gdb_print_host_address (exp->elts[elt].type, stream);
993 fprintf_filtered (stream, " (");
994 type_print (exp->elts[elt].type, NULL, stream, 0);
995 fprintf_filtered (stream, ") ");
997 len = longest_to_int (exp->elts[elt + 1].longconst);
998 elem_name = &exp->elts[elt + 2].string;
1000 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
1001 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
1006 case STRUCTOP_MEMBER:
1008 case MULTI_SUBSCRIPT:
1009 case OP_F77_UNDETERMINED_ARGLIST:
1019 fprintf_filtered (stream, "Unknown format");
1026 dump_prefix_expression (struct expression *exp, struct ui_file *stream)
1030 fprintf_filtered (stream, "Dump of expression @ ");
1031 gdb_print_host_address (exp, stream);
1032 fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
1033 if (exp->elts[0].opcode != OP_TYPE)
1034 print_expression (exp, stream);
1036 fputs_filtered ("Type printing not yet supported....", stream);
1037 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
1038 exp->language_defn->la_name, exp->nelts,
1039 (long) sizeof (union exp_element));
1040 fputs_filtered ("\n", stream);
1042 for (elt = 0; elt < exp->nelts;)
1043 elt = dump_subexp (exp, stream, elt);
1044 fputs_filtered ("\n", stream);