* value.c (set_value_enclosing_type): Renamed from
value_change_enclosing_type. All callers updated. * value.h (set_value_enclosing_type): Update. * valops.c (value_full_object): Always return a copy if we need to make changes to the input value.
This commit is contained in:
parent
51020d214b
commit
4dfea56049
|
@ -1,3 +1,11 @@
|
||||||
|
2010-11-10 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* value.c (set_value_enclosing_type): Renamed from
|
||||||
|
value_change_enclosing_type. All callers updated.
|
||||||
|
* value.h (set_value_enclosing_type): Update.
|
||||||
|
* valops.c (value_full_object): Always return a copy if we need to
|
||||||
|
make changes to the input value.
|
||||||
|
|
||||||
2010-11-09 Pedro Alves <pedro@codesourcery.com>
|
2010-11-09 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* breakpoint.c (watch_command_1): Get a pointer of the lazy
|
* breakpoint.c (watch_command_1): Get a pointer of the lazy
|
||||||
|
|
21
gdb/valops.c
21
gdb/valops.c
|
@ -335,7 +335,7 @@ value_cast_pointers (struct type *type, struct value *arg2)
|
||||||
/* No superclass found, just change the pointer type. */
|
/* No superclass found, just change the pointer type. */
|
||||||
arg2 = value_copy (arg2);
|
arg2 = value_copy (arg2);
|
||||||
deprecated_set_value_type (arg2, type);
|
deprecated_set_value_type (arg2, type);
|
||||||
arg2 = value_change_enclosing_type (arg2, type);
|
set_value_enclosing_type (arg2, type);
|
||||||
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
|
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
|
||||||
return arg2;
|
return arg2;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ value_cast (struct type *type, struct value *arg2)
|
||||||
|
|
||||||
arg2 = value_copy (arg2);
|
arg2 = value_copy (arg2);
|
||||||
deprecated_set_value_type (arg2, type);
|
deprecated_set_value_type (arg2, type);
|
||||||
arg2 = value_change_enclosing_type (arg2, type);
|
set_value_enclosing_type (arg2, type);
|
||||||
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
|
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
|
||||||
return arg2;
|
return arg2;
|
||||||
}
|
}
|
||||||
|
@ -1139,11 +1139,9 @@ value_assign (struct value *toval, struct value *fromval)
|
||||||
case lval_internalvar:
|
case lval_internalvar:
|
||||||
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
|
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
|
||||||
val = value_copy (fromval);
|
val = value_copy (fromval);
|
||||||
val = value_change_enclosing_type (val,
|
set_value_enclosing_type (val, value_enclosing_type (fromval));
|
||||||
value_enclosing_type (fromval));
|
|
||||||
set_value_embedded_offset (val, value_embedded_offset (fromval));
|
set_value_embedded_offset (val, value_embedded_offset (fromval));
|
||||||
set_value_pointed_to_offset (val,
|
set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
|
||||||
value_pointed_to_offset (fromval));
|
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
case lval_internalvar_component:
|
case lval_internalvar_component:
|
||||||
|
@ -1334,8 +1332,7 @@ value_assign (struct value *toval, struct value *fromval)
|
||||||
memcpy (value_contents_raw (val), value_contents (fromval),
|
memcpy (value_contents_raw (val), value_contents (fromval),
|
||||||
TYPE_LENGTH (type));
|
TYPE_LENGTH (type));
|
||||||
deprecated_set_value_type (val, type);
|
deprecated_set_value_type (val, type);
|
||||||
val = value_change_enclosing_type (val,
|
set_value_enclosing_type (val, value_enclosing_type (fromval));
|
||||||
value_enclosing_type (fromval));
|
|
||||||
set_value_embedded_offset (val, value_embedded_offset (fromval));
|
set_value_embedded_offset (val, value_embedded_offset (fromval));
|
||||||
set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
|
set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
|
||||||
|
|
||||||
|
@ -1583,7 +1580,8 @@ value_addr (struct value *arg1)
|
||||||
|
|
||||||
/* This may be a pointer to a base subobject; so remember the
|
/* This may be a pointer to a base subobject; so remember the
|
||||||
full derived object's type ... */
|
full derived object's type ... */
|
||||||
arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (value_enclosing_type (arg1)));
|
set_value_enclosing_type (arg2,
|
||||||
|
lookup_pointer_type (value_enclosing_type (arg1)));
|
||||||
/* ... and also the relative position of the subobject in the full
|
/* ... and also the relative position of the subobject in the full
|
||||||
object. */
|
object. */
|
||||||
set_value_pointed_to_offset (arg2, value_embedded_offset (arg1));
|
set_value_pointed_to_offset (arg2, value_embedded_offset (arg1));
|
||||||
|
@ -1644,7 +1642,7 @@ value_ind (struct value *arg1)
|
||||||
/* Re-adjust type. */
|
/* Re-adjust type. */
|
||||||
deprecated_set_value_type (arg2, TYPE_TARGET_TYPE (base_type));
|
deprecated_set_value_type (arg2, TYPE_TARGET_TYPE (base_type));
|
||||||
/* Add embedding info. */
|
/* Add embedding info. */
|
||||||
arg2 = value_change_enclosing_type (arg2, enc_type);
|
set_value_enclosing_type (arg2, enc_type);
|
||||||
set_value_embedded_offset (arg2, value_pointed_to_offset (arg1));
|
set_value_embedded_offset (arg2, value_pointed_to_offset (arg1));
|
||||||
|
|
||||||
/* We may be pointing to an object of some derived type. */
|
/* We may be pointing to an object of some derived type. */
|
||||||
|
@ -3413,7 +3411,8 @@ value_full_object (struct value *argp,
|
||||||
/* pai: FIXME -- sounds iffy */
|
/* pai: FIXME -- sounds iffy */
|
||||||
if (full)
|
if (full)
|
||||||
{
|
{
|
||||||
argp = value_change_enclosing_type (argp, real_type);
|
argp = value_copy (argp);
|
||||||
|
set_value_enclosing_type (argp, real_type);
|
||||||
return argp;
|
return argp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
gdb/value.c
15
gdb/value.c
|
@ -1933,21 +1933,20 @@ value_static_field (struct type *type, int fieldno)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change the enclosing type of a value object VAL to NEW_ENCL_TYPE.
|
/* Change the enclosing type of a value object VAL to NEW_ENCL_TYPE.
|
||||||
You have to be careful here, since the size of the data area for the value
|
You have to be careful here, since the size of the data area for the value
|
||||||
is set by the length of the enclosing type. So if NEW_ENCL_TYPE is bigger
|
is set by the length of the enclosing type. So if NEW_ENCL_TYPE is bigger
|
||||||
than the old enclosing type, you have to allocate more space for the data.
|
than the old enclosing type, you have to allocate more space for the
|
||||||
The return value is a pointer to the new version of this value structure. */
|
data. */
|
||||||
|
|
||||||
struct value *
|
void
|
||||||
value_change_enclosing_type (struct value *val, struct type *new_encl_type)
|
set_value_enclosing_type (struct value *val, struct type *new_encl_type)
|
||||||
{
|
{
|
||||||
if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
|
if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
|
||||||
val->contents =
|
val->contents =
|
||||||
(gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type));
|
(gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type));
|
||||||
|
|
||||||
val->enclosing_type = new_encl_type;
|
val->enclosing_type = new_encl_type;
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a value ARG1 (offset by OFFSET bytes)
|
/* Given a value ARG1 (offset by OFFSET bytes)
|
||||||
|
|
|
@ -136,8 +136,9 @@ extern void deprecated_set_value_modifiable (struct value *value,
|
||||||
normally. */
|
normally. */
|
||||||
|
|
||||||
extern struct type *value_enclosing_type (struct value *);
|
extern struct type *value_enclosing_type (struct value *);
|
||||||
extern struct value *value_change_enclosing_type (struct value *val,
|
extern void set_value_enclosing_type (struct value *val,
|
||||||
struct type *new_type);
|
struct type *new_type);
|
||||||
|
|
||||||
extern int value_pointed_to_offset (struct value *value);
|
extern int value_pointed_to_offset (struct value *value);
|
||||||
extern void set_value_pointed_to_offset (struct value *value, int val);
|
extern void set_value_pointed_to_offset (struct value *value, int val);
|
||||||
extern int value_embedded_offset (struct value *value);
|
extern int value_embedded_offset (struct value *value);
|
||||||
|
|
Loading…
Reference in New Issue