0fac7be1d12ded3a30a3fa56606c26921fbb0391
1 /* Definitions for expressions stored in reversed prefix form, for GDB.
2 Copyright (C) 1986 Free Software Foundation, Inc.
4 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5 WARRANTY. No author or distributor accepts responsibility to anyone
6 for the consequences of using it or for whether it serves any
7 particular purpose or works at all, unless he says so in writing.
8 Refer to the GDB General Public License for full details.
10 Everyone is granted permission to copy, modify and redistribute GDB,
11 but only under the conditions described in the GDB General Public
12 License. A copy of this license is supposed to have been given to you
13 along with GDB so you can know your rights and responsibilities. It
14 should be in a file named COPYING. Among other things, the copyright
15 notice and this notice must be preserved on all copies.
17 In other words, go ahead and share GDB, but don't try to stop
18 anyone else from sharing it farther. Help stamp out software hoarding!
21 /* Definitions for saved C expressions. */
23 /* An expression is represented as a vector of union exp_element's.
24 Each exp_element is an opcode, except that some opcodes cause
25 the following exp_element to be treated as a long or double constant
26 or as a variable. The opcodes are obeyed, using a stack for temporaries.
27 The value is left on the temporary stack at the end. */
29 /* When it is necessary to include a string,
30 it can occupy as many exp_elements as it needs.
31 We find the length of the string using strlen,
32 divide to find out how many exp_elements are used up,
33 and skip that many. Strings, like numbers, are indicated
34 by the preceding opcode. */
38 /* BINOP_... operate on two values computed by following subexpressions,
39 replacing them by one result value. They take no immediate arguments. */
53 BINOP_NOTEQUAL
, /* != */
61 BINOP_SUBSCRIPT
, /* x[y] */
62 BINOP_EXP
, /* Exponentiation */
69 /* STRUCTOP_MEMBER is used for pointer-to-member constructs.
70 X . * Y translates into X STRUCTOP_MEMBER Y. */
72 /* STRUCTOP_MPTR is used for pointer-to-member constructs
73 when X is a pointer instead of an aggregate. */
79 BINOP_ASSIGN_MODIFY
, /* +=, -=, *=, and so on.
80 The following exp_element is another opcode,
81 a BINOP_, saying how to modify.
82 Then comes another BINOP_ASSIGN_MODIFY,
83 making three exp_elements in total. */
85 /* Operates on three values computed by following subexpressions. */
88 /* The OP_... series take immediate following arguments.
89 After the arguments come another OP_... (the same one)
90 so that the grouping can be recognized from the end. */
92 /* OP_LONG is followed by a type pointer in the next exp_element
93 and the long constant value in the following exp_element.
94 Then comes another OP_LONG.
95 Thus, the operation occupies four exp_elements. */
98 /* OP_DOUBLE is similar but takes a double constant instead of a long one. */
100 /* OP_VAR_VALUE takes one struct symbol * in the following exp_element,
101 followed by another OP_VAR_VALUE, making three exp_elements. */
103 /* OP_LAST is followed by an integer in the next exp_element.
104 The integer is zero for the last value printed,
105 or it is the absolute number of a history element.
106 With another OP_LAST at the end, this makes three exp_elements. */
108 /* OP_REGISTER is followed by an integer in the next exp_element.
109 This is the number of a register to fetch (as an int).
110 With another OP_REGISTER at the end, this makes three exp_elements. */
112 /* OP_INTERNALVAR is followed by an internalvar ptr in the next exp_element.
113 With another OP_INTERNALVAR at the end, this makes three exp_elements. */
115 /* OP_FUNCALL is followed by an integer in the next exp_element.
116 The integer is the number of args to the function call.
117 That many plus one values from following subexpressions
118 are used, the first one being the function.
119 The integer is followed by a repeat of OP_FUNCALL,
120 making three exp_elements. */
122 /* OP_STRING represents a string constant.
123 Its format is the same as that of a STRUCTOP, but the string
124 data is just made into a string constant when the operation
128 /* UNOP_CAST is followed by a type pointer in the next exp_element.
129 With another UNOP_CAST at the end, this makes three exp_elements.
130 It casts the value of the following subexpression. */
132 /* UNOP_MEMVAL is followed by a type pointer in the next exp_element
133 With another UNOP_MEMVAL at the end, this makes three exp_elements.
134 It casts the contents of the word addressed by the value of the
135 following subexpression. */
137 /* UNOP_... operate on one value from a following subexpression
138 and replace it with a result. They take no immediate arguments. */
139 UNOP_NEG
, /* Unary - */
140 UNOP_ZEROP
, /* Unary ! */
141 UNOP_LOGNOT
, /* Unary ~ */
142 UNOP_IND
, /* Unary * */
143 UNOP_ADDR
, /* Unary & */
144 UNOP_PREINCREMENT
, /* ++ before an expression */
145 UNOP_POSTINCREMENT
, /* ++ after an expression */
146 UNOP_PREDECREMENT
, /* -- before an expression */
147 UNOP_POSTDECREMENT
, /* -- after an expression */
148 UNOP_SIZEOF
, /* Unary sizeof (followed by expression) */
150 /* STRUCTOP_... operate on a value from a following subexpression
151 by extracting a structure component specified by a string
152 that appears in the following exp_elements (as many as needed).
153 STRUCTOP_STRUCT is used for "." and STRUCTOP_PTR for "->".
154 They differ only in the error message given in case the value is
155 not suitable or the structure component specified is not found.
157 The length of the string follows in the next exp_element,
158 (after the string), followed by another STRUCTOP_... code. */
163 /* OP_THIS is just a placeholder for the class instance variable.
164 It just comes in a tight (OP_THIS, OP_THIS) pair. */
167 /* OP_SCOPE surrounds a type name and a field name. The type
168 name is encoded as one element, but the field name stays as
169 a string, which, of course, is variable length. */
176 enum exp_opcode opcode
;
177 struct symbol
*symbol
;
182 struct internalvar
*internalvar
;
188 union exp_element elts
[1];
191 struct expression
*parse_c_expression ();
192 struct expression
*parse_c_1 ();
This page took 0.033482 seconds and 4 git commands to generate.