* 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-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)
/* 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.
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" */
/* 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.
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;
* 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))
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;
/* 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.
/* 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:
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;
/* 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.
/* 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;
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)
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;
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);
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);
/* 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;
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)
{
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");
}
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)
{
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
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;
return value->aligner.contents;
}
+struct type *
+value_enclosing_type (struct value *value)
+{
+ return value->enclosing_type;
+}
+
\f
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed
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);
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;
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
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.
/* 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 +
/* 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.
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
/* 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.
/* 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;
/* 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.
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;
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);