1c50c785cSJohn Marino/* Standard language operator definitions for GDB, the GNU debugger. 2c50c785cSJohn Marino 3*ef5ccd6cSJohn Marino Copyright (C) 1986-2013 Free Software Foundation, Inc. 4c50c785cSJohn Marino 5c50c785cSJohn Marino This file is part of GDB. 6c50c785cSJohn Marino 7c50c785cSJohn Marino This program is free software; you can redistribute it and/or modify 8c50c785cSJohn Marino it under the terms of the GNU General Public License as published by 9c50c785cSJohn Marino the Free Software Foundation; either version 3 of the License, or 10c50c785cSJohn Marino (at your option) any later version. 11c50c785cSJohn Marino 12c50c785cSJohn Marino This program is distributed in the hope that it will be useful, 13c50c785cSJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of 14c50c785cSJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15c50c785cSJohn Marino GNU General Public License for more details. 16c50c785cSJohn Marino 17c50c785cSJohn Marino You should have received a copy of the GNU General Public License 18c50c785cSJohn Marino along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19c50c785cSJohn Marino 20c50c785cSJohn Marino/* Used when it's necessary to pass an opcode which will be ignored, 21c50c785cSJohn Marino or to catch uninitialized values. */ 22c50c785cSJohn MarinoOP (OP_NULL) 23c50c785cSJohn Marino 24c50c785cSJohn Marino/* BINOP_... operate on two values computed by following subexpressions, 25c50c785cSJohn Marinoreplacing them by one result value. They take no immediate arguments. */ 26c50c785cSJohn Marino 27c50c785cSJohn MarinoOP (BINOP_ADD) /* + */ 28c50c785cSJohn MarinoOP (BINOP_SUB) /* - */ 29c50c785cSJohn MarinoOP (BINOP_MUL) /* * */ 30c50c785cSJohn MarinoOP (BINOP_DIV) /* / */ 31c50c785cSJohn MarinoOP (BINOP_REM) /* % */ 32c50c785cSJohn MarinoOP (BINOP_MOD) /* mod (Knuth 1.2.4) */ 33c50c785cSJohn MarinoOP (BINOP_LSH) /* << */ 34c50c785cSJohn MarinoOP (BINOP_RSH) /* >> */ 35c50c785cSJohn MarinoOP (BINOP_LOGICAL_AND) /* && */ 36c50c785cSJohn MarinoOP (BINOP_LOGICAL_OR) /* || */ 37c50c785cSJohn MarinoOP (BINOP_BITWISE_AND) /* & */ 38c50c785cSJohn MarinoOP (BINOP_BITWISE_IOR) /* | */ 39c50c785cSJohn MarinoOP (BINOP_BITWISE_XOR) /* ^ */ 40c50c785cSJohn MarinoOP (BINOP_EQUAL) /* == */ 41c50c785cSJohn MarinoOP (BINOP_NOTEQUAL) /* != */ 42c50c785cSJohn MarinoOP (BINOP_LESS) /* < */ 43c50c785cSJohn MarinoOP (BINOP_GTR) /* > */ 44c50c785cSJohn MarinoOP (BINOP_LEQ) /* <= */ 45c50c785cSJohn MarinoOP (BINOP_GEQ) /* >= */ 46c50c785cSJohn MarinoOP (BINOP_REPEAT) /* @ */ 47c50c785cSJohn MarinoOP (BINOP_ASSIGN) /* = */ 48c50c785cSJohn MarinoOP (BINOP_COMMA) /* , */ 49c50c785cSJohn MarinoOP (BINOP_SUBSCRIPT) /* x[y] */ 50c50c785cSJohn MarinoOP (BINOP_EXP) /* Exponentiation */ 51c50c785cSJohn Marino 52c50c785cSJohn Marino/* C++. */ 53c50c785cSJohn Marino 54c50c785cSJohn MarinoOP (BINOP_MIN) /* <? */ 55c50c785cSJohn MarinoOP (BINOP_MAX) /* >? */ 56c50c785cSJohn Marino 57c50c785cSJohn Marino/* STRUCTOP_MEMBER is used for pointer-to-member constructs. 58c50c785cSJohn Marino X . * Y translates into X STRUCTOP_MEMBER Y. */ 59c50c785cSJohn MarinoOP (STRUCTOP_MEMBER) 60c50c785cSJohn Marino 61c50c785cSJohn Marino/* STRUCTOP_MPTR is used for pointer-to-member constructs 62c50c785cSJohn Marino when X is a pointer instead of an aggregate. */ 63c50c785cSJohn MarinoOP (STRUCTOP_MPTR) 64c50c785cSJohn Marino 65c50c785cSJohn Marino/* TYPE_INSTANCE is used when the user specifies a specific 66c50c785cSJohn Marino type instantiation for overloaded methods/functions. 67c50c785cSJohn Marino 68c50c785cSJohn Marino The format is: 69c50c785cSJohn Marino TYPE_INSTANCE num_types type0 ... typeN num_types TYPE_INSTANCE. */ 70c50c785cSJohn MarinoOP (TYPE_INSTANCE) 71c50c785cSJohn Marino 72c50c785cSJohn Marino/* end of C++. */ 73c50c785cSJohn Marino 74c50c785cSJohn Marino/* For Modula-2 integer division DIV. */ 75c50c785cSJohn MarinoOP (BINOP_INTDIV) 76c50c785cSJohn Marino 77c50c785cSJohn Marino/* +=, -=, *=, and so on. The following exp_element is another opcode, 78c50c785cSJohn Marino a BINOP_, saying how to modify. Then comes another BINOP_ASSIGN_MODIFY, 79c50c785cSJohn Marino making three exp_elements in total. */ 80c50c785cSJohn MarinoOP (BINOP_ASSIGN_MODIFY) 81c50c785cSJohn Marino 82c50c785cSJohn Marino/* Modula-2 standard (binary) procedures. */ 83c50c785cSJohn MarinoOP (BINOP_VAL) 84c50c785cSJohn Marino 85c50c785cSJohn Marino/* Concatenate two operands, such as character strings or bitstrings. 86c50c785cSJohn Marino If the first operand is a integer expression, then it means concatenate 87c50c785cSJohn Marino the second operand with itself that many times. */ 88c50c785cSJohn MarinoOP (BINOP_CONCAT) 89c50c785cSJohn Marino 90c50c785cSJohn Marino/* For (the deleted) Chill and Pascal. */ 91c50c785cSJohn MarinoOP (BINOP_IN) /* Returns 1 iff ARG1 IN ARG2. */ 92c50c785cSJohn Marino 93c50c785cSJohn Marino/* This is the "colon operator" used various places in (the 94c50c785cSJohn Marino deleted) Chill. */ 95c50c785cSJohn MarinoOP (BINOP_RANGE) 96c50c785cSJohn Marino 97c50c785cSJohn Marino/* This must be the highest BINOP_ value, for expprint.c. */ 98c50c785cSJohn MarinoOP (BINOP_END) 99c50c785cSJohn Marino 100c50c785cSJohn Marino/* Operates on three values computed by following subexpressions. */ 101c50c785cSJohn MarinoOP (TERNOP_COND) /* ?: */ 102c50c785cSJohn Marino 103c50c785cSJohn Marino/* A sub-string/sub-array. (the deleted) Chill syntax: 104c50c785cSJohn Marino OP1(OP2:OP3). Return elements OP2 through OP3 of OP1. */ 105c50c785cSJohn MarinoOP (TERNOP_SLICE) 106c50c785cSJohn Marino 107c50c785cSJohn Marino/* Multidimensional subscript operator, such as Modula-2 x[a,b,...]. 108c50c785cSJohn Marino The dimensionality is encoded in the operator, like the number of 109c50c785cSJohn Marino function arguments in OP_FUNCALL, I.E. <OP><dimension><OP>. 110c50c785cSJohn Marino The value of the first following subexpression is subscripted 111c50c785cSJohn Marino by each of the next following subexpressions, one per dimension. */ 112c50c785cSJohn MarinoOP (MULTI_SUBSCRIPT) 113c50c785cSJohn Marino 114c50c785cSJohn Marino/* The OP_... series take immediate following arguments. 115c50c785cSJohn Marino After the arguments come another OP_... (the same one) 116c50c785cSJohn Marino so that the grouping can be recognized from the end. */ 117c50c785cSJohn Marino 118c50c785cSJohn Marino/* OP_LONG is followed by a type pointer in the next exp_element 119c50c785cSJohn Marino and the long constant value in the following exp_element. 120c50c785cSJohn Marino Then comes another OP_LONG. 121c50c785cSJohn Marino Thus, the operation occupies four exp_elements. */ 122c50c785cSJohn MarinoOP (OP_LONG) 123c50c785cSJohn Marino 124c50c785cSJohn Marino/* OP_DOUBLE is similar but takes a DOUBLEST constant instead of a 125c50c785cSJohn Marino long. */ 126c50c785cSJohn MarinoOP (OP_DOUBLE) 127c50c785cSJohn Marino 128c50c785cSJohn Marino/* OP_VAR_VALUE takes one struct block * in the following element, 129c50c785cSJohn Marino and one struct symbol * in the following exp_element, followed 130c50c785cSJohn Marino by another OP_VAR_VALUE, making four exp_elements. If the 131c50c785cSJohn Marino block is non-NULL, evaluate the symbol relative to the 132c50c785cSJohn Marino innermost frame executing in that block; if the block is NULL 133c50c785cSJohn Marino use the selected frame. */ 134c50c785cSJohn MarinoOP (OP_VAR_VALUE) 135c50c785cSJohn Marino 136a45ae5f8SJohn Marino/* OP_VAR_ENTRY_VALUE takes one struct symbol * in the following element, 137a45ae5f8SJohn Marino followed by another OP_VAR_ENTRY_VALUE, making three exp_elements. 138a45ae5f8SJohn Marino somename@entry may mean parameter value as present at the entry of the 139a45ae5f8SJohn Marino current function. Implemented via DW_OP_GNU_entry_value. */ 140a45ae5f8SJohn MarinoOP (OP_VAR_ENTRY_VALUE) 141a45ae5f8SJohn Marino 142c50c785cSJohn Marino/* OP_LAST is followed by an integer in the next exp_element. 143c50c785cSJohn Marino The integer is zero for the last value printed, 144c50c785cSJohn Marino or it is the absolute number of a history element. 145c50c785cSJohn Marino With another OP_LAST at the end, this makes three exp_elements. */ 146c50c785cSJohn MarinoOP (OP_LAST) 147c50c785cSJohn Marino 148c50c785cSJohn Marino/* OP_REGISTER is followed by a string in the next exp_element. 149c50c785cSJohn Marino This is the name of a register to fetch. */ 150c50c785cSJohn MarinoOP (OP_REGISTER) 151c50c785cSJohn Marino 152c50c785cSJohn Marino/* OP_INTERNALVAR is followed by an internalvar ptr in the next 153c50c785cSJohn Marino exp_element. With another OP_INTERNALVAR at the end, this 154c50c785cSJohn Marino makes three exp_elements. */ 155c50c785cSJohn MarinoOP (OP_INTERNALVAR) 156c50c785cSJohn Marino 157c50c785cSJohn Marino/* OP_FUNCALL is followed by an integer in the next exp_element. 158c50c785cSJohn Marino The integer is the number of args to the function call. 159c50c785cSJohn Marino That many plus one values from following subexpressions 160c50c785cSJohn Marino are used, the first one being the function. 161c50c785cSJohn Marino The integer is followed by a repeat of OP_FUNCALL, 162c50c785cSJohn Marino making three exp_elements. */ 163c50c785cSJohn MarinoOP (OP_FUNCALL) 164c50c785cSJohn Marino 165c50c785cSJohn Marino/* OP_OBJC_MSGCALL is followed by a string in the next exp_element 166c50c785cSJohn Marino and then an integer. The string is the selector string. The 167c50c785cSJohn Marino integer is the number of arguments to the message call. That 168c50c785cSJohn Marino many plus one values are used, the first one being the object 169c50c785cSJohn Marino pointer. This is an Objective C message. */ 170c50c785cSJohn MarinoOP (OP_OBJC_MSGCALL) 171c50c785cSJohn Marino 172c50c785cSJohn Marino/* This is EXACTLY like OP_FUNCALL but is semantically different. 173c50c785cSJohn Marino In F77, array subscript expressions, substring expressions and 174c50c785cSJohn Marino function calls are all exactly the same syntactically. They 175c50c785cSJohn Marino may only be disambiguated at runtime. Thus this operator, 176c50c785cSJohn Marino which indicates that we have found something of the form 177c50c785cSJohn Marino <name> ( <stuff> ). */ 178c50c785cSJohn MarinoOP (OP_F77_UNDETERMINED_ARGLIST) 179c50c785cSJohn Marino 180c50c785cSJohn Marino/* OP_COMPLEX takes a type in the following element, followed by another 181c50c785cSJohn Marino OP_COMPLEX, making three exp_elements. It is followed by two double 182c50c785cSJohn Marino args, and converts them into a complex number of the given type. */ 183c50c785cSJohn MarinoOP (OP_COMPLEX) 184c50c785cSJohn Marino 185c50c785cSJohn Marino/* OP_STRING represents a string constant. 186c50c785cSJohn Marino Its format is the same as that of a STRUCTOP, but the string 187c50c785cSJohn Marino data is just made into a string constant when the operation 188c50c785cSJohn Marino is executed. */ 189c50c785cSJohn MarinoOP (OP_STRING) 190c50c785cSJohn Marino 191c50c785cSJohn Marino/* OP_ARRAY creates an array constant out of the following subexpressions. 192c50c785cSJohn Marino It is followed by two exp_elements, the first containing an integer 193c50c785cSJohn Marino that is the lower bound of the array and the second containing another 194c50c785cSJohn Marino integer that is the upper bound of the array. The second integer is 195c50c785cSJohn Marino followed by a repeat of OP_ARRAY, making four exp_elements total. 196c50c785cSJohn Marino The bounds are used to compute the number of following subexpressions 197c50c785cSJohn Marino to consume, as well as setting the bounds in the created array constant. 198c50c785cSJohn Marino The type of the elements is taken from the type of the first subexp, 199c50c785cSJohn Marino and they must all match. */ 200c50c785cSJohn MarinoOP (OP_ARRAY) 201c50c785cSJohn Marino 202c50c785cSJohn Marino/* UNOP_CAST is followed by a type pointer in the next exp_element. 203c50c785cSJohn Marino With another UNOP_CAST at the end, this makes three exp_elements. 204c50c785cSJohn Marino It casts the value of the following subexpression. */ 205c50c785cSJohn MarinoOP (UNOP_CAST) 206c50c785cSJohn Marino 207*ef5ccd6cSJohn Marino/* Like UNOP_CAST, but the type is a subexpression. */ 208*ef5ccd6cSJohn MarinoOP (UNOP_CAST_TYPE) 209*ef5ccd6cSJohn Marino 210c50c785cSJohn Marino/* The C++ dynamic_cast operator. */ 211c50c785cSJohn MarinoOP (UNOP_DYNAMIC_CAST) 212c50c785cSJohn Marino 213c50c785cSJohn Marino/* The C++ reinterpret_cast operator. */ 214c50c785cSJohn MarinoOP (UNOP_REINTERPRET_CAST) 215c50c785cSJohn Marino 216c50c785cSJohn Marino/* UNOP_MEMVAL is followed by a type pointer in the next exp_element 217c50c785cSJohn Marino With another UNOP_MEMVAL at the end, this makes three exp_elements. 218c50c785cSJohn Marino It casts the contents of the word addressed by the value of the 219c50c785cSJohn Marino following subexpression. */ 220c50c785cSJohn MarinoOP (UNOP_MEMVAL) 221c50c785cSJohn Marino 222c50c785cSJohn Marino/* UNOP_MEMVAL_TLS is followed by a `struct objfile' pointer in the next 223c50c785cSJohn Marino exp_element and a type pointer in the following exp_element. 224c50c785cSJohn Marino With another UNOP_MEMVAL_TLS at the end, this makes four exp_elements. 225c50c785cSJohn Marino It casts the contents of the word offsetted by the value of the 226c50c785cSJohn Marino following subexpression from the TLS specified by `struct objfile'. */ 227c50c785cSJohn MarinoOP (UNOP_MEMVAL_TLS) 228c50c785cSJohn Marino 229*ef5ccd6cSJohn Marino/* Like UNOP_MEMVAL, but the type is supplied as a subexpression. */ 230*ef5ccd6cSJohn MarinoOP (UNOP_MEMVAL_TYPE) 231*ef5ccd6cSJohn Marino 232c50c785cSJohn Marino/* UNOP_... operate on one value from a following subexpression 233c50c785cSJohn Marino and replace it with a result. They take no immediate arguments. */ 234c50c785cSJohn Marino 235c50c785cSJohn MarinoOP (UNOP_NEG) /* Unary - */ 236c50c785cSJohn MarinoOP (UNOP_LOGICAL_NOT) /* Unary ! */ 237c50c785cSJohn MarinoOP (UNOP_COMPLEMENT) /* Unary ~ */ 238c50c785cSJohn MarinoOP (UNOP_IND) /* Unary * */ 239c50c785cSJohn MarinoOP (UNOP_ADDR) /* Unary & */ 240c50c785cSJohn MarinoOP (UNOP_PREINCREMENT) /* ++ before an expression */ 241c50c785cSJohn MarinoOP (UNOP_POSTINCREMENT) /* ++ after an expression */ 242c50c785cSJohn MarinoOP (UNOP_PREDECREMENT) /* -- before an expression */ 243c50c785cSJohn MarinoOP (UNOP_POSTDECREMENT) /* -- after an expression */ 244c50c785cSJohn MarinoOP (UNOP_SIZEOF) /* Unary sizeof (followed by expression) */ 245c50c785cSJohn Marino 246c50c785cSJohn MarinoOP (UNOP_PLUS) /* Unary plus */ 247c50c785cSJohn Marino 248c50c785cSJohn MarinoOP (UNOP_CAP) /* Modula-2 standard (unary) procedures */ 249c50c785cSJohn MarinoOP (UNOP_CHR) 250c50c785cSJohn MarinoOP (UNOP_ORD) 251c50c785cSJohn MarinoOP (UNOP_ABS) 252c50c785cSJohn MarinoOP (UNOP_FLOAT) 253c50c785cSJohn MarinoOP (UNOP_HIGH) 254c50c785cSJohn MarinoOP (UNOP_MAX) 255c50c785cSJohn MarinoOP (UNOP_MIN) 256c50c785cSJohn MarinoOP (UNOP_ODD) 257c50c785cSJohn MarinoOP (UNOP_TRUNC) 258c50c785cSJohn Marino 259c50c785cSJohn MarinoOP (OP_BOOL) /* Modula-2 builtin BOOLEAN type */ 260c50c785cSJohn MarinoOP (OP_M2_STRING) /* Modula-2 string constants */ 261c50c785cSJohn Marino 262c50c785cSJohn Marino/* STRUCTOP_... operate on a value from a following subexpression 263c50c785cSJohn Marino by extracting a structure component specified by a string 264c50c785cSJohn Marino that appears in the following exp_elements (as many as needed). 265c50c785cSJohn Marino STRUCTOP_STRUCT is used for "." and STRUCTOP_PTR for "->". 266c50c785cSJohn Marino They differ only in the error message given in case the value is 267c50c785cSJohn Marino not suitable or the structure component specified is not found. 268c50c785cSJohn Marino 269c50c785cSJohn Marino The length of the string follows the opcode, followed by 270c50c785cSJohn Marino BYTES_TO_EXP_ELEM(length) elements containing the data of the 271c50c785cSJohn Marino string, followed by the length again and the opcode again. */ 272c50c785cSJohn Marino 273c50c785cSJohn MarinoOP (STRUCTOP_STRUCT) 274c50c785cSJohn MarinoOP (STRUCTOP_PTR) 275c50c785cSJohn Marino 276c50c785cSJohn Marino/* C++: OP_THIS is just a placeholder for the class instance variable. 277c50c785cSJohn Marino It just comes in a tight (OP_THIS, OP_THIS) pair. */ 278c50c785cSJohn MarinoOP (OP_THIS) 279c50c785cSJohn Marino 280c50c785cSJohn Marino/* Objective C: "@selector" pseudo-operator. */ 281c50c785cSJohn MarinoOP (OP_OBJC_SELECTOR) 282c50c785cSJohn Marino 283c50c785cSJohn Marino/* OP_SCOPE surrounds a type name and a field name. The type 284c50c785cSJohn Marino name is encoded as one element, but the field name stays as 285c50c785cSJohn Marino a string, which, of course, is variable length. */ 286c50c785cSJohn MarinoOP (OP_SCOPE) 287c50c785cSJohn Marino 288c50c785cSJohn Marino/* OP_TYPE is for parsing types, and used with the "ptype" command 289c50c785cSJohn Marino so we can look up types that are qualified by scope, either with 290c50c785cSJohn Marino the GDB "::" operator, or the Modula-2 '.' operator. */ 291c50c785cSJohn MarinoOP (OP_TYPE) 292c50c785cSJohn Marino 293c50c785cSJohn Marino/* An un-looked-up identifier. */ 294c50c785cSJohn MarinoOP (OP_NAME) 295c50c785cSJohn Marino 296c50c785cSJohn Marino/* An Objective C Foundation Class NSString constant. */ 297c50c785cSJohn MarinoOP (OP_OBJC_NSSTRING) 298c50c785cSJohn Marino 299c50c785cSJohn Marino/* A F90 array range operator (for "exp:exp", "exp:", ":exp" and ":"). */ 300c50c785cSJohn MarinoOP (OP_F90_RANGE) 301c50c785cSJohn Marino 302c50c785cSJohn Marino/* OP_DECFLOAT is followed by a type pointer in the next exp_element 303c50c785cSJohn Marino and a dec long constant value in the following exp_element. 304c50c785cSJohn Marino Then comes another OP_DECFLOAT. */ 305c50c785cSJohn MarinoOP (OP_DECFLOAT) 306c50c785cSJohn Marino 307c50c785cSJohn Marino/* OP_ADL_FUNC specifies that the function is to be looked up in an 308c50c785cSJohn Marino Argument Dependent manner (Koenig lookup). */ 309c50c785cSJohn MarinoOP (OP_ADL_FUNC) 310*ef5ccd6cSJohn Marino 311*ef5ccd6cSJohn Marino/* The typeof operator. This has one expression argument, which is 312*ef5ccd6cSJohn Marino evaluated solely for its type. */ 313*ef5ccd6cSJohn MarinoOP (OP_TYPEOF) 314*ef5ccd6cSJohn Marino 315*ef5ccd6cSJohn Marino/* The decltype operator. This has one expression argument, which is 316*ef5ccd6cSJohn Marino evaluated solely for its type. This is similar to typeof, but has 317*ef5ccd6cSJohn Marino slight different semantics. */ 318*ef5ccd6cSJohn MarinoOP (OP_DECLTYPE) 319