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