* buildsym.c (patch_subfile_name): Update last_source_file
[external/binutils.git] / gdb / expprint.c
1 /* Print in infix form a struct expression.
2    Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20 #include "defs.h"
21 #include "symtab.h"
22 #include "gdbtypes.h"
23 #include "expression.h"
24 #include "value.h"
25 #include "language.h"
26 #include "parser-defs.h"
27
28 /* Prototypes for local functions */
29
30 static void
31 print_subexp PARAMS ((struct expression *, int *, GDB_FILE *, enum precedence));
32
33 static void
34 print_simple_m2_func PARAMS ((char *, struct expression *, int *, GDB_FILE *));
35
36 void
37 print_expression (exp, stream)
38      struct expression *exp;
39      GDB_FILE *stream;
40 {
41   int pc = 0;
42   print_subexp (exp, &pc, stream, PREC_NULL);
43 }
44
45 /* Print the subexpression of EXP that starts in position POS, on STREAM.
46    PREC is the precedence of the surrounding operator;
47    if the precedence of the main operator of this subexpression is less,
48    parentheses are needed here.  */
49
50 static void
51 print_subexp (exp, pos, stream, prec)
52      register struct expression *exp;
53      register int *pos;
54      GDB_FILE *stream;
55      enum precedence prec;
56 {
57   register unsigned tem;
58   register const struct op_print *op_print_tab;
59   register int pc;
60   unsigned nargs;
61   register char *op_str;
62   int assign_modify = 0;
63   enum exp_opcode opcode;
64   enum precedence myprec = PREC_NULL;
65   /* Set to 1 for a right-associative operator.  */
66   int assoc = 0;
67   value_ptr val;
68   char *tempstr = NULL;
69
70   op_print_tab = exp->language_defn->la_op_print_tab;
71   pc = (*pos)++;
72   opcode = exp->elts[pc].opcode;
73   switch (opcode)
74     {
75     /* Common ops */
76
77     case OP_SCOPE:
78       myprec = PREC_PREFIX;
79       assoc = 0;
80       fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream);
81       fputs_filtered ("::", stream);
82       nargs = longest_to_int (exp->elts[pc + 2].longconst);
83       (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
84       fputs_filtered (&exp->elts[pc + 3].string, stream);
85       return;
86
87     case OP_LONG:
88       (*pos) += 3;
89       value_print (value_from_longest (exp->elts[pc + 1].type,
90                                        exp->elts[pc + 2].longconst),
91                    stream, 0, Val_no_prettyprint);
92       return;
93
94     case OP_DOUBLE:
95       (*pos) += 3;
96       value_print (value_from_double (exp->elts[pc + 1].type,
97                                       exp->elts[pc + 2].doubleconst),
98                    stream, 0, Val_no_prettyprint);
99       return;
100
101     case OP_VAR_VALUE:
102       {
103         struct block *b;
104         (*pos) += 3;
105         b = exp->elts[pc + 1].block;
106         if (b != NULL
107             && BLOCK_FUNCTION (b) != NULL
108             && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)) != NULL)
109           {
110             fputs_filtered (SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)), stream);
111             fputs_filtered ("::", stream);
112           }
113         fputs_filtered (SYMBOL_SOURCE_NAME (exp->elts[pc + 2].symbol), stream);
114       }
115       return;
116
117     case OP_LAST:
118       (*pos) += 2;
119       fprintf_filtered (stream, "$%d",
120                         longest_to_int (exp->elts[pc + 1].longconst));
121       return;
122
123     case OP_REGISTER:
124       (*pos) += 2;
125       fprintf_filtered (stream, "$%s",
126                reg_names[longest_to_int (exp->elts[pc + 1].longconst)]);
127       return;
128
129     case OP_BOOL:
130       (*pos) += 2;
131       fprintf_filtered (stream, "%s",
132                         longest_to_int (exp->elts[pc + 1].longconst)
133                         ? "TRUE" : "FALSE");
134       return;
135
136     case OP_INTERNALVAR:
137       (*pos) += 2;
138       fprintf_filtered (stream, "$%s",
139                internalvar_name (exp->elts[pc + 1].internalvar));
140       return;
141
142     case OP_FUNCALL:
143       (*pos) += 2;
144       nargs = longest_to_int (exp->elts[pc + 1].longconst);
145       print_subexp (exp, pos, stream, PREC_SUFFIX);
146       fputs_filtered (" (", stream);
147       for (tem = 0; tem < nargs; tem++)
148         {
149           if (tem != 0)
150             fputs_filtered (", ", stream);
151           print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
152         }
153       fputs_filtered (")", stream);
154       return;
155
156     case OP_STRING:
157       nargs = longest_to_int (exp -> elts[pc + 1].longconst);
158       (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
159       /* LA_PRINT_STRING will print using the current repeat count threshold.
160          If necessary, we can temporarily set it to zero, or pass it as an
161          additional parameter to LA_PRINT_STRING.  -fnf */
162       LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 0);
163       return;
164
165     case OP_BITSTRING:
166       error ("support for OP_BITSTRING unimplemented");
167       break;
168
169     case OP_ARRAY:
170       (*pos) += 3;
171       nargs = longest_to_int (exp->elts[pc + 2].longconst);
172       nargs -= longest_to_int (exp->elts[pc + 1].longconst);
173       nargs++;
174       tem = 0;
175       if (exp->elts[pc + 4].opcode == OP_LONG
176           && exp->elts[pc + 5].type == builtin_type_char
177           && exp->language_defn->la_language == language_c)
178         {
179           /* Attempt to print C character arrays using string syntax.
180              Walk through the args, picking up one character from each
181              of the OP_LONG expression elements.  If any array element
182              does not match our expection of what we should find for
183              a simple string, revert back to array printing.  Note that
184              the last expression element is an explicit null terminator
185              byte, which doesn't get printed. */
186           tempstr = alloca (nargs);
187           pc += 4;
188           while (tem < nargs)
189             {
190               if (exp->elts[pc].opcode != OP_LONG
191                   || exp->elts[pc + 1].type != builtin_type_char)
192                 {
193                   /* Not a simple array of char, use regular array printing. */
194                   tem = 0;
195                   break;
196                 }
197               else
198                 {
199                   tempstr[tem++] =
200                     longest_to_int (exp->elts[pc + 2].longconst);
201                   pc += 4;
202                 }
203             }
204         }
205       if (tem > 0)
206         {
207           LA_PRINT_STRING (stream, tempstr, nargs - 1, 0);
208           (*pos) = pc;
209         }
210       else
211         {
212           int is_chill = exp->language_defn->la_language == language_chill;
213           fputs_filtered (is_chill ? " [" : " {", stream);
214           for (tem = 0; tem < nargs; tem++)
215             {
216               if (tem != 0)
217                 {
218                   fputs_filtered (", ", stream);
219                 }
220               print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
221             }
222           fputs_filtered (is_chill ? "]" : "}", stream);
223         }
224       return;
225
226     case OP_LABELED:
227       tem = longest_to_int (exp->elts[pc + 1].longconst);
228       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
229
230       if (exp->language_defn->la_language == language_chill)
231         {
232           fputs_filtered (".", stream);
233           fputs_filtered (&exp->elts[pc + 2].string, stream);
234           fputs_filtered (exp->elts[*pos].opcode == OP_LABELED ? ", "
235                           : ": ",
236                           stream);
237         }
238       else
239         {
240           /* Gcc support both these syntaxes.  Unsure which is preferred.  */
241 #if 1
242           fputs_filtered (&exp->elts[pc + 2].string, stream);
243           fputs_filtered (": ", stream);
244 #else
245           fputs_filtered (".", stream);
246           fputs_filtered (&exp->elts[pc + 2].string, stream);
247           fputs_filtered ("=", stream);
248 #endif
249         }
250       print_subexp (exp, pos, stream, PREC_SUFFIX);
251       return;
252
253     case TERNOP_COND:
254       if ((int) prec > (int) PREC_COMMA)
255         fputs_filtered ("(", stream);
256       /* Print the subexpressions, forcing parentheses
257          around any binary operations within them.
258          This is more parentheses than are strictly necessary,
259          but it looks clearer.  */
260       print_subexp (exp, pos, stream, PREC_HYPER);
261       fputs_filtered (" ? ", stream);
262       print_subexp (exp, pos, stream, PREC_HYPER);
263       fputs_filtered (" : ", stream);
264       print_subexp (exp, pos, stream, PREC_HYPER);
265       if ((int) prec > (int) PREC_COMMA)
266         fputs_filtered (")", stream);
267       return;
268
269     case STRUCTOP_STRUCT:
270       tem = longest_to_int (exp->elts[pc + 1].longconst);
271       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
272       print_subexp (exp, pos, stream, PREC_SUFFIX);
273       fputs_filtered (".", stream);
274       fputs_filtered (&exp->elts[pc + 2].string, stream);
275       return;
276
277     /* Will not occur for Modula-2 */
278     case STRUCTOP_PTR:
279       tem = longest_to_int (exp->elts[pc + 1].longconst);
280       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
281       print_subexp (exp, pos, stream, PREC_SUFFIX);
282       fputs_filtered ("->", stream);
283       fputs_filtered (&exp->elts[pc + 2].string, stream);
284       return;
285
286     case BINOP_SUBSCRIPT:
287       print_subexp (exp, pos, stream, PREC_SUFFIX);
288       fputs_filtered ("[", stream);
289       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
290       fputs_filtered ("]", stream);
291       return;
292
293     case UNOP_POSTINCREMENT:
294       print_subexp (exp, pos, stream, PREC_SUFFIX);
295       fputs_filtered ("++", stream);
296       return;
297
298     case UNOP_POSTDECREMENT:
299       print_subexp (exp, pos, stream, PREC_SUFFIX);
300       fputs_filtered ("--", stream);
301       return;
302
303     case UNOP_CAST:
304       (*pos) += 2;
305       if ((int) prec > (int) PREC_PREFIX)
306         fputs_filtered ("(", stream);
307       fputs_filtered ("(", stream);
308       type_print (exp->elts[pc + 1].type, "", stream, 0);
309       fputs_filtered (") ", stream);
310       print_subexp (exp, pos, stream, PREC_PREFIX);
311       if ((int) prec > (int) PREC_PREFIX)
312         fputs_filtered (")", stream);
313       return;
314
315     case UNOP_MEMVAL:
316       (*pos) += 2;
317       if ((int) prec > (int) PREC_PREFIX)
318         fputs_filtered ("(", stream);
319       if (exp->elts[pc + 1].type->code == TYPE_CODE_FUNC &&
320           exp->elts[pc + 3].opcode == OP_LONG) {
321         /* We have a minimal symbol fn, probably.  It's encoded
322            as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
323            Swallow the OP_LONG (including both its opcodes); ignore
324            its type; print the value in the type of the MEMVAL.  */
325         (*pos) += 4;
326         val = value_at_lazy (exp->elts[pc + 1].type,
327                              (CORE_ADDR) exp->elts[pc + 5].longconst);
328         value_print (val, stream, 0, Val_no_prettyprint);
329       } else {
330         fputs_filtered ("{", stream);
331         type_print (exp->elts[pc + 1].type, "", stream, 0);
332         fputs_filtered ("} ", stream);
333         print_subexp (exp, pos, stream, PREC_PREFIX);
334       }
335       if ((int) prec > (int) PREC_PREFIX)
336         fputs_filtered (")", stream);
337       return;
338
339     case BINOP_ASSIGN_MODIFY:
340       opcode = exp->elts[pc + 1].opcode;
341       (*pos) += 2;
342       myprec = PREC_ASSIGN;
343       assoc = 1;
344       assign_modify = 1;
345       op_str = "???";
346       for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
347         if (op_print_tab[tem].opcode == opcode)
348           {
349             op_str = op_print_tab[tem].string;
350             break;
351           }
352       if (op_print_tab[tem].opcode != opcode)
353         /* Not found; don't try to keep going because we don't know how
354            to interpret further elements.  */
355         error ("Invalid expression");
356       break;
357
358     /* C++ ops */
359
360     case OP_THIS:
361       ++(*pos);
362       fputs_filtered ("this", stream);
363       return;
364
365     /* Modula-2 ops */
366
367     case MULTI_SUBSCRIPT:
368       (*pos) += 2;
369       nargs = longest_to_int (exp->elts[pc + 1].longconst);
370       print_subexp (exp, pos, stream, PREC_SUFFIX);
371       fprintf_unfiltered (stream, " [");
372       for (tem = 0; tem < nargs; tem++)
373         {
374           if (tem != 0)
375             fprintf_unfiltered (stream, ", ");
376           print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
377         }
378       fprintf_unfiltered (stream, "]");
379       return;
380
381     case BINOP_VAL:
382       (*pos)+=2;
383       fprintf_unfiltered(stream,"VAL(");
384       type_print(exp->elts[pc+1].type,"",stream,0);
385       fprintf_unfiltered(stream,",");
386       print_subexp(exp,pos,stream,PREC_PREFIX);
387       fprintf_unfiltered(stream,")");
388       return;
389
390     case UNOP_CAP:
391       print_simple_m2_func("CAP",exp,pos,stream);
392       return;
393
394     case UNOP_CHR:
395       print_simple_m2_func("CHR",exp,pos,stream);
396       return;
397
398     case UNOP_ORD:
399       print_simple_m2_func("ORD",exp,pos,stream);
400       return;
401       
402     case UNOP_ABS:
403       print_simple_m2_func("ABS",exp,pos,stream);
404       return;
405
406     case UNOP_FLOAT:
407       print_simple_m2_func("FLOAT",exp,pos,stream);
408       return;
409
410     case UNOP_HIGH:
411       print_simple_m2_func("HIGH",exp,pos,stream);
412       return;
413
414     case UNOP_MAX:
415       print_simple_m2_func("MAX",exp,pos,stream);
416       return;
417
418     case UNOP_MIN:
419       print_simple_m2_func("MIN",exp,pos,stream);
420       return;
421
422     case UNOP_ODD:
423       print_simple_m2_func("ODD",exp,pos,stream);
424       return;
425
426     case UNOP_TRUNC:
427       print_simple_m2_func("TRUNC",exp,pos,stream);
428       return;
429       
430     case BINOP_INCL:
431     case BINOP_EXCL:
432       error("print_subexp:  Not implemented.");
433
434     /* Default ops */
435
436     default:
437       op_str = "???";
438       for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
439         if (op_print_tab[tem].opcode == opcode)
440           {
441             op_str = op_print_tab[tem].string;
442             myprec = op_print_tab[tem].precedence;
443             assoc = op_print_tab[tem].right_assoc;
444             break;
445           }
446       if (op_print_tab[tem].opcode != opcode)
447         /* Not found; don't try to keep going because we don't know how
448            to interpret further elements.  For example, this happens
449            if opcode is OP_TYPE.  */
450         error ("Invalid expression");
451    }
452
453   if ((int) myprec < (int) prec)
454     fputs_filtered ("(", stream);
455   if ((int) opcode > (int) BINOP_END)
456     {
457       if (assoc)
458         {
459           /* Unary postfix operator.  */
460           print_subexp (exp, pos, stream, PREC_SUFFIX);
461           fputs_filtered (op_str, stream);
462         }
463       else
464         {
465           /* Unary prefix operator.  */
466           fputs_filtered (op_str, stream);
467           print_subexp (exp, pos, stream, PREC_PREFIX);
468         }
469     }
470   else
471     {
472       /* Binary operator.  */
473       /* Print left operand.
474          If operator is right-associative,
475          increment precedence for this operand.  */
476       print_subexp (exp, pos, stream,
477                     (enum precedence) ((int) myprec + assoc));
478       /* Print the operator itself.  */
479       if (assign_modify)
480         fprintf_filtered (stream, " %s= ", op_str);
481       else if (op_str[0] == ',')
482         fprintf_filtered (stream, "%s ", op_str);
483       else
484         fprintf_filtered (stream, " %s ", op_str);
485       /* Print right operand.
486          If operator is left-associative,
487          increment precedence for this operand.  */
488       print_subexp (exp, pos, stream,
489                     (enum precedence) ((int) myprec + !assoc));
490     }
491
492   if ((int) myprec < (int) prec)
493     fputs_filtered (")", stream);
494 }
495
496 /* Print out something of the form <s>(<arg>).
497    This is used to print out some builtin Modula-2
498    functions.
499    FIXME:  There is probably some way to get the precedence
500    rules to do this (print a unary operand with parens around it).  */
501 static void
502 print_simple_m2_func(s,exp,pos,stream)
503    char *s;
504    register struct expression *exp;
505    register int *pos;
506    GDB_FILE *stream;
507 {
508    fprintf_unfiltered(stream,"%s(",s);
509    print_subexp(exp,pos,stream,PREC_PREFIX);
510    fprintf_unfiltered(stream,")");
511 }
512    
513 /* Return the operator corresponding to opcode OP as
514    a string.   NULL indicates that the opcode was not found in the
515    current language table.  */
516 char *
517 op_string(op)
518    enum exp_opcode op;
519 {
520   int tem;
521   register const struct op_print *op_print_tab;
522
523   op_print_tab = current_language->la_op_print_tab;
524   for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
525     if (op_print_tab[tem].opcode == op)
526       return op_print_tab[tem].string;
527   return NULL;
528 }
529
530 #ifdef DEBUG_EXPRESSIONS
531
532 /* Support for dumping the raw data from expressions in a human readable
533    form.  */
534
535 void
536 dump_expression (exp, stream, note)
537      struct expression *exp;
538      GDB_FILE *stream;
539      char *note;
540 {
541   int elt;
542   char *opcode_name;
543   char *eltscan;
544   int eltsize;
545
546   fprintf_filtered (stream, "Dump of expression @ ");
547   gdb_print_address (exp, stream);
548   fprintf_filtered (stream, ", %s:\n", note);
549   fprintf_filtered (stream, "\tLanguage %s, %d elements, %d bytes each.\n",
550                     exp->language_defn->la_name, exp -> nelts,
551                     sizeof (union exp_element));
552   fprintf_filtered (stream, "\t%5s  %20s  %16s  %s\n", "Index", "Opcode",
553                     "Hex Value", "String Value");
554   for (elt = 0; elt < exp -> nelts; elt++)
555     {
556       fprintf_filtered (stream, "\t%5d  ", elt);
557       switch (exp -> elts[elt].opcode)
558         {
559           default: opcode_name = "<unknown>"; break;
560           case OP_NULL: opcode_name = "OP_NULL"; break;
561           case BINOP_ADD: opcode_name = "BINOP_ADD"; break;
562           case BINOP_SUB: opcode_name = "BINOP_SUB"; break;
563           case BINOP_MUL: opcode_name = "BINOP_MUL"; break;
564           case BINOP_DIV: opcode_name = "BINOP_DIV"; break;
565           case BINOP_REM: opcode_name = "BINOP_REM"; break;
566           case BINOP_MOD: opcode_name = "BINOP_MOD"; break;
567           case BINOP_LSH: opcode_name = "BINOP_LSH"; break;
568           case BINOP_RSH: opcode_name = "BINOP_RSH"; break;
569           case BINOP_LOGICAL_AND: opcode_name = "BINOP_LOGICAL_AND"; break;
570           case BINOP_LOGICAL_OR: opcode_name = "BINOP_LOGICAL_OR"; break;
571           case BINOP_BITWISE_AND: opcode_name = "BINOP_BITWISE_AND"; break;
572           case BINOP_BITWISE_IOR: opcode_name = "BINOP_BITWISE_IOR"; break;
573           case BINOP_BITWISE_XOR: opcode_name = "BINOP_BITWISE_XOR"; break;
574           case BINOP_EQUAL: opcode_name = "BINOP_EQUAL"; break;
575           case BINOP_NOTEQUAL: opcode_name = "BINOP_NOTEQUAL"; break;
576           case BINOP_LESS: opcode_name = "BINOP_LESS"; break;
577           case BINOP_GTR: opcode_name = "BINOP_GTR"; break;
578           case BINOP_LEQ: opcode_name = "BINOP_LEQ"; break;
579           case BINOP_GEQ: opcode_name = "BINOP_GEQ"; break;
580           case BINOP_REPEAT: opcode_name = "BINOP_REPEAT"; break;
581           case BINOP_ASSIGN: opcode_name = "BINOP_ASSIGN"; break;
582           case BINOP_COMMA: opcode_name = "BINOP_COMMA"; break;
583           case BINOP_SUBSCRIPT: opcode_name = "BINOP_SUBSCRIPT"; break;
584           case MULTI_SUBSCRIPT: opcode_name = "MULTI_SUBSCRIPT"; break;
585           case BINOP_EXP: opcode_name = "BINOP_EXP"; break;
586           case BINOP_MIN: opcode_name = "BINOP_MIN"; break;
587           case BINOP_MAX: opcode_name = "BINOP_MAX"; break;
588           case BINOP_SCOPE: opcode_name = "BINOP_SCOPE"; break;
589           case STRUCTOP_MEMBER: opcode_name = "STRUCTOP_MEMBER"; break;
590           case STRUCTOP_MPTR: opcode_name = "STRUCTOP_MPTR"; break;
591           case BINOP_INTDIV: opcode_name = "BINOP_INTDIV"; break;
592           case BINOP_ASSIGN_MODIFY: opcode_name = "BINOP_ASSIGN_MODIFY"; break;
593           case BINOP_VAL: opcode_name = "BINOP_VAL"; break;
594           case BINOP_INCL: opcode_name = "BINOP_INCL"; break;
595           case BINOP_EXCL: opcode_name = "BINOP_EXCL"; break;
596           case BINOP_CONCAT: opcode_name = "BINOP_CONCAT"; break;
597           case BINOP_END: opcode_name = "BINOP_END"; break;
598           case TERNOP_COND: opcode_name = "TERNOP_COND"; break;
599           case OP_LONG: opcode_name = "OP_LONG"; break;
600           case OP_DOUBLE: opcode_name = "OP_DOUBLE"; break;
601           case OP_VAR_VALUE: opcode_name = "OP_VAR_VALUE"; break;
602           case OP_LAST: opcode_name = "OP_LAST"; break;
603           case OP_REGISTER: opcode_name = "OP_REGISTER"; break;
604           case OP_INTERNALVAR: opcode_name = "OP_INTERNALVAR"; break;
605           case OP_FUNCALL: opcode_name = "OP_FUNCALL"; break;
606           case OP_STRING: opcode_name = "OP_STRING"; break;
607           case OP_BITSTRING: opcode_name = "OP_BITSTRING"; break;
608           case OP_ARRAY: opcode_name = "OP_ARRAY"; break;
609           case UNOP_CAST: opcode_name = "UNOP_CAST"; break;
610           case UNOP_MEMVAL: opcode_name = "UNOP_MEMVAL"; break;
611           case UNOP_NEG: opcode_name = "UNOP_NEG"; break;
612           case UNOP_LOGICAL_NOT: opcode_name = "UNOP_LOGICAL_NOT"; break;
613           case UNOP_COMPLEMENT: opcode_name = "UNOP_COMPLEMENT"; break;
614           case UNOP_IND: opcode_name = "UNOP_IND"; break;
615           case UNOP_ADDR: opcode_name = "UNOP_ADDR"; break;
616           case UNOP_PREINCREMENT: opcode_name = "UNOP_PREINCREMENT"; break;
617           case UNOP_POSTINCREMENT: opcode_name = "UNOP_POSTINCREMENT"; break;
618           case UNOP_PREDECREMENT: opcode_name = "UNOP_PREDECREMENT"; break;
619           case UNOP_POSTDECREMENT: opcode_name = "UNOP_POSTDECREMENT"; break;
620           case UNOP_SIZEOF: opcode_name = "UNOP_SIZEOF"; break;
621           case UNOP_PLUS: opcode_name = "UNOP_PLUS"; break;
622           case UNOP_CAP: opcode_name = "UNOP_CAP"; break;
623           case UNOP_CHR: opcode_name = "UNOP_CHR"; break;
624           case UNOP_ORD: opcode_name = "UNOP_ORD"; break;
625           case UNOP_ABS: opcode_name = "UNOP_ABS"; break;
626           case UNOP_FLOAT: opcode_name = "UNOP_FLOAT"; break;
627           case UNOP_HIGH: opcode_name = "UNOP_HIGH"; break;
628           case UNOP_MAX: opcode_name = "UNOP_MAX"; break;
629           case UNOP_MIN: opcode_name = "UNOP_MIN"; break;
630           case UNOP_ODD: opcode_name = "UNOP_ODD"; break;
631           case UNOP_TRUNC: opcode_name = "UNOP_TRUNC"; break;
632           case OP_BOOL: opcode_name = "OP_BOOL"; break;
633           case OP_M2_STRING: opcode_name = "OP_M2_STRING"; break;
634           case STRUCTOP_STRUCT: opcode_name = "STRUCTOP_STRUCT"; break;
635           case STRUCTOP_PTR: opcode_name = "STRUCTOP_PTR"; break;
636           case OP_THIS: opcode_name = "OP_THIS"; break;
637           case OP_SCOPE: opcode_name = "OP_SCOPE"; break;
638           case OP_TYPE: opcode_name = "OP_TYPE"; break;
639           case OP_LABELED: opcode_name = "OP_LABELED"; break;
640         }
641       fprintf_filtered (stream, "%20s  ", opcode_name);
642       fprintf_filtered (stream,
643 #if defined (PRINTF_HAS_LONG_LONG)
644                         "%ll16x  ",
645 #else
646                         "%l16x  ",
647 #endif
648                         exp -> elts[elt].longconst);
649
650       for (eltscan = (char *) &exp->elts[elt],
651              eltsize = sizeof (union exp_element) ;
652            eltsize-- > 0;
653            eltscan++)
654         {
655           fprintf_filtered (stream, "%c",
656                             isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
657         }
658       fprintf_filtered (stream, "\n");
659     }
660 }
661
662 #endif  /* DEBUG_EXPRESSIONS */