1 /* Print in infix form a struct expression.
2 Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
3 1998, 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
25 #include "expression.h"
28 #include "parser-defs.h"
29 #include "frame.h" /* For frame_map_regnum_to_name. */
35 /* Prototypes for local functions */
37 static void print_subexp (struct expression
*, int *, struct ui_file
*,
41 print_expression (struct expression
*exp
, struct ui_file
*stream
)
44 print_subexp (exp
, &pc
, stream
, PREC_NULL
);
47 /* Print the subexpression of EXP that starts in position POS, on STREAM.
48 PREC is the precedence of the surrounding operator;
49 if the precedence of the main operator of this subexpression is less,
50 parentheses are needed here. */
53 print_subexp (register struct expression
*exp
, register int *pos
,
54 struct ui_file
*stream
, enum precedence prec
)
56 register unsigned tem
;
57 register const struct op_print
*op_print_tab
;
60 register char *op_str
;
61 int assign_modify
= 0;
62 enum exp_opcode opcode
;
63 enum precedence myprec
= PREC_NULL
;
64 /* Set to 1 for a right-associative operator. */
69 op_print_tab
= exp
->language_defn
->la_op_print_tab
;
71 opcode
= exp
->elts
[pc
].opcode
;
79 fputs_filtered (type_name_no_tag (exp
->elts
[pc
+ 1].type
), stream
);
80 fputs_filtered ("::", stream
);
81 nargs
= longest_to_int (exp
->elts
[pc
+ 2].longconst
);
82 (*pos
) += 4 + BYTES_TO_EXP_ELEM (nargs
+ 1);
83 fputs_filtered (&exp
->elts
[pc
+ 3].string
, stream
);
88 value_print (value_from_longest (exp
->elts
[pc
+ 1].type
,
89 exp
->elts
[pc
+ 2].longconst
),
90 stream
, 0, Val_no_prettyprint
);
95 value_print (value_from_double (exp
->elts
[pc
+ 1].type
,
96 exp
->elts
[pc
+ 2].doubleconst
),
97 stream
, 0, Val_no_prettyprint
);
104 b
= exp
->elts
[pc
+ 1].block
;
106 && BLOCK_FUNCTION (b
) != NULL
107 && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b
)) != NULL
)
109 fputs_filtered (SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b
)), stream
);
110 fputs_filtered ("::", stream
);
112 fputs_filtered (SYMBOL_SOURCE_NAME (exp
->elts
[pc
+ 2].symbol
), stream
);
118 fprintf_filtered (stream
, "$%d",
119 longest_to_int (exp
->elts
[pc
+ 1].longconst
));
124 int regnum
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
126 fprintf_filtered (stream
, "$%s", frame_map_regnum_to_name (regnum
));
132 fprintf_filtered (stream
, "%s",
133 longest_to_int (exp
->elts
[pc
+ 1].longconst
)
139 fprintf_filtered (stream
, "$%s",
140 internalvar_name (exp
->elts
[pc
+ 1].internalvar
));
145 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
146 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
147 fputs_filtered (" (", stream
);
148 for (tem
= 0; tem
< nargs
; tem
++)
151 fputs_filtered (", ", stream
);
152 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
154 fputs_filtered (")", stream
);
159 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
160 (*pos
) += 3 + BYTES_TO_EXP_ELEM (nargs
+ 1);
161 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
165 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
166 (*pos
) += 3 + BYTES_TO_EXP_ELEM (nargs
+ 1);
167 /* LA_PRINT_STRING will print using the current repeat count threshold.
168 If necessary, we can temporarily set it to zero, or pass it as an
169 additional parameter to LA_PRINT_STRING. -fnf */
170 LA_PRINT_STRING (stream
, &exp
->elts
[pc
+ 2].string
, nargs
, 1, 0);
174 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
176 += 3 + BYTES_TO_EXP_ELEM ((nargs
+ HOST_CHAR_BIT
- 1) / HOST_CHAR_BIT
);
177 fprintf_unfiltered (stream
, "B'<unimplemented>'");
182 nargs
= longest_to_int (exp
->elts
[pc
+ 2].longconst
);
183 nargs
-= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
186 if (exp
->elts
[pc
+ 4].opcode
== OP_LONG
187 && exp
->elts
[pc
+ 5].type
== builtin_type_char
188 && exp
->language_defn
->la_language
== language_c
)
190 /* Attempt to print C character arrays using string syntax.
191 Walk through the args, picking up one character from each
192 of the OP_LONG expression elements. If any array element
193 does not match our expection of what we should find for
194 a simple string, revert back to array printing. Note that
195 the last expression element is an explicit null terminator
196 byte, which doesn't get printed. */
197 tempstr
= alloca (nargs
);
201 if (exp
->elts
[pc
].opcode
!= OP_LONG
202 || exp
->elts
[pc
+ 1].type
!= builtin_type_char
)
204 /* Not a simple array of char, use regular array printing. */
211 longest_to_int (exp
->elts
[pc
+ 2].longconst
);
218 LA_PRINT_STRING (stream
, tempstr
, nargs
- 1, 1, 0);
223 /* OBSOLETE int is_chill = exp->language_defn->la_language == language_chill; */
224 /* OBSOLETE fputs_filtered (is_chill ? " [" : " {", stream); */
225 fputs_filtered (" {", stream
);
226 for (tem
= 0; tem
< nargs
; tem
++)
230 fputs_filtered (", ", stream
);
232 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
234 /* OBSOLETE fputs_filtered (is_chill ? "]" : "}", stream); */
235 fputs_filtered ("}", stream
);
240 tem
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
241 (*pos
) += 3 + BYTES_TO_EXP_ELEM (tem
+ 1);
244 if (0 /* OBSOLETE exp->language_defn->la_language == language_chill */)
246 fputs_filtered (".", stream
); /* OBSOLETE */
247 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
); /* OBSOLETE */
248 fputs_filtered (exp
->elts
[*pos
].opcode
== OP_LABELED
? ", " /* OBSOLETE */
249 : ": ", /* OBSOLETE */
250 stream
); /* OBSOLETE */
255 /* Gcc support both these syntaxes. Unsure which is preferred. */
257 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
258 fputs_filtered (": ", stream
);
260 fputs_filtered (".", stream
);
261 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
262 fputs_filtered ("=", stream
);
265 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
269 if ((int) prec
> (int) PREC_COMMA
)
270 fputs_filtered ("(", stream
);
271 /* Print the subexpressions, forcing parentheses
272 around any binary operations within them.
273 This is more parentheses than are strictly necessary,
274 but it looks clearer. */
275 print_subexp (exp
, pos
, stream
, PREC_HYPER
);
276 fputs_filtered (" ? ", stream
);
277 print_subexp (exp
, pos
, stream
, PREC_HYPER
);
278 fputs_filtered (" : ", stream
);
279 print_subexp (exp
, pos
, stream
, PREC_HYPER
);
280 if ((int) prec
> (int) PREC_COMMA
)
281 fputs_filtered (")", stream
);
285 case TERNOP_SLICE_COUNT
:
286 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
287 fputs_filtered ("(", stream
);
288 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
289 fputs_filtered (opcode
== TERNOP_SLICE
? " : " : " UP ", stream
);
290 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
291 fputs_filtered (")", stream
);
294 case STRUCTOP_STRUCT
:
295 tem
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
296 (*pos
) += 3 + BYTES_TO_EXP_ELEM (tem
+ 1);
297 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
298 fputs_filtered (".", stream
);
299 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
302 /* Will not occur for Modula-2 */
304 tem
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
305 (*pos
) += 3 + BYTES_TO_EXP_ELEM (tem
+ 1);
306 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
307 fputs_filtered ("->", stream
);
308 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
311 case BINOP_SUBSCRIPT
:
312 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
313 fputs_filtered ("[", stream
);
314 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
315 fputs_filtered ("]", stream
);
318 case UNOP_POSTINCREMENT
:
319 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
320 fputs_filtered ("++", stream
);
323 case UNOP_POSTDECREMENT
:
324 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
325 fputs_filtered ("--", stream
);
330 if ((int) prec
> (int) PREC_PREFIX
)
331 fputs_filtered ("(", stream
);
332 fputs_filtered ("(", stream
);
333 type_print (exp
->elts
[pc
+ 1].type
, "", stream
, 0);
334 fputs_filtered (") ", stream
);
335 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
336 if ((int) prec
> (int) PREC_PREFIX
)
337 fputs_filtered (")", stream
);
342 if ((int) prec
> (int) PREC_PREFIX
)
343 fputs_filtered ("(", stream
);
344 if (TYPE_CODE (exp
->elts
[pc
+ 1].type
) == TYPE_CODE_FUNC
&&
345 exp
->elts
[pc
+ 3].opcode
== OP_LONG
)
347 /* We have a minimal symbol fn, probably. It's encoded
348 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
349 Swallow the OP_LONG (including both its opcodes); ignore
350 its type; print the value in the type of the MEMVAL. */
352 val
= value_at_lazy (exp
->elts
[pc
+ 1].type
,
353 (CORE_ADDR
) exp
->elts
[pc
+ 5].longconst
,
355 value_print (val
, stream
, 0, Val_no_prettyprint
);
359 fputs_filtered ("{", stream
);
360 type_print (exp
->elts
[pc
+ 1].type
, "", stream
, 0);
361 fputs_filtered ("} ", stream
);
362 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
364 if ((int) prec
> (int) PREC_PREFIX
)
365 fputs_filtered (")", stream
);
368 case BINOP_ASSIGN_MODIFY
:
369 opcode
= exp
->elts
[pc
+ 1].opcode
;
371 myprec
= PREC_ASSIGN
;
375 for (tem
= 0; op_print_tab
[tem
].opcode
!= OP_NULL
; tem
++)
376 if (op_print_tab
[tem
].opcode
== opcode
)
378 op_str
= op_print_tab
[tem
].string
;
381 if (op_print_tab
[tem
].opcode
!= opcode
)
382 /* Not found; don't try to keep going because we don't know how
383 to interpret further elements. */
384 error ("Invalid expression");
391 fputs_filtered ("this", stream
);
396 case MULTI_SUBSCRIPT
:
398 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
399 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
400 fprintf_unfiltered (stream
, " [");
401 for (tem
= 0; tem
< nargs
; tem
++)
404 fprintf_unfiltered (stream
, ", ");
405 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
407 fprintf_unfiltered (stream
, "]");
412 fprintf_unfiltered (stream
, "VAL(");
413 type_print (exp
->elts
[pc
+ 1].type
, "", stream
, 0);
414 fprintf_unfiltered (stream
, ",");
415 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
416 fprintf_unfiltered (stream
, ")");
421 error ("print_subexp: Not implemented.");
427 for (tem
= 0; op_print_tab
[tem
].opcode
!= OP_NULL
; tem
++)
428 if (op_print_tab
[tem
].opcode
== opcode
)
430 op_str
= op_print_tab
[tem
].string
;
431 myprec
= op_print_tab
[tem
].precedence
;
432 assoc
= op_print_tab
[tem
].right_assoc
;
435 if (op_print_tab
[tem
].opcode
!= opcode
)
436 /* Not found; don't try to keep going because we don't know how
437 to interpret further elements. For example, this happens
438 if opcode is OP_TYPE. */
439 error ("Invalid expression");
442 /* Note that PREC_BUILTIN will always emit parentheses. */
443 if ((int) myprec
< (int) prec
)
444 fputs_filtered ("(", stream
);
445 if ((int) opcode
> (int) BINOP_END
)
449 /* Unary postfix operator. */
450 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
451 fputs_filtered (op_str
, stream
);
455 /* Unary prefix operator. */
456 fputs_filtered (op_str
, stream
);
457 if (myprec
== PREC_BUILTIN_FUNCTION
)
458 fputs_filtered ("(", stream
);
459 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
460 if (myprec
== PREC_BUILTIN_FUNCTION
)
461 fputs_filtered (")", stream
);
466 /* Binary operator. */
467 /* Print left operand.
468 If operator is right-associative,
469 increment precedence for this operand. */
470 print_subexp (exp
, pos
, stream
,
471 (enum precedence
) ((int) myprec
+ assoc
));
472 /* Print the operator itself. */
474 fprintf_filtered (stream
, " %s= ", op_str
);
475 else if (op_str
[0] == ',')
476 fprintf_filtered (stream
, "%s ", op_str
);
478 fprintf_filtered (stream
, " %s ", op_str
);
479 /* Print right operand.
480 If operator is left-associative,
481 increment precedence for this operand. */
482 print_subexp (exp
, pos
, stream
,
483 (enum precedence
) ((int) myprec
+ !assoc
));
486 if ((int) myprec
< (int) prec
)
487 fputs_filtered (")", stream
);
490 /* Return the operator corresponding to opcode OP as
491 a string. NULL indicates that the opcode was not found in the
492 current language table. */
494 op_string (enum exp_opcode op
)
497 register const struct op_print
*op_print_tab
;
499 op_print_tab
= current_language
->la_op_print_tab
;
500 for (tem
= 0; op_print_tab
[tem
].opcode
!= OP_NULL
; tem
++)
501 if (op_print_tab
[tem
].opcode
== op
)
502 return op_print_tab
[tem
].string
;
506 /* Support for dumping the raw data from expressions in a human readable
509 static char *op_name (int opcode
);
520 sprintf (buf
, "<unknown %d>", opcode
);
541 case BINOP_LOGICAL_AND
:
542 return "BINOP_LOGICAL_AND";
543 case BINOP_LOGICAL_OR
:
544 return "BINOP_LOGICAL_OR";
545 case BINOP_BITWISE_AND
:
546 return "BINOP_BITWISE_AND";
547 case BINOP_BITWISE_IOR
:
548 return "BINOP_BITWISE_IOR";
549 case BINOP_BITWISE_XOR
:
550 return "BINOP_BITWISE_XOR";
552 return "BINOP_EQUAL";
554 return "BINOP_NOTEQUAL";
564 return "BINOP_REPEAT";
566 return "BINOP_ASSIGN";
568 return "BINOP_COMMA";
569 case BINOP_SUBSCRIPT
:
570 return "BINOP_SUBSCRIPT";
571 case MULTI_SUBSCRIPT
:
572 return "MULTI_SUBSCRIPT";
579 case STRUCTOP_MEMBER
:
580 return "STRUCTOP_MEMBER";
582 return "STRUCTOP_MPTR";
584 return "BINOP_INTDIV";
585 case BINOP_ASSIGN_MODIFY
:
586 return "BINOP_ASSIGN_MODIFY";
594 return "BINOP_CONCAT";
596 return "BINOP_RANGE";
600 return "TERNOP_COND";
602 return "TERNOP_SLICE";
603 case TERNOP_SLICE_COUNT
:
604 return "TERNOP_SLICE_COUNT";
610 return "OP_VAR_VALUE";
614 return "OP_REGISTER";
616 return "OP_INTERNALVAR";
622 return "OP_BITSTRING";
628 return "UNOP_MEMVAL";
631 case UNOP_LOGICAL_NOT
:
632 return "UNOP_LOGICAL_NOT";
633 case UNOP_COMPLEMENT
:
634 return "UNOP_COMPLEMENT";
639 case UNOP_PREINCREMENT
:
640 return "UNOP_PREINCREMENT";
641 case UNOP_POSTINCREMENT
:
642 return "UNOP_POSTINCREMENT";
643 case UNOP_PREDECREMENT
:
644 return "UNOP_PREDECREMENT";
645 case UNOP_POSTDECREMENT
:
646 return "UNOP_POSTDECREMENT";
648 return "UNOP_SIZEOF";
654 return "UNOP_LENGTH";
680 return "OP_M2_STRING";
681 case STRUCTOP_STRUCT
:
682 return "STRUCTOP_STRUCT";
684 return "STRUCTOP_PTR";
697 dump_prefix_expression (struct expression
*exp
, struct ui_file
*stream
,
705 fprintf_filtered (stream
, "Dump of expression @ ");
706 gdb_print_host_address (exp
, stream
);
707 fprintf_filtered (stream
, ", %s:\nExpression: `", note
);
708 if (exp
->elts
[0].opcode
!= OP_TYPE
)
709 print_expression (exp
, stream
);
711 fprintf_filtered (stream
, "Type printing not yet supported....");
712 fprintf_filtered (stream
, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
713 exp
->language_defn
->la_name
, exp
->nelts
,
714 (long) sizeof (union exp_element
));
715 fprintf_filtered (stream
, "\t%5s %20s %16s %s\n", "Index", "Opcode",
716 "Hex Value", "String Value");
717 for (elt
= 0; elt
< exp
->nelts
; elt
++)
719 fprintf_filtered (stream
, "\t%5d ", elt
);
720 opcode_name
= op_name (exp
->elts
[elt
].opcode
);
722 fprintf_filtered (stream
, "%20s ", opcode_name
);
723 print_longest (stream
, 'd', 0, exp
->elts
[elt
].longconst
);
724 fprintf_filtered (stream
, " ");
726 for (eltscan
= (char *) &exp
->elts
[elt
],
727 eltsize
= sizeof (union exp_element
);
731 fprintf_filtered (stream
, "%c",
732 isprint (*eltscan
) ? (*eltscan
& 0xFF) : '.');
734 fprintf_filtered (stream
, "\n");
738 static int dump_subexp (struct expression
*exp
, struct ui_file
*stream
,
742 dump_subexp (struct expression
*exp
, struct ui_file
*stream
, int elt
)
744 static int indent
= 0;
747 fprintf_filtered (stream
, "\n");
748 fprintf_filtered (stream
, "\t%5d ", elt
);
750 for (i
= 1; i
<= indent
; i
++)
751 fprintf_filtered (stream
, " ");
754 fprintf_filtered (stream
, "%-20s ", op_name (exp
->elts
[elt
].opcode
));
756 switch (exp
->elts
[elt
++].opcode
)
760 case TERNOP_SLICE_COUNT
:
761 elt
= dump_subexp (exp
, stream
, elt
);
770 case BINOP_LOGICAL_AND
:
771 case BINOP_LOGICAL_OR
:
772 case BINOP_BITWISE_AND
:
773 case BINOP_BITWISE_IOR
:
774 case BINOP_BITWISE_XOR
:
784 case BINOP_SUBSCRIPT
:
789 case BINOP_ASSIGN_MODIFY
:
797 elt
= dump_subexp (exp
, stream
, elt
);
799 case UNOP_LOGICAL_NOT
:
800 case UNOP_COMPLEMENT
:
803 case UNOP_PREINCREMENT
:
804 case UNOP_POSTINCREMENT
:
805 case UNOP_PREDECREMENT
:
806 case UNOP_POSTDECREMENT
:
825 elt
= dump_subexp (exp
, stream
, elt
);
828 fprintf_filtered (stream
, "Type @");
829 gdb_print_host_address (exp
->elts
[elt
].type
, stream
);
830 fprintf_filtered (stream
, " (");
831 type_print (exp
->elts
[elt
].type
, NULL
, stream
, 0);
832 fprintf_filtered (stream
, "), value %ld (0x%lx)",
833 (long) exp
->elts
[elt
+ 1].longconst
,
834 (long) exp
->elts
[elt
+ 1].longconst
);
838 fprintf_filtered (stream
, "Type @");
839 gdb_print_host_address (exp
->elts
[elt
].type
, stream
);
840 fprintf_filtered (stream
, " (");
841 type_print (exp
->elts
[elt
].type
, NULL
, stream
, 0);
842 fprintf_filtered (stream
, "), value %g",
843 (double) exp
->elts
[elt
+ 1].doubleconst
);
847 fprintf_filtered (stream
, "Block @");
848 gdb_print_host_address (exp
->elts
[elt
].block
, stream
);
849 fprintf_filtered (stream
, ", symbol @");
850 gdb_print_host_address (exp
->elts
[elt
+ 1].symbol
, stream
);
851 fprintf_filtered (stream
, " (%s)",
852 SYMBOL_NAME (exp
->elts
[elt
+ 1].symbol
));
856 fprintf_filtered (stream
, "History element %ld",
857 (long) exp
->elts
[elt
].longconst
);
861 fprintf_filtered (stream
, "Register %ld",
862 (long) exp
->elts
[elt
].longconst
);
866 fprintf_filtered (stream
, "Internal var @");
867 gdb_print_host_address (exp
->elts
[elt
].internalvar
, stream
);
868 fprintf_filtered (stream
, " (%s)",
869 exp
->elts
[elt
].internalvar
->name
);
876 nargs
= longest_to_int (exp
->elts
[elt
].longconst
);
878 fprintf_filtered (stream
, "Number of args: %d", nargs
);
881 for (i
= 1; i
<= nargs
+ 1; i
++)
882 elt
= dump_subexp (exp
, stream
, elt
);
890 lower
= longest_to_int (exp
->elts
[elt
].longconst
);
891 upper
= longest_to_int (exp
->elts
[elt
+ 1].longconst
);
893 fprintf_filtered (stream
, "Bounds [%d:%d]", lower
, upper
);
896 for (i
= 1; i
<= upper
- lower
+ 1; i
++)
897 elt
= dump_subexp (exp
, stream
, elt
);
902 fprintf_filtered (stream
, "Type @");
903 gdb_print_host_address (exp
->elts
[elt
].type
, stream
);
904 fprintf_filtered (stream
, " (");
905 type_print (exp
->elts
[elt
].type
, NULL
, stream
, 0);
906 fprintf_filtered (stream
, ")");
907 elt
= dump_subexp (exp
, stream
, elt
+ 2);
910 fprintf_filtered (stream
, "Type @");
911 gdb_print_host_address (exp
->elts
[elt
].type
, stream
);
912 fprintf_filtered (stream
, " (");
913 type_print (exp
->elts
[elt
].type
, NULL
, stream
, 0);
914 fprintf_filtered (stream
, ")");
917 case STRUCTOP_STRUCT
:
923 len
= longest_to_int (exp
->elts
[elt
].longconst
);
924 elem_name
= &exp
->elts
[elt
+ 1].string
;
926 fprintf_filtered (stream
, "Element name: `%.*s'", len
, elem_name
);
927 elt
= dump_subexp (exp
, stream
, elt
+ 3 + BYTES_TO_EXP_ELEM (len
+ 1));
935 fprintf_filtered (stream
, "Type @");
936 gdb_print_host_address (exp
->elts
[elt
].type
, stream
);
937 fprintf_filtered (stream
, " (");
938 type_print (exp
->elts
[elt
].type
, NULL
, stream
, 0);
939 fprintf_filtered (stream
, ") ");
941 len
= longest_to_int (exp
->elts
[elt
+ 1].longconst
);
942 elem_name
= &exp
->elts
[elt
+ 2].string
;
944 fprintf_filtered (stream
, "Field name: `%.*s'", len
, elem_name
);
945 elt
+= 4 + BYTES_TO_EXP_ELEM (len
+ 1);
950 case STRUCTOP_MEMBER
:
952 case MULTI_SUBSCRIPT
:
953 case OP_F77_UNDETERMINED_ARGLIST
:
963 fprintf_filtered (stream
, "Unknown format");
972 dump_postfix_expression (struct expression
*exp
, struct ui_file
*stream
,
977 fprintf_filtered (stream
, "Dump of expression @ ");
978 gdb_print_host_address (exp
, stream
);
979 fprintf_filtered (stream
, ", %s:\nExpression: `", note
);
980 if (exp
->elts
[0].opcode
!= OP_TYPE
)
981 print_expression (exp
, stream
);
983 fputs_filtered ("Type printing not yet supported....", stream
);
984 fprintf_filtered (stream
, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
985 exp
->language_defn
->la_name
, exp
->nelts
,
986 (long) sizeof (union exp_element
));
987 fputs_filtered ("\n", stream
);
989 for (elt
= 0; elt
< exp
->nelts
;)
990 elt
= dump_subexp (exp
, stream
, elt
);
991 fputs_filtered ("\n", stream
);