diff options
author | Per Bothner <per@bothner.com> | 1992-09-04 07:37:18 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1992-09-04 07:37:18 +0000 |
commit | 35fcebce93a949c589d0569e2b1111c1eb26bc2f (patch) | |
tree | 4bf217c00c7022660422bac10180344a14020b9d /gdb/expression.h | |
parent | d73812a1d62890a28f3be4054614e16690a1b029 (diff) | |
download | gdb-35fcebce93a949c589d0569e2b1111c1eb26bc2f.zip gdb-35fcebce93a949c589d0569e2b1111c1eb26bc2f.tar.gz gdb-35fcebce93a949c589d0569e2b1111c1eb26bc2f.tar.bz2 |
A ton of changes to improve C++ debugging. See ChangeLog.
Diffstat (limited to 'gdb/expression.h')
-rw-r--r-- | gdb/expression.h | 82 |
1 files changed, 68 insertions, 14 deletions
diff --git a/gdb/expression.h b/gdb/expression.h index b7a6fff..0ef5c4d 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -1,21 +1,24 @@ /* Definitions for expressions stored in reversed prefix form, for GDB. - Copyright (C) 1986, 1989 Free Software Foundation, Inc. + Copyright 1986, 1989, 1992 Free Software Foundation, Inc. This file is part of GDB. -GDB is free software; you can redistribute it and/or modify +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -GDB is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#if !defined (EXPRESSION_H) +#define EXPRESSION_H 1 /* Definitions for saved C expressions. */ @@ -34,6 +37,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ enum exp_opcode { + /* Used when it's necessary to pass an opcode which will be ignored, + or to catch uninitialized values. */ + OP_NULL, + /* BINOP_... operate on two values computed by following subexpressions, replacing them by one result value. They take no immediate arguments. */ BINOP_ADD, /* + */ @@ -58,6 +65,7 @@ enum exp_opcode BINOP_ASSIGN, /* = */ BINOP_COMMA, /* , */ BINOP_SUBSCRIPT, /* x[y] */ + BINOP_MULTI_SUBSCRIPT, /* Modula-2 x[a,b,...] */ BINOP_EXP, /* Exponentiation */ /* C++. */ @@ -73,7 +81,8 @@ enum exp_opcode STRUCTOP_MPTR, /* end of C++. */ - BINOP_END, + /* For Modula-2 integer division DIV */ + BINOP_INTDIV, BINOP_ASSIGN_MODIFY, /* +=, -=, *=, and so on. The following exp_element is another opcode, @@ -81,6 +90,14 @@ enum exp_opcode Then comes another BINOP_ASSIGN_MODIFY, making three exp_elements in total. */ + /* Modula-2 standard (binary) procedures*/ + BINOP_VAL, + BINOP_INCL, + BINOP_EXCL, + + /* This must be the highest BINOP_ value, for expprint.c. */ + BINOP_END, + /* Operates on three values computed by following subexpressions. */ TERNOP_COND, /* ?: */ @@ -146,6 +163,22 @@ enum exp_opcode UNOP_POSTDECREMENT, /* -- after an expression */ UNOP_SIZEOF, /* Unary sizeof (followed by expression) */ + UNOP_PLUS, /* Unary plus */ + + UNOP_CAP, /* Modula-2 standard (unary) procedures */ + UNOP_CHR, + UNOP_ORD, + UNOP_ABS, + UNOP_FLOAT, + UNOP_HIGH, + UNOP_MAX, + UNOP_MIN, + UNOP_ODD, + UNOP_TRUNC, + + OP_BOOL, /* Modula-2 builtin BOOLEAN type */ + OP_M2_STRING, /* Modula-2 string constants */ + /* STRUCTOP_... operate on a value from a following subexpression by extracting a structure component specified by a string that appears in the following exp_elements (as many as needed). @@ -153,6 +186,11 @@ enum exp_opcode They differ only in the error message given in case the value is not suitable or the structure component specified is not found. + After the sub-expression and before the string is a (struct type*). + This is normally NULL, but is used for the TYPE in a C++ qualified + reference like EXP.TYPE::NAME. (EXP.TYPE1::TYPE2::NAME does + not work, unfortunately.) + The length of the string follows in the next exp_element, (after the string), followed by another STRUCTOP_... code. */ STRUCTOP_STRUCT, @@ -168,6 +206,10 @@ enum exp_opcode a string, which, of course, is variable length. */ OP_SCOPE, + /* OP_TYPE is for parsing types, and used with the "ptype" command + so we can look up types that are qualified by scope, either with + the GDB "::" operator, or the Modula-2 '.' operator. */ + OP_TYPE }; union exp_element @@ -183,18 +225,30 @@ union exp_element struct expression { + const struct language_defn *language_defn; /* language it was entered in */ int nelts; union exp_element elts[1]; }; -/* From expread.y. */ -struct expression *parse_c_expression (); -struct expression *parse_c_1 (); +/* From parse.c */ + +extern struct expression * +parse_expression PARAMS ((char *)); + +extern struct expression * +parse_exp_1 PARAMS ((char **, struct block *, int)); /* The innermost context required by the stack and register variables we've encountered so far. To use this, set it to NULL, then call - parse_c_<whatever>, then look at it. */ + parse_<whatever>, then look at it. */ extern struct block *innermost_block; -/* From expprint.c. */ -void print_expression (); +/* From expprint.c */ + +extern void +print_expression PARAMS ((struct expression *, FILE *)); + +extern char * +op_string PARAMS ((enum exp_opcode)); + +#endif /* !defined (EXPRESSION_H) */ |