2005-02-02 Andrew Cagney <cagney@gnu.org>
* value.c (value_enclosing_type): New function. * value.h (VALUE_ENCLOSING_TYPE): Delete. (value_enclosing_type): Declare. * xstormy16-tdep.c, vax-tdep.c, m68k-tdep.c, i386-tdep.c: Update. * gnu-v3-abi.c, hpacc-abi.c, infcall.c, valops.c: Update.
This commit is contained in:
parent
161f49a316
commit
4754a64e16
12 changed files with 56 additions and 40 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-02-02 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* value.c (value_enclosing_type): New function.
|
||||
* value.h (VALUE_ENCLOSING_TYPE): Delete.
|
||||
(value_enclosing_type): Declare.
|
||||
* xstormy16-tdep.c, vax-tdep.c, m68k-tdep.c, i386-tdep.c: Update.
|
||||
* gnu-v3-abi.c, hpacc-abi.c, infcall.c, valops.c: Update.
|
||||
|
||||
2005-02-01 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* value.c (value_contents_all_raw)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/* Support for printing C values for GDB, the GNU debugger.
|
||||
|
||||
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
|
||||
1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
1997, 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -578,17 +579,17 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
|||
TYPE_NAME (real_type),
|
||||
full ? "" : _(" [incomplete object]"));
|
||||
/* Print out object: enclosing type is same as real_type if full */
|
||||
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
return val_print (value_enclosing_type (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
|
||||
/* Note: When we look up RTTI entries, we don't get any information on
|
||||
const or volatile attributes */
|
||||
}
|
||||
else if (type != VALUE_ENCLOSING_TYPE (val))
|
||||
else if (type != value_enclosing_type (val))
|
||||
{
|
||||
/* No RTTI information, so let's do our best */
|
||||
fprintf_filtered (stream, "(%s ?) ",
|
||||
TYPE_NAME (VALUE_ENCLOSING_TYPE (val)));
|
||||
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
TYPE_NAME (value_enclosing_type (val)));
|
||||
return val_print (value_enclosing_type (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
|
||||
}
|
||||
/* Otherwise, we end up at the return outside this "if" */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Abstraction of GNU v3 abi.
|
||||
Contributed by Jim Blandy <jimb@redhat.com>
|
||||
|
||||
Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -266,7 +266,7 @@ gnuv3_rtti_type (struct value *value,
|
|||
|
||||
if (full_p)
|
||||
*full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
|
||||
&& (TYPE_LENGTH (VALUE_ENCLOSING_TYPE (value))
|
||||
&& (TYPE_LENGTH (value_enclosing_type (value))
|
||||
>= TYPE_LENGTH (run_time_type)));
|
||||
if (top_p)
|
||||
*top_p = - offset_to_top;
|
||||
|
|
|
@ -206,7 +206,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
|
|||
* we can't do anything. */
|
||||
if (!TYPE_HAS_VTABLE (known_type))
|
||||
{
|
||||
known_type = VALUE_ENCLOSING_TYPE (v);
|
||||
known_type = value_enclosing_type (v);
|
||||
CHECK_TYPEDEF (known_type);
|
||||
if ((TYPE_CODE (known_type) != TYPE_CODE_CLASS) ||
|
||||
!TYPE_HAS_VTABLE (known_type))
|
||||
|
@ -280,7 +280,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
|
|||
same as the embedded offset */
|
||||
((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
|
||||
!using_enclosing &&
|
||||
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (v)) == TYPE_LENGTH (rtti_type))))
|
||||
TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
|
||||
|
||||
*full = 1;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Intel 386 target-dependent stuff.
|
||||
|
||||
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
|
||||
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
||||
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
@ -1223,7 +1223,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
/* Push arguments in reverse order. */
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
{
|
||||
int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
|
||||
int len = TYPE_LENGTH (value_enclosing_type (args[i]));
|
||||
|
||||
/* The System V ABI says that:
|
||||
|
||||
|
|
|
@ -571,7 +571,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
|
|||
CORE_ADDR addr;
|
||||
int len; /* = TYPE_LENGTH (arg_type); */
|
||||
int aligned_len;
|
||||
arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i]));
|
||||
arg_type = check_typedef (value_enclosing_type (args[i]));
|
||||
len = TYPE_LENGTH (arg_type);
|
||||
|
||||
aligned_len = len;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Target-dependent code for the Motorola 68000 series.
|
||||
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
|
||||
2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -417,7 +417,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
/* Push arguments in reverse order. */
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
{
|
||||
struct type *value_type = VALUE_ENCLOSING_TYPE (args[i]);
|
||||
struct type *value_type = value_enclosing_type (args[i]);
|
||||
int len = TYPE_LENGTH (value_type);
|
||||
int container_len = (len + 3) & ~3;
|
||||
int offset;
|
||||
|
|
22
gdb/valops.c
22
gdb/valops.c
|
@ -501,7 +501,7 @@ int
|
|||
value_fetch_lazy (struct value *val)
|
||||
{
|
||||
CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
|
||||
int length = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val));
|
||||
int length = TYPE_LENGTH (value_enclosing_type (val));
|
||||
|
||||
struct type *type = value_type (val);
|
||||
if (length)
|
||||
|
@ -544,7 +544,7 @@ value_assign (struct value *toval, struct value *fromval)
|
|||
case lval_internalvar:
|
||||
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
|
||||
val = value_copy (VALUE_INTERNALVAR (toval)->value);
|
||||
val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval));
|
||||
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
|
||||
VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
|
||||
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
|
||||
return val;
|
||||
|
@ -732,7 +732,7 @@ value_assign (struct value *toval, struct value *fromval)
|
|||
memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
|
||||
TYPE_LENGTH (type));
|
||||
val->type = type;
|
||||
val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval));
|
||||
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
|
||||
VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
|
||||
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
|
||||
|
||||
|
@ -751,11 +751,11 @@ value_repeat (struct value *arg1, int count)
|
|||
if (count < 1)
|
||||
error ("Invalid number %d of repetitions.", count);
|
||||
|
||||
val = allocate_repeat_value (VALUE_ENCLOSING_TYPE (arg1), count);
|
||||
val = allocate_repeat_value (value_enclosing_type (arg1), count);
|
||||
|
||||
read_memory (VALUE_ADDRESS (arg1) + value_offset (arg1),
|
||||
value_contents_all_raw (val),
|
||||
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)));
|
||||
TYPE_LENGTH (value_enclosing_type (val)));
|
||||
VALUE_LVAL (val) = lval_memory;
|
||||
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1);
|
||||
|
||||
|
@ -873,7 +873,7 @@ value_addr (struct value *arg1)
|
|||
|
||||
/* This may be a pointer to a base subobject; so remember the
|
||||
full derived object's type ... */
|
||||
arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (VALUE_ENCLOSING_TYPE (arg1)));
|
||||
arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (value_enclosing_type (arg1)));
|
||||
/* ... and also the relative position of the subobject in the full object */
|
||||
VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
|
||||
return arg2;
|
||||
|
@ -906,7 +906,7 @@ value_ind (struct value *arg1)
|
|||
struct type *enc_type;
|
||||
/* We may be pointing to something embedded in a larger object */
|
||||
/* Get the real type of the enclosing object */
|
||||
enc_type = check_typedef (VALUE_ENCLOSING_TYPE (arg1));
|
||||
enc_type = check_typedef (value_enclosing_type (arg1));
|
||||
enc_type = TYPE_TARGET_TYPE (enc_type);
|
||||
/* Retrieve the enclosing object pointed to */
|
||||
arg2 = value_at_lazy (enc_type, (value_as_address (arg1)
|
||||
|
@ -1003,10 +1003,10 @@ value_array (int lowbound, int highbound, struct value **elemvec)
|
|||
{
|
||||
error ("bad array bounds (%d, %d)", lowbound, highbound);
|
||||
}
|
||||
typelength = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (elemvec[0]));
|
||||
typelength = TYPE_LENGTH (value_enclosing_type (elemvec[0]));
|
||||
for (idx = 1; idx < nelem; idx++)
|
||||
{
|
||||
if (TYPE_LENGTH (VALUE_ENCLOSING_TYPE (elemvec[idx])) != typelength)
|
||||
if (TYPE_LENGTH (value_enclosing_type (elemvec[idx])) != typelength)
|
||||
{
|
||||
error ("array elements must all be the same size");
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
|
|||
rangetype = create_range_type ((struct type *) NULL, builtin_type_int,
|
||||
lowbound, highbound);
|
||||
arraytype = create_array_type ((struct type *) NULL,
|
||||
VALUE_ENCLOSING_TYPE (elemvec[0]), rangetype);
|
||||
value_enclosing_type (elemvec[0]), rangetype);
|
||||
|
||||
if (!current_language->c_style_arrays)
|
||||
{
|
||||
|
@ -2600,7 +2600,7 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
|
|||
real_type = value_rtti_type (argp, &full, &top, &using_enc);
|
||||
|
||||
/* If no RTTI data, or if object is already complete, do nothing */
|
||||
if (!real_type || real_type == VALUE_ENCLOSING_TYPE (argp))
|
||||
if (!real_type || real_type == value_enclosing_type (argp))
|
||||
return argp;
|
||||
|
||||
/* If we have the full object, but for some reason the enclosing
|
||||
|
|
22
gdb/value.c
22
gdb/value.c
|
@ -87,7 +87,7 @@ allocate_value (struct type *type)
|
|||
val->next = all_values;
|
||||
all_values = val;
|
||||
val->type = type;
|
||||
VALUE_ENCLOSING_TYPE (val) = type;
|
||||
val->enclosing_type = type;
|
||||
VALUE_LVAL (val) = not_lval;
|
||||
VALUE_ADDRESS (val) = 0;
|
||||
VALUE_FRAME_ID (val) = null_frame_id;
|
||||
|
@ -159,6 +159,12 @@ value_contents_all_raw (struct value *value)
|
|||
return value->aligner.contents;
|
||||
}
|
||||
|
||||
struct type *
|
||||
value_enclosing_type (struct value *value)
|
||||
{
|
||||
return value->enclosing_type;
|
||||
}
|
||||
|
||||
|
||||
/* Return a mark in the value chain. All values allocated after the
|
||||
mark is obtained (except for those released) are subject to being freed
|
||||
|
@ -252,7 +258,7 @@ value_release_to_mark (struct value *mark)
|
|||
struct value *
|
||||
value_copy (struct value *arg)
|
||||
{
|
||||
struct type *encl_type = VALUE_ENCLOSING_TYPE (arg);
|
||||
struct type *encl_type = value_enclosing_type (arg);
|
||||
struct value *val = allocate_value (encl_type);
|
||||
val->type = arg->type;
|
||||
VALUE_LVAL (val) = VALUE_LVAL (arg);
|
||||
|
@ -270,7 +276,7 @@ value_copy (struct value *arg)
|
|||
if (!VALUE_LAZY (val))
|
||||
{
|
||||
memcpy (value_contents_all_raw (val), value_contents_all_raw (arg),
|
||||
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg)));
|
||||
TYPE_LENGTH (value_enclosing_type (arg)));
|
||||
|
||||
}
|
||||
return val;
|
||||
|
@ -877,9 +883,9 @@ value_static_field (struct type *type, int fieldno)
|
|||
struct value *
|
||||
value_change_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)))
|
||||
{
|
||||
VALUE_ENCLOSING_TYPE (val) = new_encl_type;
|
||||
val->enclosing_type = new_encl_type;
|
||||
return val;
|
||||
}
|
||||
else
|
||||
|
@ -889,7 +895,7 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type)
|
|||
|
||||
new_val = (struct value *) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type));
|
||||
|
||||
VALUE_ENCLOSING_TYPE (new_val) = new_encl_type;
|
||||
new_val->enclosing_type = new_encl_type;
|
||||
|
||||
/* We have to make sure this ends up in the same place in the value
|
||||
chain as the original copy, so it's clean-up behavior is the same.
|
||||
|
@ -946,13 +952,13 @@ value_primitive_field (struct value *arg1, int offset,
|
|||
/* This field is actually a base subobject, so preserve the
|
||||
entire object's contents for later references to virtual
|
||||
bases, etc. */
|
||||
v = allocate_value (VALUE_ENCLOSING_TYPE (arg1));
|
||||
v = allocate_value (value_enclosing_type (arg1));
|
||||
v->type = type;
|
||||
if (VALUE_LAZY (arg1))
|
||||
VALUE_LAZY (v) = 1;
|
||||
else
|
||||
memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
|
||||
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg1)));
|
||||
TYPE_LENGTH (value_enclosing_type (arg1)));
|
||||
v->offset = value_offset (arg1);
|
||||
VALUE_EMBEDDED_OFFSET (v)
|
||||
= offset +
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Definitions for values of C expressions, for GDB.
|
||||
|
||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
@ -178,7 +178,7 @@ extern int value_bitsize (struct value *);
|
|||
extern int value_bitpos (struct value *);
|
||||
extern int value_offset (struct value *);
|
||||
|
||||
#define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type
|
||||
extern struct type *value_enclosing_type (struct value *);
|
||||
#define VALUE_LAZY(val) (val)->lazy
|
||||
|
||||
/* VALUE_CONTENTS and value_contents_raw() both return the address of
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Target-dependent code for the VAX.
|
||||
|
||||
Copyright 1986, 1989, 1991, 1992, 1995, 1996, 1998, 1999, 2000,
|
||||
2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -124,7 +124,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
|
|||
/* Push arguments in reverse order. */
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
{
|
||||
int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
|
||||
int len = TYPE_LENGTH (value_enclosing_type (args[i]));
|
||||
|
||||
sp -= (len + 3) & ~3;
|
||||
count += (len + 3) / 4;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* Target-dependent code for the Sanyo Xstormy16a (LC590000) processor.
|
||||
|
||||
Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -256,7 +257,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
|||
would fit in the remaining unused registers. */
|
||||
for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
|
||||
{
|
||||
typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
|
||||
typelen = TYPE_LENGTH (value_enclosing_type (args[i]));
|
||||
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
|
||||
break;
|
||||
|
||||
|
@ -277,7 +278,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
|||
wordaligned. */
|
||||
for (j = nargs - 1; j >= i; j--)
|
||||
{
|
||||
typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[j]));
|
||||
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
|
||||
slacklen = typelen & 1;
|
||||
val = alloca (typelen + slacklen);
|
||||
memcpy (val, VALUE_CONTENTS (args[j]), typelen);
|
||||
|
|
Loading…
Reference in a new issue