1 /* Print in infix form a struct expression.
3 Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
4 1998, 1999, 2000, 2003, 2007, 2008, 2009, 2010, 2011
5 Free Software Foundation, Inc.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "expression.h"
28 #include "parser-defs.h"
29 #include "user-regs.h" /* For user_reg_map_regnum_to_name. */
31 #include "gdb_string.h"
34 #include "gdb_assert.h"
42 print_expression (struct expression *exp, struct ui_file *stream)
46 print_subexp (exp, &pc, stream, PREC_NULL);
49 /* Print the subexpression of EXP that starts in position POS, on STREAM.
50 PREC is the precedence of the surrounding operator;
51 if the precedence of the main operator of this subexpression is less,
52 parentheses are needed here. */
55 print_subexp (struct expression *exp, int *pos,
56 struct ui_file *stream, enum precedence prec)
58 exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
61 /* Standard implementation of print_subexp for use in language_defn
64 print_subexp_standard (struct expression *exp, int *pos,
65 struct ui_file *stream, enum precedence prec)
68 const struct op_print *op_print_tab;
72 int assign_modify = 0;
73 enum exp_opcode opcode;
74 enum precedence myprec = PREC_NULL;
75 /* Set to 1 for a right-associative operator. */
80 op_print_tab = exp->language_defn->la_op_print_tab;
82 opcode = exp->elts[pc].opcode;
90 fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
91 fputs_filtered ("::", stream);
92 nargs = longest_to_int (exp->elts[pc + 2].longconst);
93 (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
94 fputs_filtered (&exp->elts[pc + 3].string, stream);
99 struct value_print_options opts;
101 get_raw_print_options (&opts);
103 value_print (value_from_longest (exp->elts[pc + 1].type,
104 exp->elts[pc + 2].longconst),
111 struct value_print_options opts;
113 get_raw_print_options (&opts);
115 value_print (value_from_double (exp->elts[pc + 1].type,
116 exp->elts[pc + 2].doubleconst),
126 b = exp->elts[pc + 1].block;
128 && BLOCK_FUNCTION (b) != NULL
129 && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
131 fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
132 fputs_filtered ("::", stream);
134 fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
140 fprintf_filtered (stream, "$%d",
141 longest_to_int (exp->elts[pc + 1].longconst));
146 const char *name = &exp->elts[pc + 2].string;
148 (*pos) += 3 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
149 fprintf_filtered (stream, "$%s", name);
155 fprintf_filtered (stream, "%s",
156 longest_to_int (exp->elts[pc + 1].longconst)
162 fprintf_filtered (stream, "$%s",
163 internalvar_name (exp->elts[pc + 1].internalvar));
168 nargs = longest_to_int (exp->elts[pc + 1].longconst);
169 print_subexp (exp, pos, stream, PREC_SUFFIX);
170 fputs_filtered (" (", stream);
171 for (tem = 0; tem < nargs; tem++)
174 fputs_filtered (", ", stream);
175 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
177 fputs_filtered (")", stream);
181 nargs = longest_to_int (exp->elts[pc + 1].longconst);
182 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
183 fputs_filtered (&exp->elts[pc + 2].string, stream);
188 struct value_print_options opts;
190 nargs = longest_to_int (exp->elts[pc + 1].longconst);
191 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
192 /* LA_PRINT_STRING will print using the current repeat count threshold.
193 If necessary, we can temporarily set it to zero, or pass it as an
194 additional parameter to LA_PRINT_STRING. -fnf */
195 get_user_print_options (&opts);
196 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
197 &exp->elts[pc + 2].string, nargs, NULL, 0, &opts);
202 nargs = longest_to_int (exp->elts[pc + 1].longconst);
204 += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
205 fprintf_unfiltered (stream, "B'<unimplemented>'");
208 case OP_OBJC_NSSTRING: /* Objective-C Foundation Class
209 NSString constant. */
211 struct value_print_options opts;
213 nargs = longest_to_int (exp->elts[pc + 1].longconst);
214 (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
215 fputs_filtered ("@\"", stream);
216 get_user_print_options (&opts);
217 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
218 &exp->elts[pc + 2].string, nargs, NULL, 0, &opts);
219 fputs_filtered ("\"", stream);
223 case OP_OBJC_MSGCALL:
224 { /* Objective C message (method) call. */
228 nargs = longest_to_int (exp->elts[pc + 2].longconst);
229 fprintf_unfiltered (stream, "[");
230 print_subexp (exp, pos, stream, PREC_SUFFIX);
231 if (0 == target_read_string (exp->elts[pc + 1].longconst,
232 &selector, 1024, NULL))
234 error (_("bad selector"));
241 s = alloca (strlen (selector) + 1);
242 strcpy (s, selector);
243 for (tem = 0; tem < nargs; tem++)
245 nextS = strchr (s, ':');
246 gdb_assert (nextS); /* Make sure we found ':'. */
248 fprintf_unfiltered (stream, " %s: ", s);
250 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
255 fprintf_unfiltered (stream, " %s", selector);
257 fprintf_unfiltered (stream, "]");
258 /* "selector" was malloc'd by target_read_string. Free it. */
265 nargs = longest_to_int (exp->elts[pc + 2].longconst);
266 nargs -= longest_to_int (exp->elts[pc + 1].longconst);
269 if (exp->elts[pc + 4].opcode == OP_LONG
270 && exp->elts[pc + 5].type
271 == builtin_type (exp->gdbarch)->builtin_char
272 && exp->language_defn->la_language == language_c)
274 /* Attempt to print C character arrays using string syntax.
275 Walk through the args, picking up one character from each
276 of the OP_LONG expression elements. If any array element
277 does not match our expection of what we should find for
278 a simple string, revert back to array printing. Note that
279 the last expression element is an explicit null terminator
280 byte, which doesn't get printed. */
281 tempstr = alloca (nargs);
285 if (exp->elts[pc].opcode != OP_LONG
286 || exp->elts[pc + 1].type
287 != builtin_type (exp->gdbarch)->builtin_char)
289 /* Not a simple array of char, use regular array
297 longest_to_int (exp->elts[pc + 2].longconst);
304 struct value_print_options opts;
306 get_user_print_options (&opts);
307 LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
308 tempstr, nargs - 1, NULL, 0, &opts);
313 fputs_filtered (" {", stream);
314 for (tem = 0; tem < nargs; tem++)
318 fputs_filtered (", ", stream);
320 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
322 fputs_filtered ("}", stream);
327 tem = longest_to_int (exp->elts[pc + 1].longconst);
328 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
329 /* Gcc support both these syntaxes. Unsure which is preferred. */
331 fputs_filtered (&exp->elts[pc + 2].string, stream);
332 fputs_filtered (": ", stream);
334 fputs_filtered (".", stream);
335 fputs_filtered (&exp->elts[pc + 2].string, stream);
336 fputs_filtered ("=", stream);
338 print_subexp (exp, pos, stream, PREC_SUFFIX);
342 if ((int) prec > (int) PREC_COMMA)
343 fputs_filtered ("(", stream);
344 /* Print the subexpressions, forcing parentheses
345 around any binary operations within them.
346 This is more parentheses than are strictly necessary,
347 but it looks clearer. */
348 print_subexp (exp, pos, stream, PREC_HYPER);
349 fputs_filtered (" ? ", stream);
350 print_subexp (exp, pos, stream, PREC_HYPER);
351 fputs_filtered (" : ", stream);
352 print_subexp (exp, pos, stream, PREC_HYPER);
353 if ((int) prec > (int) PREC_COMMA)
354 fputs_filtered (")", stream);
358 case TERNOP_SLICE_COUNT:
359 print_subexp (exp, pos, stream, PREC_SUFFIX);
360 fputs_filtered ("(", stream);
361 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
362 fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
363 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
364 fputs_filtered (")", stream);
367 case STRUCTOP_STRUCT:
368 tem = longest_to_int (exp->elts[pc + 1].longconst);
369 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
370 print_subexp (exp, pos, stream, PREC_SUFFIX);
371 fputs_filtered (".", stream);
372 fputs_filtered (&exp->elts[pc + 2].string, stream);
375 /* Will not occur for Modula-2. */
377 tem = longest_to_int (exp->elts[pc + 1].longconst);
378 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
379 print_subexp (exp, pos, stream, PREC_SUFFIX);
380 fputs_filtered ("->", stream);
381 fputs_filtered (&exp->elts[pc + 2].string, stream);
384 case STRUCTOP_MEMBER:
385 print_subexp (exp, pos, stream, PREC_SUFFIX);
386 fputs_filtered (".*", stream);
387 print_subexp (exp, pos, stream, PREC_SUFFIX);
391 print_subexp (exp, pos, stream, PREC_SUFFIX);
392 fputs_filtered ("->*", stream);
393 print_subexp (exp, pos, stream, PREC_SUFFIX);
396 case BINOP_SUBSCRIPT:
397 print_subexp (exp, pos, stream, PREC_SUFFIX);
398 fputs_filtered ("[", stream);
399 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
400 fputs_filtered ("]", stream);
403 case UNOP_POSTINCREMENT:
404 print_subexp (exp, pos, stream, PREC_SUFFIX);
405 fputs_filtered ("++", stream);
408 case UNOP_POSTDECREMENT:
409 print_subexp (exp, pos, stream, PREC_SUFFIX);
410 fputs_filtered ("--", stream);
415 if ((int) prec > (int) PREC_PREFIX)
416 fputs_filtered ("(", stream);
417 fputs_filtered ("(", stream);
418 type_print (exp->elts[pc + 1].type, "", stream, 0);
419 fputs_filtered (") ", stream);
420 print_subexp (exp, pos, stream, PREC_PREFIX);
421 if ((int) prec > (int) PREC_PREFIX)
422 fputs_filtered (")", stream);
425 case UNOP_DYNAMIC_CAST:
426 case UNOP_REINTERPRET_CAST:
427 fputs_filtered (opcode == UNOP_DYNAMIC_CAST ? "dynamic_cast"
428 : "reinterpret_cast", stream);
429 fputs_filtered ("<", stream);
431 type_print (exp->elts[pc + 1].type, "", stream, 0);
432 fputs_filtered ("> (", stream);
433 print_subexp (exp, pos, stream, PREC_PREFIX);
434 fputs_filtered (")", stream);
439 if ((int) prec > (int) PREC_PREFIX)
440 fputs_filtered ("(", stream);
441 if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC
442 && exp->elts[pc + 3].opcode == OP_LONG)
444 struct value_print_options opts;
446 /* We have a minimal symbol fn, probably. It's encoded
447 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
448 Swallow the OP_LONG (including both its opcodes); ignore
449 its type; print the value in the type of the MEMVAL. */
451 val = value_at_lazy (exp->elts[pc + 1].type,
452 (CORE_ADDR) exp->elts[pc + 5].longconst);
453 get_raw_print_options (&opts);
454 value_print (val, stream, &opts);
458 fputs_filtered ("{", stream);
459 type_print (exp->elts[pc + 1].type, "", stream, 0);
460 fputs_filtered ("} ", stream);
461 print_subexp (exp, pos, stream, PREC_PREFIX);
463 if ((int) prec > (int) PREC_PREFIX)
464 fputs_filtered (")", stream);
467 case UNOP_MEMVAL_TLS:
469 if ((int) prec > (int) PREC_PREFIX)
470 fputs_filtered ("(", stream);
471 fputs_filtered ("{", stream);
472 type_print (exp->elts[pc + 2].type, "", stream, 0);
473 fputs_filtered ("} ", stream);
474 print_subexp (exp, pos, stream, PREC_PREFIX);
475 if ((int) prec > (int) PREC_PREFIX)
476 fputs_filtered (")", stream);
479 case BINOP_ASSIGN_MODIFY:
480 opcode = exp->elts[pc + 1].opcode;
482 myprec = PREC_ASSIGN;
486 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
487 if (op_print_tab[tem].opcode == opcode)
489 op_str = op_print_tab[tem].string;
492 if (op_print_tab[tem].opcode != opcode)
493 /* Not found; don't try to keep going because we don't know how
494 to interpret further elements. */
495 error (_("Invalid expression"));
502 fputs_filtered ("this", stream);
505 /* Objective-C ops */
509 fputs_filtered ("self", stream); /* The ObjC equivalent of "this". */
514 case MULTI_SUBSCRIPT:
516 nargs = longest_to_int (exp->elts[pc + 1].longconst);
517 print_subexp (exp, pos, stream, PREC_SUFFIX);
518 fprintf_unfiltered (stream, " [");
519 for (tem = 0; tem < nargs; tem++)
522 fprintf_unfiltered (stream, ", ");
523 print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
525 fprintf_unfiltered (stream, "]");
530 fprintf_unfiltered (stream, "VAL(");
531 type_print (exp->elts[pc + 1].type, "", stream, 0);
532 fprintf_unfiltered (stream, ",");
533 print_subexp (exp, pos, stream, PREC_PREFIX);
534 fprintf_unfiltered (stream, ")");
541 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
542 if (op_print_tab[tem].opcode == opcode)
544 op_str = op_print_tab[tem].string;
545 myprec = op_print_tab[tem].precedence;
546 assoc = op_print_tab[tem].right_assoc;
549 if (op_print_tab[tem].opcode != opcode)
550 /* Not found; don't try to keep going because we don't know how
551 to interpret further elements. For example, this happens
552 if opcode is OP_TYPE. */
553 error (_("Invalid expression"));
556 /* Note that PREC_BUILTIN will always emit parentheses. */
557 if ((int) myprec < (int) prec)
558 fputs_filtered ("(", stream);
559 if ((int) opcode > (int) BINOP_END)
563 /* Unary postfix operator. */
564 print_subexp (exp, pos, stream, PREC_SUFFIX);
565 fputs_filtered (op_str, stream);
569 /* Unary prefix operator. */
570 fputs_filtered (op_str, stream);
571 if (myprec == PREC_BUILTIN_FUNCTION)
572 fputs_filtered ("(", stream);
573 print_subexp (exp, pos, stream, PREC_PREFIX);
574 if (myprec == PREC_BUILTIN_FUNCTION)
575 fputs_filtered (")", stream);
580 /* Binary operator. */
581 /* Print left operand.
582 If operator is right-associative,
583 increment precedence for this operand. */
584 print_subexp (exp, pos, stream,
585 (enum precedence) ((int) myprec + assoc));
586 /* Print the operator itself. */
588 fprintf_filtered (stream, " %s= ", op_str);
589 else if (op_str[0] == ',')
590 fprintf_filtered (stream, "%s ", op_str);
592 fprintf_filtered (stream, " %s ", op_str);
593 /* Print right operand.
594 If operator is left-associative,
595 increment precedence for this operand. */
596 print_subexp (exp, pos, stream,
597 (enum precedence) ((int) myprec + !assoc));
600 if ((int) myprec < (int) prec)
601 fputs_filtered (")", stream);
604 /* Return the operator corresponding to opcode OP as
605 a string. NULL indicates that the opcode was not found in the
606 current language table. */
608 op_string (enum exp_opcode op)
611 const struct op_print *op_print_tab;
613 op_print_tab = current_language->la_op_print_tab;
614 for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
615 if (op_print_tab[tem].opcode == op)
616 return op_print_tab[tem].string;
620 /* Support for dumping the raw data from expressions in a human readable
623 static char *op_name (struct expression *, enum exp_opcode);
624 static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
626 /* Name for OPCODE, when it appears in expression EXP. */
629 op_name (struct expression *exp, enum exp_opcode opcode)
631 return exp->language_defn->la_exp_desc->op_name (opcode);
634 /* Default name for the standard operator OPCODE (i.e., one defined in
635 the definition of enum exp_opcode). */
638 op_name_standard (enum exp_opcode opcode)
646 sprintf (buf, "<unknown %d>", opcode);
652 #include "std-operator.def"
657 /* Print a raw dump of expression EXP to STREAM.
658 NOTE, if non-NULL, is printed as extra explanatory text. */
661 dump_raw_expression (struct expression *exp, struct ui_file *stream,
669 fprintf_filtered (stream, "Dump of expression @ ");
670 gdb_print_host_address (exp, stream);
672 fprintf_filtered (stream, ", %s:", note);
673 fprintf_filtered (stream, "\n\tLanguage %s, %d elements, %ld bytes each.\n",
674 exp->language_defn->la_name, exp->nelts,
675 (long) sizeof (union exp_element));
676 fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode",
677 "Hex Value", "String Value");
678 for (elt = 0; elt < exp->nelts; elt++)
680 fprintf_filtered (stream, "\t%5d ", elt);
681 opcode_name = op_name (exp, exp->elts[elt].opcode);
683 fprintf_filtered (stream, "%20s ", opcode_name);
684 print_longest (stream, 'd', 0, exp->elts[elt].longconst);
685 fprintf_filtered (stream, " ");
687 for (eltscan = (char *) &exp->elts[elt],
688 eltsize = sizeof (union exp_element);
692 fprintf_filtered (stream, "%c",
693 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
695 fprintf_filtered (stream, "\n");
699 /* Dump the subexpression of prefix expression EXP whose operator is at
700 position ELT onto STREAM. Returns the position of the next
701 subexpression in EXP. */
704 dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
706 static int indent = 0;
709 fprintf_filtered (stream, "\n");
710 fprintf_filtered (stream, "\t%5d ", elt);
712 for (i = 1; i <= indent; i++)
713 fprintf_filtered (stream, " ");
716 fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode));
718 elt = dump_subexp_body (exp, stream, elt);
725 /* Dump the operands of prefix expression EXP whose opcode is at
726 position ELT onto STREAM. Returns the position of the next
727 subexpression in EXP. */
730 dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
732 return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
735 /* Default value for subexp_body in exp_descriptor vector. */
738 dump_subexp_body_standard (struct expression *exp,
739 struct ui_file *stream, int elt)
741 int opcode = exp->elts[elt++].opcode;
747 case TERNOP_SLICE_COUNT:
748 elt = dump_subexp (exp, stream, elt);
757 case BINOP_LOGICAL_AND:
758 case BINOP_LOGICAL_OR:
759 case BINOP_BITWISE_AND:
760 case BINOP_BITWISE_IOR:
761 case BINOP_BITWISE_XOR:
771 case BINOP_SUBSCRIPT:
776 case BINOP_ASSIGN_MODIFY:
782 case STRUCTOP_MEMBER:
784 elt = dump_subexp (exp, stream, elt);
786 case UNOP_LOGICAL_NOT:
787 case UNOP_COMPLEMENT:
790 case UNOP_PREINCREMENT:
791 case UNOP_POSTINCREMENT:
792 case UNOP_PREDECREMENT:
793 case UNOP_POSTDECREMENT:
806 elt = dump_subexp (exp, stream, elt);
809 fprintf_filtered (stream, "Type @");
810 gdb_print_host_address (exp->elts[elt].type, stream);
811 fprintf_filtered (stream, " (");
812 type_print (exp->elts[elt].type, NULL, stream, 0);
813 fprintf_filtered (stream, "), value %ld (0x%lx)",
814 (long) exp->elts[elt + 1].longconst,
815 (long) exp->elts[elt + 1].longconst);
819 fprintf_filtered (stream, "Type @");
820 gdb_print_host_address (exp->elts[elt].type, stream);
821 fprintf_filtered (stream, " (");
822 type_print (exp->elts[elt].type, NULL, stream, 0);
823 fprintf_filtered (stream, "), value %g",
824 (double) exp->elts[elt + 1].doubleconst);
828 fprintf_filtered (stream, "Block @");
829 gdb_print_host_address (exp->elts[elt].block, stream);
830 fprintf_filtered (stream, ", symbol @");
831 gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
832 fprintf_filtered (stream, " (%s)",
833 SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol));
837 fprintf_filtered (stream, "History element %ld",
838 (long) exp->elts[elt].longconst);
842 fprintf_filtered (stream, "Register $%s", &exp->elts[elt + 1].string);
843 elt += 3 + BYTES_TO_EXP_ELEM (exp->elts[elt].longconst + 1);
846 fprintf_filtered (stream, "Internal var @");
847 gdb_print_host_address (exp->elts[elt].internalvar, stream);
848 fprintf_filtered (stream, " (%s)",
849 internalvar_name (exp->elts[elt].internalvar));
856 nargs = longest_to_int (exp->elts[elt].longconst);
858 fprintf_filtered (stream, "Number of args: %d", nargs);
861 for (i = 1; i <= nargs + 1; i++)
862 elt = dump_subexp (exp, stream, elt);
870 lower = longest_to_int (exp->elts[elt].longconst);
871 upper = longest_to_int (exp->elts[elt + 1].longconst);
873 fprintf_filtered (stream, "Bounds [%d:%d]", lower, upper);
876 for (i = 1; i <= upper - lower + 1; i++)
877 elt = dump_subexp (exp, stream, elt);
882 case UNOP_DYNAMIC_CAST:
883 case UNOP_REINTERPRET_CAST:
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, ")");
889 elt = dump_subexp (exp, stream, elt + 2);
891 case UNOP_MEMVAL_TLS:
892 fprintf_filtered (stream, "TLS type @");
893 gdb_print_host_address (exp->elts[elt + 1].type, stream);
894 fprintf_filtered (stream, " (__thread /* \"%s\" */ ",
895 (exp->elts[elt].objfile == NULL ? "(null)"
896 : exp->elts[elt].objfile->name));
897 type_print (exp->elts[elt + 1].type, NULL, stream, 0);
898 fprintf_filtered (stream, ")");
899 elt = dump_subexp (exp, stream, elt + 3);
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, ")");
909 case STRUCTOP_STRUCT:
915 len = longest_to_int (exp->elts[elt].longconst);
916 elem_name = &exp->elts[elt + 1].string;
918 fprintf_filtered (stream, "Element name: `%.*s'", len, elem_name);
919 elt = dump_subexp (exp, stream, elt + 3 + BYTES_TO_EXP_ELEM (len + 1));
927 fprintf_filtered (stream, "Type @");
928 gdb_print_host_address (exp->elts[elt].type, stream);
929 fprintf_filtered (stream, " (");
930 type_print (exp->elts[elt].type, NULL, stream, 0);
931 fprintf_filtered (stream, ") ");
933 len = longest_to_int (exp->elts[elt + 1].longconst);
934 elem_name = &exp->elts[elt + 2].string;
936 fprintf_filtered (stream, "Field name: `%.*s'", len, elem_name);
937 elt += 4 + BYTES_TO_EXP_ELEM (len + 1);
942 case MULTI_SUBSCRIPT:
943 case OP_F77_UNDETERMINED_ARGLIST:
952 fprintf_filtered (stream, "Unknown format");
959 dump_prefix_expression (struct expression *exp, struct ui_file *stream)
963 fprintf_filtered (stream, "Dump of expression @ ");
964 gdb_print_host_address (exp, stream);
965 fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
966 if (exp->elts[0].opcode != OP_TYPE)
967 print_expression (exp, stream);
969 fputs_filtered ("Type printing not yet supported....", stream);
970 fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
971 exp->language_defn->la_name, exp->nelts,
972 (long) sizeof (union exp_element));
973 fputs_filtered ("\n", stream);
975 for (elt = 0; elt < exp->nelts;)
976 elt = dump_subexp (exp, stream, elt);
977 fputs_filtered ("\n", stream);