* ch-exp.c (parse_tuple_element): Allow (*): for array tuples
if we have a type. * eval.c (evaluate_subexp_standard): In case of OP_ARRAY: check number of args against bounds of array to avoid memory corruption. * value.h (COERCE_REF): Do a CHECK_TYPEDEF in case we get a TYPE_CODE_TYPEDEF.
This commit is contained in:
parent
711254da6c
commit
b5865bb263
4 changed files with 160 additions and 78 deletions
|
@ -1,3 +1,24 @@
|
|||
Wed Sep 4 06:49:35 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com>
|
||||
|
||||
* ch-exp.c (parse_tuple_element): Allow (*): for array tuples
|
||||
if we have a type.
|
||||
|
||||
* eval.c (evaluate_subexp_standard): In case of OP_ARRAY:
|
||||
check number of args against bounds of array to avoid
|
||||
memory corruption.
|
||||
|
||||
* value.h (COERCE_REF): Do a CHECK_TYPEDEF in case we get
|
||||
a TYPE_CODE_TYPEDEF.
|
||||
|
||||
Fri Aug 30 15:07:14 1996 James G. Smith <jsmith@cygnus.co.uk>
|
||||
|
||||
* remote-mips.c: Provide support for CAIRO target board.
|
||||
(cairo_open, cairo_ops): Added.
|
||||
(mips_monitor_type): MON_CAIRO Added.
|
||||
(mips_enter_debug, mips_exit_debug, mips_initialize,
|
||||
mips_fetch_registers, common_breakpoint, mips_load,
|
||||
_initialize_remote_mips): Updated.
|
||||
|
||||
Thu Aug 29 17:00:18 1996 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||
|
||||
* nlm/configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
|
||||
|
|
51
gdb/ch-exp.c
51
gdb/ch-exp.c
|
@ -161,8 +161,8 @@ static void parse_operand5 PARAMS ((void));
|
|||
static void parse_operand6 PARAMS ((void));
|
||||
static void parse_primval PARAMS ((void));
|
||||
static void parse_tuple PARAMS ((struct type *));
|
||||
static void parse_opt_element_list PARAMS ((void));
|
||||
static void parse_tuple_element PARAMS ((void));
|
||||
static void parse_opt_element_list PARAMS ((struct type *));
|
||||
static void parse_tuple_element PARAMS ((struct type *));
|
||||
static void parse_named_record_element PARAMS ((void));
|
||||
static void parse_call PARAMS ((void));
|
||||
static struct type *parse_mode_or_normal_call PARAMS ((void));
|
||||
|
@ -549,10 +549,11 @@ parse_named_record_element ()
|
|||
write_exp_elt_opcode (OP_LABELED);
|
||||
}
|
||||
|
||||
/* Returns one or nore TREE_LIST nodes, in reverse order. */
|
||||
/* Returns one or more TREE_LIST nodes, in reverse order. */
|
||||
|
||||
static void
|
||||
parse_tuple_element ()
|
||||
parse_tuple_element (type)
|
||||
struct type *type;
|
||||
{
|
||||
if (PEEK_TOKEN () == FIELD_NAME)
|
||||
{
|
||||
|
@ -566,7 +567,32 @@ parse_tuple_element ()
|
|||
if (check_token ('*'))
|
||||
{
|
||||
expect (')', "missing ')' after '*' case label list");
|
||||
error ("(*) not implemented in case label list");
|
||||
if (type)
|
||||
{
|
||||
if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
|
||||
{
|
||||
/* do this as a range from low to high */
|
||||
struct type *range_type = TYPE_FIELD_TYPE (type, 0);
|
||||
LONGEST low_bound, high_bound;
|
||||
if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
|
||||
error ("cannot determine bounds for (*)");
|
||||
/* lower bound */
|
||||
write_exp_elt_opcode (OP_LONG);
|
||||
write_exp_elt_type (range_type);
|
||||
write_exp_elt_longcst (low_bound);
|
||||
write_exp_elt_opcode (OP_LONG);
|
||||
/* upper bound */
|
||||
write_exp_elt_opcode (OP_LONG);
|
||||
write_exp_elt_type (range_type);
|
||||
write_exp_elt_longcst (high_bound);
|
||||
write_exp_elt_opcode (OP_LONG);
|
||||
write_exp_elt_opcode (BINOP_RANGE);
|
||||
}
|
||||
else
|
||||
error ("(*) in invalid context");
|
||||
}
|
||||
else
|
||||
error ("(*) only possible with modename in front of tuple (mode[..])");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -592,14 +618,15 @@ parse_tuple_element ()
|
|||
/* Matches: a COMMA-separated list of tuple elements.
|
||||
Returns a list (of TREE_LIST nodes). */
|
||||
static void
|
||||
parse_opt_element_list ()
|
||||
parse_opt_element_list (type)
|
||||
struct type *type;
|
||||
{
|
||||
arglist_len = 0;
|
||||
if (PEEK_TOKEN () == ']')
|
||||
return;
|
||||
for (;;)
|
||||
{
|
||||
parse_tuple_element ();
|
||||
parse_tuple_element (type);
|
||||
arglist_len++;
|
||||
if (PEEK_TOKEN () == ']')
|
||||
break;
|
||||
|
@ -615,17 +642,21 @@ static void
|
|||
parse_tuple (mode)
|
||||
struct type *mode;
|
||||
{
|
||||
struct type *type;
|
||||
if (mode)
|
||||
type = check_typedef (mode);
|
||||
else
|
||||
type = 0;
|
||||
require ('[');
|
||||
start_arglist ();
|
||||
parse_opt_element_list ();
|
||||
parse_opt_element_list (type);
|
||||
expect (']', "missing ']' after tuple");
|
||||
write_exp_elt_opcode (OP_ARRAY);
|
||||
write_exp_elt_longcst ((LONGEST) 0);
|
||||
write_exp_elt_longcst ((LONGEST) end_arglist () - 1);
|
||||
write_exp_elt_opcode (OP_ARRAY);
|
||||
if (mode)
|
||||
if (type)
|
||||
{
|
||||
struct type *type = check_typedef (mode);
|
||||
if (TYPE_CODE (type) != TYPE_CODE_ARRAY
|
||||
&& TYPE_CODE (type) != TYPE_CODE_STRUCT
|
||||
&& TYPE_CODE (type) != TYPE_CODE_SET)
|
||||
|
|
102
gdb/eval.c
102
gdb/eval.c
|
@ -1,5 +1,5 @@
|
|||
/* Evaluate expressions for GDB.
|
||||
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
|
||||
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
@ -43,6 +43,19 @@ static value_ptr evaluate_subexp_for_sizeof PARAMS ((struct expression *,
|
|||
static value_ptr evaluate_subexp_for_address PARAMS ((struct expression *,
|
||||
int *, enum noside));
|
||||
|
||||
static value_ptr evaluate_subexp PARAMS ((struct type *, struct expression *,
|
||||
int *, enum noside));
|
||||
|
||||
static char *get_label PARAMS ((struct expression *, int *));
|
||||
|
||||
static value_ptr
|
||||
evaluate_struct_tuple PARAMS ((value_ptr, struct expression *, int *,
|
||||
enum noside, int));
|
||||
|
||||
static LONGEST
|
||||
init_array_element PARAMS ((value_ptr, value_ptr, struct expression *,
|
||||
int *, enum noside, LONGEST, LONGEST));
|
||||
|
||||
#ifdef __GNUC__
|
||||
inline
|
||||
#endif
|
||||
|
@ -321,6 +334,7 @@ init_array_element (array, element, exp, pos, noside, low_bound, high_bound)
|
|||
register struct expression *exp;
|
||||
register int *pos;
|
||||
enum noside noside;
|
||||
LONGEST low_bound, high_bound;
|
||||
{
|
||||
LONGEST index;
|
||||
int element_size = TYPE_LENGTH (VALUE_TYPE (element));
|
||||
|
@ -510,6 +524,9 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
low_bound = 0;
|
||||
high_bound = (TYPE_LENGTH (type) / element_size) - 1;
|
||||
}
|
||||
if (nargs > (high_bound - low_bound + 1))
|
||||
/* to avoid memory corruption */
|
||||
error ("Too many array elements");
|
||||
index = low_bound;
|
||||
memset (VALUE_CONTENTS_RAW (array), 0, TYPE_LENGTH (expect_type));
|
||||
for (tem = nargs; --nargs >= 0; )
|
||||
|
@ -1032,7 +1049,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
else
|
||||
return value_concat (arg1, arg2);
|
||||
|
||||
|
@ -1042,7 +1059,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||
return arg1;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
else
|
||||
return value_assign (arg1, arg2);
|
||||
|
||||
|
@ -1054,7 +1071,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
return arg1;
|
||||
op = exp->elts[pc + 1].opcode;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op);
|
||||
return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside);
|
||||
else if (op == BINOP_ADD)
|
||||
arg2 = value_add (arg1, arg2);
|
||||
else if (op == BINOP_SUB)
|
||||
|
@ -1069,7 +1086,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
else
|
||||
return value_add (arg1, arg2);
|
||||
|
||||
|
@ -1079,7 +1096,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
else
|
||||
return value_sub (arg1, arg2);
|
||||
|
||||
|
@ -1097,7 +1114,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
else
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS
|
||||
&& (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
|
||||
|
@ -1117,24 +1134,31 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||
{
|
||||
/* If the user attempts to subscript something that has no target
|
||||
type (like a plain int variable for example), then report this
|
||||
as an error. */
|
||||
|
||||
type = TYPE_TARGET_TYPE (check_typedef (VALUE_TYPE (arg1)));
|
||||
if (type)
|
||||
return value_zero (type, VALUE_LVAL (arg1));
|
||||
else
|
||||
error ("cannot subscript something of type `%s'",
|
||||
TYPE_NAME (VALUE_TYPE (arg1)));
|
||||
}
|
||||
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
else
|
||||
return value_subscript (arg1, arg2);
|
||||
{
|
||||
/* If the user attempts to subscript something that is not an
|
||||
array or pointer type (like a plain int variable for example),
|
||||
then report this as an error. */
|
||||
|
||||
COERCE_REF (arg1);
|
||||
type = check_typedef (VALUE_TYPE (arg1));
|
||||
if (TYPE_CODE (type) != TYPE_CODE_ARRAY
|
||||
&& TYPE_CODE (type) != TYPE_CODE_PTR)
|
||||
{
|
||||
if (TYPE_NAME (type))
|
||||
error ("cannot subscript something of type `%s'",
|
||||
TYPE_NAME (type));
|
||||
else
|
||||
error ("cannot subscript requested type");
|
||||
}
|
||||
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||
return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
|
||||
else
|
||||
return value_subscript (arg1, arg2);
|
||||
}
|
||||
|
||||
case BINOP_IN:
|
||||
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
|
@ -1185,7 +1209,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
arg1 = value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
arg1 = value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1289,7 +1313,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1315,7 +1339,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1333,7 +1357,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1348,7 +1372,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1363,7 +1387,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1378,7 +1402,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1393,7 +1417,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1408,7 +1432,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
{
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1440,7 +1464,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (unop_user_defined_p (op, arg1))
|
||||
return value_x_unop (arg1, op);
|
||||
return value_x_unop (arg1, op, noside);
|
||||
else
|
||||
return value_neg (arg1);
|
||||
|
||||
|
@ -1452,7 +1476,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (unop_user_defined_p (UNOP_COMPLEMENT, arg1))
|
||||
return value_x_unop (arg1, UNOP_COMPLEMENT);
|
||||
return value_x_unop (arg1, UNOP_COMPLEMENT, noside);
|
||||
else
|
||||
return value_complement (arg1);
|
||||
|
||||
|
@ -1461,7 +1485,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (unop_user_defined_p (op, arg1))
|
||||
return value_x_unop (arg1, op);
|
||||
return value_x_unop (arg1, op, noside);
|
||||
else
|
||||
return value_from_longest (builtin_type_int,
|
||||
(LONGEST) value_logical_not (arg1));
|
||||
|
@ -1544,7 +1568,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
return arg1;
|
||||
else if (unop_user_defined_p (op, arg1))
|
||||
{
|
||||
return value_x_unop (arg1, op);
|
||||
return value_x_unop (arg1, op, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1559,7 +1583,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
return arg1;
|
||||
else if (unop_user_defined_p (op, arg1))
|
||||
{
|
||||
return value_x_unop (arg1, op);
|
||||
return value_x_unop (arg1, op, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1574,7 +1598,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
return arg1;
|
||||
else if (unop_user_defined_p (op, arg1))
|
||||
{
|
||||
return value_x_unop (arg1, op);
|
||||
return value_x_unop (arg1, op, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1590,7 +1614,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
|||
return arg1;
|
||||
else if (unop_user_defined_p (op, arg1))
|
||||
{
|
||||
return value_x_unop (arg1, op);
|
||||
return value_x_unop (arg1, op, noside);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
64
gdb/value.h
64
gdb/value.h
|
@ -1,5 +1,6 @@
|
|||
/* Definitions for values of C expressions, for GDB.
|
||||
Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -15,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (VALUE_H)
|
||||
#define VALUE_H 1
|
||||
|
@ -88,10 +89,6 @@ struct value
|
|||
char *myaddr;
|
||||
} substring_addr;
|
||||
|
||||
/* If an lval is forced to repeat, a new value is created with
|
||||
these fields set. The new value is not an lval. */
|
||||
short repeated;
|
||||
short repetitions;
|
||||
/* Register number if the value is from a register. Is not kept
|
||||
if you take a field of a structure that is stored in a
|
||||
register. Shouldn't it be? */
|
||||
|
@ -142,18 +139,18 @@ extern int value_fetch_lazy PARAMS ((value_ptr val));
|
|||
#define VALUE_BITSIZE(val) (val)->bitsize
|
||||
#define VALUE_BITPOS(val) (val)->bitpos
|
||||
#define VALUE_NEXT(val) (val)->next
|
||||
#define VALUE_REPEATED(val) (val)->repeated
|
||||
#define VALUE_REPETITIONS(val) (val)->repetitions
|
||||
#define VALUE_REGNO(val) (val)->regno
|
||||
#define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
|
||||
|
||||
/* Convert a REF to the object referenced. */
|
||||
|
||||
#define COERCE_REF(arg) \
|
||||
{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF) \
|
||||
arg = value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg)), \
|
||||
unpack_long (VALUE_TYPE (arg), \
|
||||
VALUE_CONTENTS (arg)));}
|
||||
do { CHECK_TYPEDEF (VALUE_TYPE (arg)); \
|
||||
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF) \
|
||||
arg = value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg)), \
|
||||
unpack_long (VALUE_TYPE (arg), \
|
||||
VALUE_CONTENTS (arg))); \
|
||||
} while (0)
|
||||
|
||||
/* If ARG is an array, convert it to a pointer.
|
||||
If ARG is an enum, convert it to an integer.
|
||||
|
@ -162,24 +159,24 @@ extern int value_fetch_lazy PARAMS ((value_ptr val));
|
|||
References are dereferenced. */
|
||||
|
||||
#define COERCE_ARRAY(arg) \
|
||||
{ COERCE_REF(arg); \
|
||||
do { COERCE_REF(arg); \
|
||||
if (current_language->c_style_arrays \
|
||||
&& (VALUE_REPEATED (arg) \
|
||||
|| TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)) \
|
||||
&& TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) \
|
||||
arg = value_coerce_array (arg); \
|
||||
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC) \
|
||||
arg = value_coerce_function (arg); \
|
||||
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
|
||||
arg = value_cast (builtin_type_unsigned_int, arg); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define COERCE_VARYING_ARRAY(arg) \
|
||||
{ if (chill_varying_type (VALUE_TYPE (arg))) arg = varying_to_slice (arg); }
|
||||
#define COERCE_NUMBER(arg) \
|
||||
do { COERCE_ARRAY(arg); COERCE_ENUM(arg); } while (0)
|
||||
|
||||
#define COERCE_VARYING_ARRAY(arg, real_arg_type) \
|
||||
{ if (chill_varying_type (real_arg_type)) \
|
||||
arg = varying_to_slice (arg), real_arg_type = VALUE_TYPE (arg); }
|
||||
|
||||
/* If ARG is an enum, convert it to an integer. */
|
||||
|
||||
#define COERCE_ENUM(arg) \
|
||||
{ COERCE_REF (arg); \
|
||||
#define COERCE_ENUM(arg) { \
|
||||
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
|
||||
arg = value_cast (builtin_type_unsigned_int, arg); \
|
||||
}
|
||||
|
@ -215,14 +212,14 @@ print_address_demangle PARAMS ((CORE_ADDR, GDB_FILE *, int));
|
|||
|
||||
extern LONGEST value_as_long PARAMS ((value_ptr val));
|
||||
|
||||
extern double value_as_double PARAMS ((value_ptr val));
|
||||
extern DOUBLEST value_as_double PARAMS ((value_ptr val));
|
||||
|
||||
extern CORE_ADDR value_as_pointer PARAMS ((value_ptr val));
|
||||
|
||||
extern LONGEST unpack_long PARAMS ((struct type *type, char *valaddr));
|
||||
|
||||
extern double unpack_double PARAMS ((struct type *type, char *valaddr,
|
||||
int *invp));
|
||||
extern DOUBLEST unpack_double PARAMS ((struct type *type, char *valaddr,
|
||||
int *invp));
|
||||
|
||||
extern CORE_ADDR unpack_pointer PARAMS ((struct type *type, char *valaddr));
|
||||
|
||||
|
@ -231,7 +228,7 @@ extern LONGEST unpack_field_as_long PARAMS ((struct type *type, char *valaddr,
|
|||
|
||||
extern value_ptr value_from_longest PARAMS ((struct type *type, LONGEST num));
|
||||
|
||||
extern value_ptr value_from_double PARAMS ((struct type *type, double num));
|
||||
extern value_ptr value_from_double PARAMS ((struct type *type, DOUBLEST num));
|
||||
|
||||
extern value_ptr value_at PARAMS ((struct type *type, CORE_ADDR addr));
|
||||
|
||||
|
@ -334,6 +331,9 @@ extern value_ptr evaluate_expression PARAMS ((struct expression *exp));
|
|||
|
||||
extern value_ptr evaluate_type PARAMS ((struct expression *exp));
|
||||
|
||||
extern value_ptr evaluate_subexp_with_coercion PARAMS ((struct expression *,
|
||||
int *, enum noside));
|
||||
|
||||
extern value_ptr parse_and_eval PARAMS ((char *exp));
|
||||
|
||||
extern value_ptr parse_to_comma_and_eval PARAMS ((char **expp));
|
||||
|
@ -369,9 +369,11 @@ extern value_ptr value_of_this PARAMS ((int complain));
|
|||
|
||||
extern value_ptr value_x_binop PARAMS ((value_ptr arg1, value_ptr arg2,
|
||||
enum exp_opcode op,
|
||||
enum exp_opcode otherop));
|
||||
enum exp_opcode otherop,
|
||||
enum noside noside));
|
||||
|
||||
extern value_ptr value_x_unop PARAMS ((value_ptr arg1, enum exp_opcode op));
|
||||
extern value_ptr value_x_unop PARAMS ((value_ptr arg1, enum exp_opcode op,
|
||||
enum noside noside));
|
||||
|
||||
extern value_ptr value_fn_field PARAMS ((value_ptr *arg1p, struct fn_field *f,
|
||||
int j,
|
||||
|
@ -479,7 +481,7 @@ clear_internalvars PARAMS ((void));
|
|||
|
||||
extern value_ptr value_copy PARAMS ((value_ptr));
|
||||
|
||||
extern int baseclass_offset PARAMS ((struct type *, int, value_ptr, int));
|
||||
extern int baseclass_offset PARAMS ((struct type *, int, char *, CORE_ADDR));
|
||||
|
||||
/* From valops.c */
|
||||
|
||||
|
@ -491,4 +493,8 @@ extern value_ptr call_function_by_hand PARAMS ((value_ptr, int, value_ptr *));
|
|||
|
||||
extern value_ptr value_literal_complex PARAMS ((value_ptr, value_ptr, struct type*));
|
||||
|
||||
extern value_ptr find_function_in_inferior PARAMS ((char *));
|
||||
|
||||
extern value_ptr value_allocate_space_in_inferior PARAMS ((int));
|
||||
|
||||
#endif /* !defined (VALUE_H) */
|
||||
|
|
Loading…
Add table
Reference in a new issue