diff options
author | Stu Grossman <grossman@cygnus> | 1991-12-19 01:14:31 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1991-12-19 01:14:31 +0000 |
commit | 0a5d35ed30585c1d079e787f50fe0fd5c309fceb (patch) | |
tree | b9ebff12a9f17d22e87b251ddf28ad734cff1ec1 /gdb/eval.c | |
parent | ce947b9d8d59e341291ff89b3fd1915d25bb78f5 (diff) | |
download | gdb-0a5d35ed30585c1d079e787f50fe0fd5c309fceb.zip gdb-0a5d35ed30585c1d079e787f50fe0fd5c309fceb.tar.gz gdb-0a5d35ed30585c1d079e787f50fe0fd5c309fceb.tar.bz2 |
* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h,
vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r-- | gdb/eval.c | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* Evaluate expressions for GDB. - Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. + Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. This file is part of GDB. @@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <stdio.h> #include "defs.h" -#include "param.h" #include "symtab.h" #include "value.h" #include "expression.h" @@ -96,7 +95,7 @@ parse_to_comma_and_eval (expp) } /* Evaluate an expression in internal prefix form - such as is constructed by expread.y. + such as is constructed by parse.y. See expression.h for info on the format of an expression. */ @@ -109,7 +108,7 @@ static value evaluate_subexp_with_coercion (); enum noside { EVAL_NORMAL, EVAL_SKIP, /* Only effect is to increment pos. */ - EVAL_AVOID_SIDE_EFFECTS, /* Don't modify any variables or + EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or call any functions. The value returned will have the correct type, and will have an @@ -966,7 +965,7 @@ evaluate_subexp_for_address (exp, pos, noside) { value x = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (VALUE_LVAL (x) == lval_memory) - return value_zero (TYPE_POINTER_TYPE (VALUE_TYPE (x)), + return value_zero (lookup_pointer_type (VALUE_TYPE (x)), not_lval); else error ("Attempt to take address of non-lval"); @@ -1052,3 +1051,23 @@ evaluate_subexp_for_sizeof (exp, pos) (LONGEST) TYPE_LENGTH (VALUE_TYPE (val))); } } + +/* Parse a type expression in the string [P..P+LENGTH). */ + +struct type * +parse_and_eval_type (p, length) + char *p; + int length; +{ + char *tmp = (char *)alloca (length + 4); + struct expression *expr; + tmp[0] = '('; + bcopy (p, tmp+1, length); + tmp[length+1] = ')'; + tmp[length+2] = '0'; + tmp[length+3] = '\0'; + expr = parse_expression (tmp); + if (expr->elts[0].opcode != UNOP_CAST) + error ("Internal error in eval_type."); + return expr->elts[1].type; +} |