1 /* Standard language operator definitions for GDB, the GNU debugger.
3 Copyright (C) 1986, 1989, 1992, 1994, 2000, 2003, 2005, 2007-2012
4 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 3 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, see <http://www.gnu.org/licenses/>. */
21 /* Used when it's necessary to pass an opcode which will be ignored,
22 or to catch uninitialized values. */
25 /* BINOP_... operate on two values computed by following subexpressions,
26 replacing them by one result value. They take no immediate arguments. */
28 OP (BINOP_ADD) /* + */
29 OP (BINOP_SUB) /* - */
30 OP (BINOP_MUL) /* * */
31 OP (BINOP_DIV) /* / */
32 OP (BINOP_REM) /* % */
33 OP (BINOP_MOD) /* mod (Knuth 1.2.4) */
34 OP (BINOP_LSH) /* << */
35 OP (BINOP_RSH) /* >> */
36 OP (BINOP_LOGICAL_AND) /* && */
37 OP (BINOP_LOGICAL_OR) /* || */
38 OP (BINOP_BITWISE_AND) /* & */
39 OP (BINOP_BITWISE_IOR) /* | */
40 OP (BINOP_BITWISE_XOR) /* ^ */
41 OP (BINOP_EQUAL) /* == */
42 OP (BINOP_NOTEQUAL) /* != */
43 OP (BINOP_LESS) /* < */
44 OP (BINOP_GTR) /* > */
45 OP (BINOP_LEQ) /* <= */
46 OP (BINOP_GEQ) /* >= */
47 OP (BINOP_REPEAT) /* @ */
48 OP (BINOP_ASSIGN) /* = */
49 OP (BINOP_COMMA) /* , */
50 OP (BINOP_SUBSCRIPT) /* x[y] */
51 OP (BINOP_EXP) /* Exponentiation */
55 OP (BINOP_MIN) /* <? */
56 OP (BINOP_MAX) /* >? */
58 /* STRUCTOP_MEMBER is used for pointer-to-member constructs.
59 X . * Y translates into X STRUCTOP_MEMBER Y. */
62 /* STRUCTOP_MPTR is used for pointer-to-member constructs
63 when X is a pointer instead of an aggregate. */
66 /* TYPE_INSTANCE is used when the user specifies a specific
67 type instantiation for overloaded methods/functions.
70 TYPE_INSTANCE num_types type0 ... typeN num_types TYPE_INSTANCE. */
75 /* For Modula-2 integer division DIV. */
78 /* +=, -=, *=, and so on. The following exp_element is another opcode,
79 a BINOP_, saying how to modify. Then comes another BINOP_ASSIGN_MODIFY,
80 making three exp_elements in total. */
81 OP (BINOP_ASSIGN_MODIFY)
83 /* Modula-2 standard (binary) procedures. */
86 /* Concatenate two operands, such as character strings or bitstrings.
87 If the first operand is a integer expression, then it means concatenate
88 the second operand with itself that many times. */
91 /* For (the deleted) Chill and Pascal. */
92 OP (BINOP_IN) /* Returns 1 iff ARG1 IN ARG2. */
94 /* This is the "colon operator" used various places in (the
98 /* This must be the highest BINOP_ value, for expprint.c. */
101 /* Operates on three values computed by following subexpressions. */
102 OP (TERNOP_COND) /* ?: */
104 /* A sub-string/sub-array. (the deleted) Chill syntax:
105 OP1(OP2:OP3). Return elements OP2 through OP3 of OP1. */
108 /* A sub-string/sub-array. (The deleted) Chill syntax: OP1(OP2 UP
109 OP3). Return OP3 elements of OP1, starting with element
111 OP (TERNOP_SLICE_COUNT)
113 /* Multidimensional subscript operator, such as Modula-2 x[a,b,...].
114 The dimensionality is encoded in the operator, like the number of
115 function arguments in OP_FUNCALL, I.E. <OP><dimension><OP>.
116 The value of the first following subexpression is subscripted
117 by each of the next following subexpressions, one per dimension. */
120 /* The OP_... series take immediate following arguments.
121 After the arguments come another OP_... (the same one)
122 so that the grouping can be recognized from the end. */
124 /* OP_LONG is followed by a type pointer in the next exp_element
125 and the long constant value in the following exp_element.
126 Then comes another OP_LONG.
127 Thus, the operation occupies four exp_elements. */
130 /* OP_DOUBLE is similar but takes a DOUBLEST constant instead of a
134 /* OP_VAR_VALUE takes one struct block * in the following element,
135 and one struct symbol * in the following exp_element, followed
136 by another OP_VAR_VALUE, making four exp_elements. If the
137 block is non-NULL, evaluate the symbol relative to the
138 innermost frame executing in that block; if the block is NULL
139 use the selected frame. */
142 /* OP_VAR_ENTRY_VALUE takes one struct symbol * in the following element,
143 followed by another OP_VAR_ENTRY_VALUE, making three exp_elements.
144 somename@entry may mean parameter value as present at the entry of the
145 current function. Implemented via DW_OP_GNU_entry_value. */
146 OP (OP_VAR_ENTRY_VALUE)
148 /* OP_LAST is followed by an integer in the next exp_element.
149 The integer is zero for the last value printed,
150 or it is the absolute number of a history element.
151 With another OP_LAST at the end, this makes three exp_elements. */
154 /* OP_REGISTER is followed by a string in the next exp_element.
155 This is the name of a register to fetch. */
158 /* OP_INTERNALVAR is followed by an internalvar ptr in the next
159 exp_element. With another OP_INTERNALVAR at the end, this
160 makes three exp_elements. */
163 /* OP_FUNCALL is followed by an integer in the next exp_element.
164 The integer is the number of args to the function call.
165 That many plus one values from following subexpressions
166 are used, the first one being the function.
167 The integer is followed by a repeat of OP_FUNCALL,
168 making three exp_elements. */
171 /* OP_OBJC_MSGCALL is followed by a string in the next exp_element
172 and then an integer. The string is the selector string. The
173 integer is the number of arguments to the message call. That
174 many plus one values are used, the first one being the object
175 pointer. This is an Objective C message. */
178 /* This is EXACTLY like OP_FUNCALL but is semantically different.
179 In F77, array subscript expressions, substring expressions and
180 function calls are all exactly the same syntactically. They
181 may only be disambiguated at runtime. Thus this operator,
182 which indicates that we have found something of the form
183 <name> ( <stuff> ). */
184 OP (OP_F77_UNDETERMINED_ARGLIST)
186 /* OP_COMPLEX takes a type in the following element, followed by another
187 OP_COMPLEX, making three exp_elements. It is followed by two double
188 args, and converts them into a complex number of the given type. */
191 /* OP_STRING represents a string constant.
192 Its format is the same as that of a STRUCTOP, but the string
193 data is just made into a string constant when the operation
197 /* OP_BITSTRING represents a packed bitstring constant.
198 Its format is the same as that of a STRUCTOP, but the bitstring
199 data is just made into a bitstring constant when the operation
203 /* OP_ARRAY creates an array constant out of the following subexpressions.
204 It is followed by two exp_elements, the first containing an integer
205 that is the lower bound of the array and the second containing another
206 integer that is the upper bound of the array. The second integer is
207 followed by a repeat of OP_ARRAY, making four exp_elements total.
208 The bounds are used to compute the number of following subexpressions
209 to consume, as well as setting the bounds in the created array constant.
210 The type of the elements is taken from the type of the first subexp,
211 and they must all match. */
214 /* UNOP_CAST is followed by a type pointer in the next exp_element.
215 With another UNOP_CAST at the end, this makes three exp_elements.
216 It casts the value of the following subexpression. */
219 /* The C++ dynamic_cast operator. */
220 OP (UNOP_DYNAMIC_CAST)
222 /* The C++ reinterpret_cast operator. */
223 OP (UNOP_REINTERPRET_CAST)
225 /* UNOP_MEMVAL is followed by a type pointer in the next exp_element
226 With another UNOP_MEMVAL at the end, this makes three exp_elements.
227 It casts the contents of the word addressed by the value of the
228 following subexpression. */
231 /* UNOP_MEMVAL_TLS is followed by a `struct objfile' pointer in the next
232 exp_element and a type pointer in the following exp_element.
233 With another UNOP_MEMVAL_TLS at the end, this makes four exp_elements.
234 It casts the contents of the word offsetted by the value of the
235 following subexpression from the TLS specified by `struct objfile'. */
238 /* UNOP_... operate on one value from a following subexpression
239 and replace it with a result. They take no immediate arguments. */
241 OP (UNOP_NEG) /* Unary - */
242 OP (UNOP_LOGICAL_NOT) /* Unary ! */
243 OP (UNOP_COMPLEMENT) /* Unary ~ */
244 OP (UNOP_IND) /* Unary * */
245 OP (UNOP_ADDR) /* Unary & */
246 OP (UNOP_PREINCREMENT) /* ++ before an expression */
247 OP (UNOP_POSTINCREMENT) /* ++ after an expression */
248 OP (UNOP_PREDECREMENT) /* -- before an expression */
249 OP (UNOP_POSTDECREMENT) /* -- after an expression */
250 OP (UNOP_SIZEOF) /* Unary sizeof (followed by expression) */
252 OP (UNOP_PLUS) /* Unary plus */
254 OP (UNOP_CAP) /* Modula-2 standard (unary) procedures */
265 OP (OP_BOOL) /* Modula-2 builtin BOOLEAN type */
266 OP (OP_M2_STRING) /* Modula-2 string constants */
268 /* STRUCTOP_... operate on a value from a following subexpression
269 by extracting a structure component specified by a string
270 that appears in the following exp_elements (as many as needed).
271 STRUCTOP_STRUCT is used for "." and STRUCTOP_PTR for "->".
272 They differ only in the error message given in case the value is
273 not suitable or the structure component specified is not found.
275 The length of the string follows the opcode, followed by
276 BYTES_TO_EXP_ELEM(length) elements containing the data of the
277 string, followed by the length again and the opcode again. */
282 /* C++: OP_THIS is just a placeholder for the class instance variable.
283 It just comes in a tight (OP_THIS, OP_THIS) pair. */
286 /* Objective C: "@selector" pseudo-operator. */
287 OP (OP_OBJC_SELECTOR)
289 /* OP_SCOPE surrounds a type name and a field name. The type
290 name is encoded as one element, but the field name stays as
291 a string, which, of course, is variable length. */
294 /* Used to represent named structure field values in brace
295 initializers (or tuples as they are called in (the deleted)
298 The gcc C syntax is NAME:VALUE or .NAME=VALUE, the (the
299 deleted) Chill syntax is .NAME:VALUE. Multiple labels (as in
300 the (the deleted) Chill syntax .NAME1,.NAME2:VALUE) is
301 represented as if it were .NAME1:(.NAME2:VALUE) (though that is
302 not valid (the deleted) Chill syntax).
304 The NAME is represented as for STRUCTOP_STRUCT; VALUE follows. */
307 /* OP_TYPE is for parsing types, and used with the "ptype" command
308 so we can look up types that are qualified by scope, either with
309 the GDB "::" operator, or the Modula-2 '.' operator. */
312 /* An un-looked-up identifier. */
315 /* An Objective C Foundation Class NSString constant. */
316 OP (OP_OBJC_NSSTRING)
318 /* A F90 array range operator (for "exp:exp", "exp:", ":exp" and ":"). */
321 /* OP_DECFLOAT is followed by a type pointer in the next exp_element
322 and a dec long constant value in the following exp_element.
323 Then comes another OP_DECFLOAT. */
326 /* OP_ADL_FUNC specifies that the function is to be looked up in an
327 Argument Dependent manner (Koenig lookup). */