/* Evaluate expressions for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GDB.
struct expression *expr = parse_expression (exp);
register CORE_ADDR addr;
register struct cleanup *old_chain =
- make_cleanup (free_current_contents, &expr);
+ make_cleanup (free_current_contents, &expr);
addr = value_as_address (evaluate_expression (expr));
do_cleanups (old_chain);
struct expression *expr = parse_exp_1 (expptr, (struct block *) 0, 0);
register CORE_ADDR addr;
register struct cleanup *old_chain =
- make_cleanup (free_current_contents, &expr);
+ make_cleanup (free_current_contents, &expr);
addr = value_as_address (evaluate_expression (expr));
do_cleanups (old_chain);
{
struct expression *expr = parse_expression (exp);
struct value *val;
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
+ register struct cleanup *old_chain =
+ make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
do_cleanups (old_chain);
{
struct expression *expr = parse_exp_1 (expp, (struct block *) 0, 1);
struct value *val;
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
+ register struct cleanup *old_chain =
+ make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
do_cleanups (old_chain);
return NULL;
}
-/* This function evaluates tuples (in Chill) or brace-initializers
- (in C/C++) for structure types. */
+/* This function evaluates tuples (in (OBSOLETE) Chill) or
+ brace-initializers (in C/C++) for structure types. */
static struct value *
evaluate_struct_tuple (struct value *struct_val,
return struct_val;
}
-/* Recursive helper function for setting elements of array tuples for Chill.
- The target is ARRAY (which has bounds LOW_BOUND to HIGH_BOUND);
- the element value is ELEMENT;
- EXP, POS and NOSIDE are as usual.
- Evaluates index expresions and sets the specified element(s) of
- ARRAY to ELEMENT.
- Returns last index value. */
+/* Recursive helper function for setting elements of array tuples for
+ (OBSOLETE) Chill. The target is ARRAY (which has bounds LOW_BOUND
+ to HIGH_BOUND); the element value is ELEMENT; EXP, POS and NOSIDE
+ are as usual. Evaluates index expresions and sets the specified
+ element(s) of ARRAY to ELEMENT. Returns last index value. */
static LONGEST
init_array_element (struct value *array, struct value *element,
case OP_REGISTER:
{
int regno = longest_to_int (exp->elts[pc + 1].longconst);
- struct value *val = value_of_register (regno);
-
+ struct value *val = value_of_register (regno, selected_frame);
(*pos) += 2;
if (val == NULL)
error ("Value of register %s not available.", REGISTER_NAME (regno));
if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
{
int static_memfuncp;
- struct value *temp = arg2;
char tstr[256];
/* Method invocation : stuff "this" as first parameter */
- /* pai: this used to have lookup_pointer_type for some reason,
- * but temp is already a pointer to the object */
- argvec[1]
- = value_from_pointer (VALUE_TYPE (temp),
- VALUE_ADDRESS (temp) + VALUE_OFFSET (temp));
+ argvec[1] = arg2;
/* Name of method from expression */
strcpy (tstr, &exp->elts[pc2 + 2].string);
(void) find_overload_match (arg_types, nargs, tstr,
1 /* method */ , 0 /* strict match */ ,
- arg2 /* the object */ , NULL,
+ &arg2 /* the object */ , NULL,
&valp, NULL, &static_memfuncp);
else
/* Non-C++ case -- or no overload resolution */
{
- temp = arg2;
+ struct value *temp = arg2;
argvec[0] = value_struct_elt (&temp, argvec + 1, tstr,
&static_memfuncp,
op == STRUCTOP_STRUCT
? "structure" : "structure pointer");
+ /* value_struct_elt updates temp with the correct value
+ of the ``this'' pointer if necessary, so modify argvec[1] to
+ reflect any ``this'' changes. */
+ arg2 = value_from_longest (lookup_pointer_type(VALUE_TYPE (temp)),
+ VALUE_ADDRESS (temp) + VALUE_OFFSET (temp)
+ + VALUE_EMBEDDED_OFFSET (temp));
argvec[1] = arg2; /* the ``this'' pointer */
}