s/value_ptr/struct value */
This commit is contained in:
parent
5c8844646d
commit
f23631e444
8 changed files with 367 additions and 341 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2002-01-03 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* valarith.c: Replace value_ptr with struct value pointer. Remove
|
||||||
|
register attribute from value declarations.
|
||||||
|
* valops.c: Ditto.
|
||||||
|
* value.h: Ditto.
|
||||||
|
* scm-lang.c (scm_lookup_name): Ditto.
|
||||||
|
|
||||||
2002-01-01 Mark Kettenis <kettenis@gnu.org>
|
2002-01-01 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* i386-tdep.h (struct gdbarch_tdep): Add `os_ident' member.
|
* i386-tdep.h (struct gdbarch_tdep): Add `os_ident' member.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2002-01-03 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* gdbint.texinfo (Target Architecture Definition): Replace
|
||||||
|
value_ptr with struct value pointer.
|
||||||
|
|
||||||
2002-01-02 Eli Zaretskii <eliz@gnu.org>
|
2002-01-02 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* gdb.texinfo (Free Software): Fix wording.
|
* gdb.texinfo (Free Software): Fix wording.
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
@ifinfo
|
@ifinfo
|
||||||
This file documents the internals of the GNU debugger @value{GDBN}.
|
This file documents the internals of the GNU debugger @value{GDBN}.
|
||||||
Copyright 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001
|
Copyright 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001,2002
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Contributed by Cygnus Solutions. Written by John Gilmore.
|
Contributed by Cygnus Solutions. Written by John Gilmore.
|
||||||
Second Edition by Stan Shebs.
|
Second Edition by Stan Shebs.
|
||||||
|
@ -2425,7 +2425,7 @@ If @var{type} is not a pointer or reference type, then this function
|
||||||
will signal an internal error.
|
will signal an internal error.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@deftypefun CORE_ADDR value_as_address (value_ptr @var{val})
|
@deftypefun CORE_ADDR value_as_address (struct value *@var{val})
|
||||||
Assuming that @var{val} is a pointer, return the address it represents,
|
Assuming that @var{val} is a pointer, return the address it represents,
|
||||||
as appropriate for the current architecture.
|
as appropriate for the current architecture.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Scheme/Guile language support routines for GDB, the GNU debugger.
|
/* Scheme/Guile language support routines for GDB, the GNU debugger.
|
||||||
Copyright 1995, 1996, 1998, 2000, 2001
|
Copyright 1995, 1996, 1998, 2000, 2001, 2002
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -150,7 +150,7 @@ in_eval_c (void)
|
||||||
static struct value *
|
static struct value *
|
||||||
scm_lookup_name (char *str)
|
scm_lookup_name (char *str)
|
||||||
{
|
{
|
||||||
value_ptr args[3];
|
struct value *args[3];
|
||||||
int len = strlen (str);
|
int len = strlen (str);
|
||||||
struct value *func;
|
struct value *func;
|
||||||
struct value *val;
|
struct value *val;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Perform arithmetic and other operations on values, for GDB.
|
/* Perform arithmetic and other operations on values, for GDB.
|
||||||
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
|
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||||
1997, 1998, 1999, 2000
|
1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -38,15 +38,16 @@
|
||||||
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
|
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static value_ptr value_subscripted_rvalue (value_ptr, value_ptr, int);
|
static struct value *value_subscripted_rvalue (struct value *, struct value *, int);
|
||||||
|
|
||||||
void _initialize_valarith (void);
|
void _initialize_valarith (void);
|
||||||
|
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_add (value_ptr arg1, value_ptr arg2)
|
value_add (struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
register value_ptr valint, valptr;
|
struct value *valint;
|
||||||
|
struct value *valptr;
|
||||||
register int len;
|
register int len;
|
||||||
struct type *type1, *type2, *valptrtype;
|
struct type *type1, *type2, *valptrtype;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ value_add (value_ptr arg1, value_ptr arg2)
|
||||||
|| TYPE_CODE (type2) == TYPE_CODE_INT))
|
|| TYPE_CODE (type2) == TYPE_CODE_INT))
|
||||||
/* Exactly one argument is a pointer, and one is an integer. */
|
/* Exactly one argument is a pointer, and one is an integer. */
|
||||||
{
|
{
|
||||||
value_ptr retval;
|
struct value *retval;
|
||||||
|
|
||||||
if (TYPE_CODE (type1) == TYPE_CODE_PTR)
|
if (TYPE_CODE (type1) == TYPE_CODE_PTR)
|
||||||
{
|
{
|
||||||
|
@ -89,8 +90,8 @@ value_add (value_ptr arg1, value_ptr arg2)
|
||||||
return value_binop (arg1, arg2, BINOP_ADD);
|
return value_binop (arg1, arg2, BINOP_ADD);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_sub (value_ptr arg1, value_ptr arg2)
|
value_sub (struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
struct type *type1, *type2;
|
struct type *type1, *type2;
|
||||||
COERCE_NUMBER (arg1);
|
COERCE_NUMBER (arg1);
|
||||||
|
@ -135,10 +136,10 @@ an integer nor a pointer of the same type.");
|
||||||
FIXME: Perhaps we should validate that the index is valid and if
|
FIXME: Perhaps we should validate that the index is valid and if
|
||||||
verbosity is set, warn about invalid indices (but still use them). */
|
verbosity is set, warn about invalid indices (but still use them). */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_subscript (value_ptr array, value_ptr idx)
|
value_subscript (struct value *array, struct value *idx)
|
||||||
{
|
{
|
||||||
value_ptr bound;
|
struct value *bound;
|
||||||
int c_style = current_language->c_style_arrays;
|
int c_style = current_language->c_style_arrays;
|
||||||
struct type *tarray;
|
struct type *tarray;
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ value_subscript (value_ptr array, value_ptr idx)
|
||||||
{
|
{
|
||||||
struct type *range_type = TYPE_INDEX_TYPE (tarray);
|
struct type *range_type = TYPE_INDEX_TYPE (tarray);
|
||||||
LONGEST index = value_as_long (idx);
|
LONGEST index = value_as_long (idx);
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
int offset, byte, bit_index;
|
int offset, byte, bit_index;
|
||||||
LONGEST lowerbound, upperbound;
|
LONGEST lowerbound, upperbound;
|
||||||
get_discrete_bounds (range_type, &lowerbound, &upperbound);
|
get_discrete_bounds (range_type, &lowerbound, &upperbound);
|
||||||
|
@ -211,15 +212,15 @@ value_subscript (value_ptr array, value_ptr idx)
|
||||||
(eg, a vector register). This routine used to promote floats
|
(eg, a vector register). This routine used to promote floats
|
||||||
to doubles, but no longer does. */
|
to doubles, but no longer does. */
|
||||||
|
|
||||||
static value_ptr
|
static struct value *
|
||||||
value_subscripted_rvalue (value_ptr array, value_ptr idx, int lowerbound)
|
value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound)
|
||||||
{
|
{
|
||||||
struct type *array_type = check_typedef (VALUE_TYPE (array));
|
struct type *array_type = check_typedef (VALUE_TYPE (array));
|
||||||
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
|
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
|
||||||
unsigned int elt_size = TYPE_LENGTH (elt_type);
|
unsigned int elt_size = TYPE_LENGTH (elt_type);
|
||||||
LONGEST index = value_as_long (idx);
|
LONGEST index = value_as_long (idx);
|
||||||
unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
|
unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
|
|
||||||
if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
|
if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
|
||||||
error ("no such vector element");
|
error ("no such vector element");
|
||||||
|
@ -246,7 +247,7 @@ value_subscripted_rvalue (value_ptr array, value_ptr idx, int lowerbound)
|
||||||
For now, we do not overload the `=' operator. */
|
For now, we do not overload the `=' operator. */
|
||||||
|
|
||||||
int
|
int
|
||||||
binop_user_defined_p (enum exp_opcode op, value_ptr arg1, value_ptr arg2)
|
binop_user_defined_p (enum exp_opcode op, struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
struct type *type1, *type2;
|
struct type *type1, *type2;
|
||||||
if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
|
if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
|
||||||
|
@ -268,7 +269,7 @@ binop_user_defined_p (enum exp_opcode op, value_ptr arg1, value_ptr arg2)
|
||||||
For now, we do not overload the `&' operator. */
|
For now, we do not overload the `&' operator. */
|
||||||
|
|
||||||
int
|
int
|
||||||
unop_user_defined_p (enum exp_opcode op, value_ptr arg1)
|
unop_user_defined_p (enum exp_opcode op, struct value *arg1)
|
||||||
{
|
{
|
||||||
struct type *type1;
|
struct type *type1;
|
||||||
if (op == UNOP_ADDR)
|
if (op == UNOP_ADDR)
|
||||||
|
@ -294,11 +295,11 @@ unop_user_defined_p (enum exp_opcode op, value_ptr arg1)
|
||||||
is the opcode saying how to modify it. Otherwise, OTHEROP is
|
is the opcode saying how to modify it. Otherwise, OTHEROP is
|
||||||
unused. */
|
unused. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_x_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op,
|
value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
|
||||||
enum exp_opcode otherop, enum noside noside)
|
enum exp_opcode otherop, enum noside noside)
|
||||||
{
|
{
|
||||||
value_ptr *argvec;
|
struct value **argvec;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char tstr[13];
|
char tstr[13];
|
||||||
int static_memfuncp;
|
int static_memfuncp;
|
||||||
|
@ -314,7 +315,7 @@ value_x_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op,
|
||||||
if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT)
|
if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT)
|
||||||
error ("Can't do that binary op on that type"); /* FIXME be explicit */
|
error ("Can't do that binary op on that type"); /* FIXME be explicit */
|
||||||
|
|
||||||
argvec = (value_ptr *) alloca (sizeof (value_ptr) * 4);
|
argvec = (struct value **) alloca (sizeof (struct value *) * 4);
|
||||||
argvec[1] = value_addr (arg1);
|
argvec[1] = value_addr (arg1);
|
||||||
argvec[2] = arg2;
|
argvec[2] = arg2;
|
||||||
argvec[3] = 0;
|
argvec[3] = 0;
|
||||||
|
@ -457,10 +458,10 @@ value_x_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op,
|
||||||
and return that value (where '@' is (almost) any unary operator which
|
and return that value (where '@' is (almost) any unary operator which
|
||||||
is legal for GNU C++). */
|
is legal for GNU C++). */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_x_unop (value_ptr arg1, enum exp_opcode op, enum noside noside)
|
value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
|
||||||
{
|
{
|
||||||
value_ptr *argvec;
|
struct value **argvec;
|
||||||
char *ptr, *mangle_ptr;
|
char *ptr, *mangle_ptr;
|
||||||
char tstr[13], mangle_tstr[13];
|
char tstr[13], mangle_tstr[13];
|
||||||
int static_memfuncp;
|
int static_memfuncp;
|
||||||
|
@ -474,7 +475,7 @@ value_x_unop (value_ptr arg1, enum exp_opcode op, enum noside noside)
|
||||||
if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT)
|
if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT)
|
||||||
error ("Can't do that unary op on that type"); /* FIXME be explicit */
|
error ("Can't do that unary op on that type"); /* FIXME be explicit */
|
||||||
|
|
||||||
argvec = (value_ptr *) alloca (sizeof (value_ptr) * 3);
|
argvec = (struct value **) alloca (sizeof (struct value *) * 3);
|
||||||
argvec[1] = value_addr (arg1);
|
argvec[1] = value_addr (arg1);
|
||||||
argvec[2] = 0;
|
argvec[2] = 0;
|
||||||
|
|
||||||
|
@ -557,10 +558,12 @@ value_x_unop (value_ptr arg1, enum exp_opcode op, enum noside noside)
|
||||||
string values of length 1.
|
string values of length 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_concat (value_ptr arg1, value_ptr arg2)
|
value_concat (struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
register value_ptr inval1, inval2, outval = NULL;
|
struct value *inval1;
|
||||||
|
struct value *inval2;
|
||||||
|
struct value *outval = NULL;
|
||||||
int inval1len, inval2len;
|
int inval1len, inval2len;
|
||||||
int count, idx;
|
int count, idx;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -690,10 +693,10 @@ value_concat (value_ptr arg1, value_ptr arg2)
|
||||||
Does not support addition and subtraction on pointers;
|
Does not support addition and subtraction on pointers;
|
||||||
use value_add or value_sub if you want to handle those possibilities. */
|
use value_add or value_sub if you want to handle those possibilities. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op)
|
value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
struct type *type1, *type2;
|
struct type *type1, *type2;
|
||||||
|
|
||||||
COERCE_REF (arg1);
|
COERCE_REF (arg1);
|
||||||
|
@ -1114,7 +1117,7 @@ value_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op)
|
||||||
/* Simulate the C operator ! -- return 1 if ARG1 contains zero. */
|
/* Simulate the C operator ! -- return 1 if ARG1 contains zero. */
|
||||||
|
|
||||||
int
|
int
|
||||||
value_logical_not (value_ptr arg1)
|
value_logical_not (struct value *arg1)
|
||||||
{
|
{
|
||||||
register int len;
|
register int len;
|
||||||
register char *p;
|
register char *p;
|
||||||
|
@ -1142,7 +1145,7 @@ value_logical_not (value_ptr arg1)
|
||||||
necessarily null terminated) based on their length */
|
necessarily null terminated) based on their length */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
value_strcmp (register value_ptr arg1, register value_ptr arg2)
|
value_strcmp (struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
int len1 = TYPE_LENGTH (VALUE_TYPE (arg1));
|
int len1 = TYPE_LENGTH (VALUE_TYPE (arg1));
|
||||||
int len2 = TYPE_LENGTH (VALUE_TYPE (arg2));
|
int len2 = TYPE_LENGTH (VALUE_TYPE (arg2));
|
||||||
|
@ -1172,7 +1175,7 @@ value_strcmp (register value_ptr arg1, register value_ptr arg2)
|
||||||
iff ARG1 and ARG2 have equal contents. */
|
iff ARG1 and ARG2 have equal contents. */
|
||||||
|
|
||||||
int
|
int
|
||||||
value_equal (register value_ptr arg1, register value_ptr arg2)
|
value_equal (struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
register int len;
|
register int len;
|
||||||
register char *p1, *p2;
|
register char *p1, *p2;
|
||||||
|
@ -1231,7 +1234,7 @@ value_equal (register value_ptr arg1, register value_ptr arg2)
|
||||||
iff ARG1's contents are less than ARG2's. */
|
iff ARG1's contents are less than ARG2's. */
|
||||||
|
|
||||||
int
|
int
|
||||||
value_less (register value_ptr arg1, register value_ptr arg2)
|
value_less (struct value *arg1, struct value *arg2)
|
||||||
{
|
{
|
||||||
register enum type_code code1;
|
register enum type_code code1;
|
||||||
register enum type_code code2;
|
register enum type_code code2;
|
||||||
|
@ -1272,8 +1275,8 @@ value_less (register value_ptr arg1, register value_ptr arg2)
|
||||||
|
|
||||||
/* The unary operators - and ~. Both free the argument ARG1. */
|
/* The unary operators - and ~. Both free the argument ARG1. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_neg (register value_ptr arg1)
|
value_neg (struct value *arg1)
|
||||||
{
|
{
|
||||||
register struct type *type;
|
register struct type *type;
|
||||||
register struct type *result_type = VALUE_TYPE (arg1);
|
register struct type *result_type = VALUE_TYPE (arg1);
|
||||||
|
@ -1301,8 +1304,8 @@ value_neg (register value_ptr arg1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_complement (register value_ptr arg1)
|
value_complement (struct value *arg1)
|
||||||
{
|
{
|
||||||
register struct type *type;
|
register struct type *type;
|
||||||
register struct type *result_type = VALUE_TYPE (arg1);
|
register struct type *result_type = VALUE_TYPE (arg1);
|
||||||
|
@ -1349,8 +1352,8 @@ value_bit_index (struct type *type, char *valaddr, int index)
|
||||||
return (word >> rel_index) & 1;
|
return (word >> rel_index) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_in (value_ptr element, value_ptr set)
|
value_in (struct value *element, struct value *set)
|
||||||
{
|
{
|
||||||
int member;
|
int member;
|
||||||
struct type *settype = check_typedef (VALUE_TYPE (set));
|
struct type *settype = check_typedef (VALUE_TYPE (set));
|
||||||
|
|
227
gdb/valops.c
227
gdb/valops.c
|
@ -1,6 +1,7 @@
|
||||||
/* Perform non-arithmetic operations on values, for GDB.
|
/* Perform non-arithmetic operations on values, for GDB.
|
||||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -43,28 +44,28 @@ extern int hp_som_som_object_present;
|
||||||
extern int overload_debug;
|
extern int overload_debug;
|
||||||
/* Local functions. */
|
/* Local functions. */
|
||||||
|
|
||||||
static int typecmp (int staticp, struct type *t1[], value_ptr t2[]);
|
static int typecmp (int staticp, struct type *t1[], struct value *t2[]);
|
||||||
|
|
||||||
static CORE_ADDR find_function_addr (value_ptr, struct type **);
|
static CORE_ADDR find_function_addr (struct value *, struct type **);
|
||||||
static value_ptr value_arg_coerce (value_ptr, struct type *, int);
|
static struct value *value_arg_coerce (struct value *, struct type *, int);
|
||||||
|
|
||||||
|
|
||||||
static CORE_ADDR value_push (CORE_ADDR, value_ptr);
|
static CORE_ADDR value_push (CORE_ADDR, struct value *);
|
||||||
|
|
||||||
static value_ptr search_struct_field (char *, value_ptr, int,
|
static struct value *search_struct_field (char *, struct value *, int,
|
||||||
struct type *, int);
|
struct type *, int);
|
||||||
|
|
||||||
static value_ptr search_struct_method (char *, value_ptr *,
|
static struct value *search_struct_method (char *, struct value **,
|
||||||
value_ptr *,
|
struct value **,
|
||||||
int, int *, struct type *);
|
int, int *, struct type *);
|
||||||
|
|
||||||
static int check_field_in (struct type *, const char *);
|
static int check_field_in (struct type *, const char *);
|
||||||
|
|
||||||
static CORE_ADDR allocate_space_in_inferior (int);
|
static CORE_ADDR allocate_space_in_inferior (int);
|
||||||
|
|
||||||
static value_ptr cast_into_complex (struct type *, value_ptr);
|
static struct value *cast_into_complex (struct type *, struct value *);
|
||||||
|
|
||||||
static struct fn_field *find_method_list (value_ptr * argp, char *method,
|
static struct fn_field *find_method_list (struct value ** argp, char *method,
|
||||||
int offset, int *static_memfuncp,
|
int offset, int *static_memfuncp,
|
||||||
struct type *type, int *num_fns,
|
struct type *type, int *num_fns,
|
||||||
struct type **basetype,
|
struct type **basetype,
|
||||||
|
@ -91,7 +92,7 @@ int unwind_on_signal_p = 0;
|
||||||
|
|
||||||
/* Find the address of function name NAME in the inferior. */
|
/* Find the address of function name NAME in the inferior. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
find_function_in_inferior (char *name)
|
find_function_in_inferior (char *name)
|
||||||
{
|
{
|
||||||
register struct symbol *sym;
|
register struct symbol *sym;
|
||||||
|
@ -131,11 +132,11 @@ find_function_in_inferior (char *name)
|
||||||
/* Allocate NBYTES of space in the inferior using the inferior's malloc
|
/* Allocate NBYTES of space in the inferior using the inferior's malloc
|
||||||
and return a value that is a pointer to the allocated space. */
|
and return a value that is a pointer to the allocated space. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_allocate_space_in_inferior (int len)
|
value_allocate_space_in_inferior (int len)
|
||||||
{
|
{
|
||||||
value_ptr blocklen;
|
struct value *blocklen;
|
||||||
register value_ptr val = find_function_in_inferior ("malloc");
|
struct value *val = find_function_in_inferior ("malloc");
|
||||||
|
|
||||||
blocklen = value_from_longest (builtin_type_int, (LONGEST) len);
|
blocklen = value_from_longest (builtin_type_int, (LONGEST) len);
|
||||||
val = call_function_by_hand (val, 1, &blocklen);
|
val = call_function_by_hand (val, 1, &blocklen);
|
||||||
|
@ -160,8 +161,8 @@ allocate_space_in_inferior (int len)
|
||||||
and if ARG2 is an lvalue it can be cast into anything at all. */
|
and if ARG2 is an lvalue it can be cast into anything at all. */
|
||||||
/* In C++, casts may change pointer or object representations. */
|
/* In C++, casts may change pointer or object representations. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_cast (struct type *type, register value_ptr arg2)
|
value_cast (struct type *type, struct value *arg2)
|
||||||
{
|
{
|
||||||
register enum type_code code1;
|
register enum type_code code1;
|
||||||
register enum type_code code2;
|
register enum type_code code2;
|
||||||
|
@ -241,7 +242,7 @@ value_cast (struct type *type, register value_ptr arg2)
|
||||||
/* Look in the type of the source to see if it contains the
|
/* Look in the type of the source to see if it contains the
|
||||||
type of the target as a superclass. If so, we'll need to
|
type of the target as a superclass. If so, we'll need to
|
||||||
offset the object in addition to changing its type. */
|
offset the object in addition to changing its type. */
|
||||||
value_ptr v = search_struct_field (type_name_no_tag (type),
|
struct value *v = search_struct_field (type_name_no_tag (type),
|
||||||
arg2, 0, type2, 1);
|
arg2, 0, type2, 1);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
|
@ -261,7 +262,7 @@ value_cast (struct type *type, register value_ptr arg2)
|
||||||
(code2 == TYPE_CODE_PTR))
|
(code2 == TYPE_CODE_PTR))
|
||||||
{
|
{
|
||||||
unsigned int *ptr;
|
unsigned int *ptr;
|
||||||
value_ptr retvalp;
|
struct value *retvalp;
|
||||||
|
|
||||||
switch (TYPE_CODE (TYPE_TARGET_TYPE (type2)))
|
switch (TYPE_CODE (TYPE_TARGET_TYPE (type2)))
|
||||||
{
|
{
|
||||||
|
@ -331,7 +332,7 @@ value_cast (struct type *type, register value_ptr arg2)
|
||||||
&& TYPE_CODE (t2) == TYPE_CODE_STRUCT
|
&& TYPE_CODE (t2) == TYPE_CODE_STRUCT
|
||||||
&& !value_logical_not (arg2))
|
&& !value_logical_not (arg2))
|
||||||
{
|
{
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
|
|
||||||
/* Look in the type of the source to see if it contains the
|
/* Look in the type of the source to see if it contains the
|
||||||
type of the target as a superclass. If so, we'll need to
|
type of the target as a superclass. If so, we'll need to
|
||||||
|
@ -358,7 +359,7 @@ value_cast (struct type *type, register value_ptr arg2)
|
||||||
value_zero (t1, not_lval), 0, t1, 1);
|
value_zero (t1, not_lval), 0, t1, 1);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
value_ptr v2 = value_ind (arg2);
|
struct value *v2 = value_ind (arg2);
|
||||||
VALUE_ADDRESS (v2) -= VALUE_ADDRESS (v)
|
VALUE_ADDRESS (v2) -= VALUE_ADDRESS (v)
|
||||||
+ VALUE_OFFSET (v);
|
+ VALUE_OFFSET (v);
|
||||||
|
|
||||||
|
@ -383,7 +384,7 @@ value_cast (struct type *type, register value_ptr arg2)
|
||||||
else if (chill_varying_type (type))
|
else if (chill_varying_type (type))
|
||||||
{
|
{
|
||||||
struct type *range1, *range2, *eltype1, *eltype2;
|
struct type *range1, *range2, *eltype1, *eltype2;
|
||||||
value_ptr val;
|
struct value *val;
|
||||||
int count1, count2;
|
int count1, count2;
|
||||||
LONGEST low_bound, high_bound;
|
LONGEST low_bound, high_bound;
|
||||||
char *valaddr, *valaddr_data;
|
char *valaddr, *valaddr_data;
|
||||||
|
@ -441,10 +442,10 @@ value_cast (struct type *type, register value_ptr arg2)
|
||||||
|
|
||||||
/* Create a value of type TYPE that is zero, and return it. */
|
/* Create a value of type TYPE that is zero, and return it. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_zero (struct type *type, enum lval_type lv)
|
value_zero (struct type *type, enum lval_type lv)
|
||||||
{
|
{
|
||||||
register value_ptr val = allocate_value (type);
|
struct value *val = allocate_value (type);
|
||||||
|
|
||||||
memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (check_typedef (type)));
|
memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (check_typedef (type)));
|
||||||
VALUE_LVAL (val) = lv;
|
VALUE_LVAL (val) = lv;
|
||||||
|
@ -464,10 +465,10 @@ value_zero (struct type *type, enum lval_type lv)
|
||||||
Note: value_at does *NOT* handle embedded offsets; perform such
|
Note: value_at does *NOT* handle embedded offsets; perform such
|
||||||
adjustments before or after calling it. */
|
adjustments before or after calling it. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_at (struct type *type, CORE_ADDR addr, asection *sect)
|
value_at (struct type *type, CORE_ADDR addr, asection *sect)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
|
|
||||||
if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
|
if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
|
||||||
error ("Attempt to dereference a generic pointer.");
|
error ("Attempt to dereference a generic pointer.");
|
||||||
|
@ -485,10 +486,10 @@ value_at (struct type *type, CORE_ADDR addr, asection *sect)
|
||||||
|
|
||||||
/* Return a lazy value with type TYPE located at ADDR (cf. value_at). */
|
/* Return a lazy value with type TYPE located at ADDR (cf. value_at). */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_at_lazy (struct type *type, CORE_ADDR addr, asection *sect)
|
value_at_lazy (struct type *type, CORE_ADDR addr, asection *sect)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
|
|
||||||
if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
|
if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
|
||||||
error ("Attempt to dereference a generic pointer.");
|
error ("Attempt to dereference a generic pointer.");
|
||||||
|
@ -516,7 +517,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr, asection *sect)
|
||||||
value is ignored. */
|
value is ignored. */
|
||||||
|
|
||||||
int
|
int
|
||||||
value_fetch_lazy (register value_ptr val)
|
value_fetch_lazy (struct value *val)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (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));
|
||||||
|
@ -533,11 +534,11 @@ value_fetch_lazy (register value_ptr val)
|
||||||
/* Store the contents of FROMVAL into the location of TOVAL.
|
/* Store the contents of FROMVAL into the location of TOVAL.
|
||||||
Return a new value with the location of TOVAL and contents of FROMVAL. */
|
Return a new value with the location of TOVAL and contents of FROMVAL. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_assign (register value_ptr toval, register value_ptr fromval)
|
value_assign (struct value *toval, struct value *fromval)
|
||||||
{
|
{
|
||||||
register struct type *type;
|
register struct type *type;
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
|
char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
|
||||||
int use_buffer = 0;
|
int use_buffer = 0;
|
||||||
|
|
||||||
|
@ -798,10 +799,10 @@ value_assign (register value_ptr toval, register value_ptr fromval)
|
||||||
|
|
||||||
/* Extend a value VAL to COUNT repetitions of its type. */
|
/* Extend a value VAL to COUNT repetitions of its type. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_repeat (value_ptr arg1, int count)
|
value_repeat (struct value *arg1, int count)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
|
|
||||||
if (VALUE_LVAL (arg1) != lval_memory)
|
if (VALUE_LVAL (arg1) != lval_memory)
|
||||||
error ("Only values in memory can be extended with '@'.");
|
error ("Only values in memory can be extended with '@'.");
|
||||||
|
@ -819,10 +820,10 @@ value_repeat (value_ptr arg1, int count)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_of_variable (struct symbol *var, struct block *b)
|
value_of_variable (struct symbol *var, struct block *b)
|
||||||
{
|
{
|
||||||
value_ptr val;
|
struct value *val;
|
||||||
struct frame_info *frame = NULL;
|
struct frame_info *frame = NULL;
|
||||||
|
|
||||||
if (!b)
|
if (!b)
|
||||||
|
@ -871,8 +872,8 @@ value_of_variable (struct symbol *var, struct block *b)
|
||||||
the coercion to pointer type.
|
the coercion to pointer type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_coerce_array (value_ptr arg1)
|
value_coerce_array (struct value *arg1)
|
||||||
{
|
{
|
||||||
register struct type *type = check_typedef (VALUE_TYPE (arg1));
|
register struct type *type = check_typedef (VALUE_TYPE (arg1));
|
||||||
|
|
||||||
|
@ -886,10 +887,10 @@ value_coerce_array (value_ptr arg1)
|
||||||
/* Given a value which is a function, return a value which is a pointer
|
/* Given a value which is a function, return a value which is a pointer
|
||||||
to it. */
|
to it. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_coerce_function (value_ptr arg1)
|
value_coerce_function (struct value *arg1)
|
||||||
{
|
{
|
||||||
value_ptr retval;
|
struct value *retval;
|
||||||
|
|
||||||
if (VALUE_LVAL (arg1) != lval_memory)
|
if (VALUE_LVAL (arg1) != lval_memory)
|
||||||
error ("Attempt to take address of value not located in memory.");
|
error ("Attempt to take address of value not located in memory.");
|
||||||
|
@ -902,10 +903,10 @@ value_coerce_function (value_ptr arg1)
|
||||||
|
|
||||||
/* Return a pointer value for the object for which ARG1 is the contents. */
|
/* Return a pointer value for the object for which ARG1 is the contents. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_addr (value_ptr arg1)
|
value_addr (struct value *arg1)
|
||||||
{
|
{
|
||||||
value_ptr arg2;
|
struct value *arg2;
|
||||||
|
|
||||||
struct type *type = check_typedef (VALUE_TYPE (arg1));
|
struct type *type = check_typedef (VALUE_TYPE (arg1));
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_REF)
|
if (TYPE_CODE (type) == TYPE_CODE_REF)
|
||||||
|
@ -940,11 +941,11 @@ value_addr (value_ptr arg1)
|
||||||
|
|
||||||
/* Given a value of a pointer type, apply the C unary * operator to it. */
|
/* Given a value of a pointer type, apply the C unary * operator to it. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_ind (value_ptr arg1)
|
value_ind (struct value *arg1)
|
||||||
{
|
{
|
||||||
struct type *base_type;
|
struct type *base_type;
|
||||||
value_ptr arg2;
|
struct value *arg2;
|
||||||
|
|
||||||
COERCE_ARRAY (arg1);
|
COERCE_ARRAY (arg1);
|
||||||
|
|
||||||
|
@ -1043,7 +1044,7 @@ push_bytes (CORE_ADDR sp, char *buffer, int len)
|
||||||
it to be an argument to a function. */
|
it to be an argument to a function. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
value_push (register CORE_ADDR sp, value_ptr arg)
|
value_push (register CORE_ADDR sp, struct value *arg)
|
||||||
{
|
{
|
||||||
register int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
|
register int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
|
||||||
register int container_len = len;
|
register int container_len = len;
|
||||||
|
@ -1081,7 +1082,7 @@ value_push (register CORE_ADDR sp, value_ptr arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
default_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
|
default_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
||||||
int struct_return, CORE_ADDR struct_addr)
|
int struct_return, CORE_ADDR struct_addr)
|
||||||
{
|
{
|
||||||
/* ASSERT ( !struct_return); */
|
/* ASSERT ( !struct_return); */
|
||||||
|
@ -1140,8 +1141,8 @@ standard_coerce_float_to_double (struct type *formal, struct type *actual)
|
||||||
If PARAM_TYPE is non-NULL, it is the expected parameter type.
|
If PARAM_TYPE is non-NULL, it is the expected parameter type.
|
||||||
IS_PROTOTYPED is non-zero if the function declaration is prototyped. */
|
IS_PROTOTYPED is non-zero if the function declaration is prototyped. */
|
||||||
|
|
||||||
static value_ptr
|
static struct value *
|
||||||
value_arg_coerce (value_ptr arg, struct type *param_type, int is_prototyped)
|
value_arg_coerce (struct value *arg, struct type *param_type, int is_prototyped)
|
||||||
{
|
{
|
||||||
register struct type *arg_type = check_typedef (VALUE_TYPE (arg));
|
register struct type *arg_type = check_typedef (VALUE_TYPE (arg));
|
||||||
register struct type *type
|
register struct type *type
|
||||||
|
@ -1217,7 +1218,7 @@ value_arg_coerce (value_ptr arg, struct type *param_type, int is_prototyped)
|
||||||
Calls error() if the function is not valid for calling. */
|
Calls error() if the function is not valid for calling. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
find_function_addr (value_ptr function, struct type **retval_type)
|
find_function_addr (struct value *function, struct type **retval_type)
|
||||||
{
|
{
|
||||||
register struct type *ftype = check_typedef (VALUE_TYPE (function));
|
register struct type *ftype = check_typedef (VALUE_TYPE (function));
|
||||||
register enum type_code code = TYPE_CODE (ftype);
|
register enum type_code code = TYPE_CODE (ftype);
|
||||||
|
@ -1283,10 +1284,8 @@ find_function_addr (value_ptr function, struct type **retval_type)
|
||||||
|
|
||||||
ARGS is modified to contain coerced values. */
|
ARGS is modified to contain coerced values. */
|
||||||
|
|
||||||
static value_ptr hand_function_call (value_ptr function, int nargs,
|
static struct value *
|
||||||
value_ptr * args);
|
hand_function_call (struct value *function, int nargs, struct value **args)
|
||||||
static value_ptr
|
|
||||||
hand_function_call (value_ptr function, int nargs, value_ptr *args)
|
|
||||||
{
|
{
|
||||||
register CORE_ADDR sp;
|
register CORE_ADDR sp;
|
||||||
register int i;
|
register int i;
|
||||||
|
@ -1777,15 +1776,15 @@ the function call).", name);
|
||||||
|
|
||||||
#ifdef VALUE_RETURNED_FROM_STACK
|
#ifdef VALUE_RETURNED_FROM_STACK
|
||||||
if (struct_return)
|
if (struct_return)
|
||||||
return (value_ptr) VALUE_RETURNED_FROM_STACK (value_type, struct_addr);
|
return (struct value *) VALUE_RETURNED_FROM_STACK (value_type, struct_addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return value_being_returned (value_type, retbuf, struct_return);
|
return value_being_returned (value_type, retbuf, struct_return);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
call_function_by_hand (value_ptr function, int nargs, value_ptr *args)
|
call_function_by_hand (struct value *function, int nargs, struct value **args)
|
||||||
{
|
{
|
||||||
if (CALL_DUMMY_P)
|
if (CALL_DUMMY_P)
|
||||||
{
|
{
|
||||||
|
@ -1809,13 +1808,13 @@ call_function_by_hand (value_ptr function, int nargs, value_ptr *args)
|
||||||
first element, and all elements must have the same size (though we
|
first element, and all elements must have the same size (though we
|
||||||
don't currently enforce any restriction on their types). */
|
don't currently enforce any restriction on their types). */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_array (int lowbound, int highbound, value_ptr *elemvec)
|
value_array (int lowbound, int highbound, struct value **elemvec)
|
||||||
{
|
{
|
||||||
int nelem;
|
int nelem;
|
||||||
int idx;
|
int idx;
|
||||||
unsigned int typelength;
|
unsigned int typelength;
|
||||||
value_ptr val;
|
struct value *val;
|
||||||
struct type *rangetype;
|
struct type *rangetype;
|
||||||
struct type *arraytype;
|
struct type *arraytype;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
@ -1881,10 +1880,10 @@ value_array (int lowbound, int highbound, value_ptr *elemvec)
|
||||||
zero and an upper bound of LEN - 1. Also note that the string may contain
|
zero and an upper bound of LEN - 1. Also note that the string may contain
|
||||||
embedded null bytes. */
|
embedded null bytes. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_string (char *ptr, int len)
|
value_string (char *ptr, int len)
|
||||||
{
|
{
|
||||||
value_ptr val;
|
struct value *val;
|
||||||
int lowbound = current_language->string_lower_bound;
|
int lowbound = current_language->string_lower_bound;
|
||||||
struct type *rangetype = create_range_type ((struct type *) NULL,
|
struct type *rangetype = create_range_type ((struct type *) NULL,
|
||||||
builtin_type_int,
|
builtin_type_int,
|
||||||
|
@ -1911,10 +1910,10 @@ value_string (char *ptr, int len)
|
||||||
return (val);
|
return (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_bitstring (char *ptr, int len)
|
value_bitstring (char *ptr, int len)
|
||||||
{
|
{
|
||||||
value_ptr val;
|
struct value *val;
|
||||||
struct type *domain_type = create_range_type (NULL, builtin_type_int,
|
struct type *domain_type = create_range_type (NULL, builtin_type_int,
|
||||||
0, len - 1);
|
0, len - 1);
|
||||||
struct type *type = create_set_type ((struct type *) NULL, domain_type);
|
struct type *type = create_set_type ((struct type *) NULL, domain_type);
|
||||||
|
@ -1940,7 +1939,7 @@ value_bitstring (char *ptr, int len)
|
||||||
requested operation is type secure, shouldn't we? FIXME. */
|
requested operation is type secure, shouldn't we? FIXME. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
typecmp (int staticp, struct type *t1[], value_ptr t2[])
|
typecmp (int staticp, struct type *t1[], struct value *t2[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -2012,8 +2011,8 @@ typecmp (int staticp, struct type *t1[], value_ptr t2[])
|
||||||
If LOOKING_FOR_BASECLASS, then instead of looking for struct fields,
|
If LOOKING_FOR_BASECLASS, then instead of looking for struct fields,
|
||||||
look for a baseclass named NAME. */
|
look for a baseclass named NAME. */
|
||||||
|
|
||||||
static value_ptr
|
static struct value *
|
||||||
search_struct_field (char *name, register value_ptr arg1, int offset,
|
search_struct_field (char *name, struct value *arg1, int offset,
|
||||||
register struct type *type, int looking_for_baseclass)
|
register struct type *type, int looking_for_baseclass)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2028,7 +2027,7 @@ search_struct_field (char *name, register value_ptr arg1, int offset,
|
||||||
|
|
||||||
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
|
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
|
||||||
{
|
{
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
if (TYPE_FIELD_STATIC (type, i))
|
if (TYPE_FIELD_STATIC (type, i))
|
||||||
v = value_static_field (type, i);
|
v = value_static_field (type, i);
|
||||||
else
|
else
|
||||||
|
@ -2056,7 +2055,7 @@ search_struct_field (char *name, register value_ptr arg1, int offset,
|
||||||
Each <variant alternative> is represented as a struct,
|
Each <variant alternative> is represented as a struct,
|
||||||
with a member for each <variant field>. */
|
with a member for each <variant field>. */
|
||||||
|
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
int new_offset = offset;
|
int new_offset = offset;
|
||||||
|
|
||||||
/* This is pretty gross. In G++, the offset in an anonymous
|
/* This is pretty gross. In G++, the offset in an anonymous
|
||||||
|
@ -2079,7 +2078,7 @@ search_struct_field (char *name, register value_ptr arg1, int offset,
|
||||||
|
|
||||||
for (i = 0; i < nbases; i++)
|
for (i = 0; i < nbases; i++)
|
||||||
{
|
{
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
struct type *basetype = check_typedef (TYPE_BASECLASS (type, i));
|
struct type *basetype = check_typedef (TYPE_BASECLASS (type, i));
|
||||||
/* If we are looking for baseclasses, this is what we get when we
|
/* If we are looking for baseclasses, this is what we get when we
|
||||||
hit them. But it could happen that the base part's member name
|
hit them. But it could happen that the base part's member name
|
||||||
|
@ -2091,7 +2090,7 @@ search_struct_field (char *name, register value_ptr arg1, int offset,
|
||||||
if (BASETYPE_VIA_VIRTUAL (type, i))
|
if (BASETYPE_VIA_VIRTUAL (type, i))
|
||||||
{
|
{
|
||||||
int boffset;
|
int boffset;
|
||||||
value_ptr v2 = allocate_value (basetype);
|
struct value *v2 = allocate_value (basetype);
|
||||||
|
|
||||||
boffset = baseclass_offset (type, i,
|
boffset = baseclass_offset (type, i,
|
||||||
VALUE_CONTENTS (arg1) + offset,
|
VALUE_CONTENTS (arg1) + offset,
|
||||||
|
@ -2173,7 +2172,7 @@ find_rt_vbase_offset (struct type *type, struct type *basetype, char *valaddr,
|
||||||
int index; /* displacement to use in virtual table */
|
int index; /* displacement to use in virtual table */
|
||||||
int skip;
|
int skip;
|
||||||
|
|
||||||
value_ptr vp;
|
struct value *vp;
|
||||||
CORE_ADDR vtbl; /* the virtual table pointer */
|
CORE_ADDR vtbl; /* the virtual table pointer */
|
||||||
struct type *pbc; /* the primary base class */
|
struct type *pbc; /* the primary base class */
|
||||||
|
|
||||||
|
@ -2241,13 +2240,13 @@ find_rt_vbase_offset (struct type *type, struct type *basetype, char *valaddr,
|
||||||
If found, return value, else if name matched and args not return (value)-1,
|
If found, return value, else if name matched and args not return (value)-1,
|
||||||
else return NULL. */
|
else return NULL. */
|
||||||
|
|
||||||
static value_ptr
|
static struct value *
|
||||||
search_struct_method (char *name, register value_ptr *arg1p,
|
search_struct_method (char *name, struct value **arg1p,
|
||||||
register value_ptr *args, int offset,
|
struct value **args, int offset,
|
||||||
int *static_memfuncp, register struct type *type)
|
int *static_memfuncp, register struct type *type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
int name_matched = 0;
|
int name_matched = 0;
|
||||||
char dem_opname[64];
|
char dem_opname[64];
|
||||||
|
|
||||||
|
@ -2346,7 +2345,7 @@ search_struct_method (char *name, register value_ptr *arg1p,
|
||||||
}
|
}
|
||||||
v = search_struct_method (name, arg1p, args, base_offset + offset,
|
v = search_struct_method (name, arg1p, args, base_offset + offset,
|
||||||
static_memfuncp, TYPE_BASECLASS (type, i));
|
static_memfuncp, TYPE_BASECLASS (type, i));
|
||||||
if (v == (value_ptr) - 1)
|
if (v == (struct value *) - 1)
|
||||||
{
|
{
|
||||||
name_matched = 1;
|
name_matched = 1;
|
||||||
}
|
}
|
||||||
|
@ -2358,7 +2357,7 @@ search_struct_method (char *name, register value_ptr *arg1p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name_matched)
|
if (name_matched)
|
||||||
return (value_ptr) - 1;
|
return (struct value *) - 1;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2377,12 +2376,12 @@ search_struct_method (char *name, register value_ptr *arg1p,
|
||||||
|
|
||||||
ERR is an error message to be printed in case the field is not found. */
|
ERR is an error message to be printed in case the field is not found. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_struct_elt (register value_ptr *argp, register value_ptr *args,
|
value_struct_elt (struct value **argp, struct value **args,
|
||||||
char *name, int *static_memfuncp, char *err)
|
char *name, int *static_memfuncp, char *err)
|
||||||
{
|
{
|
||||||
register struct type *t;
|
register struct type *t;
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
|
|
||||||
COERCE_ARRAY (*argp);
|
COERCE_ARRAY (*argp);
|
||||||
|
|
||||||
|
@ -2428,7 +2427,7 @@ value_struct_elt (register value_ptr *argp, register value_ptr *args,
|
||||||
|
|
||||||
v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
|
v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
|
||||||
|
|
||||||
if (v == (value_ptr) - 1)
|
if (v == (struct value *) - 1)
|
||||||
error ("Cannot take address of a method");
|
error ("Cannot take address of a method");
|
||||||
else if (v == 0)
|
else if (v == 0)
|
||||||
{
|
{
|
||||||
|
@ -2466,7 +2465,7 @@ value_struct_elt (register value_ptr *argp, register value_ptr *args,
|
||||||
else
|
else
|
||||||
v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
|
v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
|
||||||
|
|
||||||
if (v == (value_ptr) - 1)
|
if (v == (struct value *) - 1)
|
||||||
{
|
{
|
||||||
error ("One of the arguments you tried to pass to %s could not be converted to what the function wants.", name);
|
error ("One of the arguments you tried to pass to %s could not be converted to what the function wants.", name);
|
||||||
}
|
}
|
||||||
|
@ -2497,7 +2496,7 @@ value_struct_elt (register value_ptr *argp, register value_ptr *args,
|
||||||
* BOFFSET is the offset of the base subobject where the method is found */
|
* BOFFSET is the offset of the base subobject where the method is found */
|
||||||
|
|
||||||
static struct fn_field *
|
static struct fn_field *
|
||||||
find_method_list (value_ptr *argp, char *method, int offset,
|
find_method_list (struct value **argp, char *method, int offset,
|
||||||
int *static_memfuncp, struct type *type, int *num_fns,
|
int *static_memfuncp, struct type *type, int *num_fns,
|
||||||
struct type **basetype, int *boffset)
|
struct type **basetype, int *boffset)
|
||||||
{
|
{
|
||||||
|
@ -2574,7 +2573,7 @@ find_method_list (value_ptr *argp, char *method, int offset,
|
||||||
* BOFFSET is the offset of the base subobject which defines the method */
|
* BOFFSET is the offset of the base subobject which defines the method */
|
||||||
|
|
||||||
struct fn_field *
|
struct fn_field *
|
||||||
value_find_oload_method_list (value_ptr *argp, char *method, int offset,
|
value_find_oload_method_list (struct value **argp, char *method, int offset,
|
||||||
int *static_memfuncp, int *num_fns,
|
int *static_memfuncp, int *num_fns,
|
||||||
struct type **basetype, int *boffset)
|
struct type **basetype, int *boffset)
|
||||||
{
|
{
|
||||||
|
@ -2637,8 +2636,8 @@ value_find_oload_method_list (value_ptr *argp, char *method, int offset,
|
||||||
|
|
||||||
int
|
int
|
||||||
find_overload_match (struct type **arg_types, int nargs, char *name, int method,
|
find_overload_match (struct type **arg_types, int nargs, char *name, int method,
|
||||||
int lax, value_ptr obj, struct symbol *fsym,
|
int lax, struct value *obj, struct symbol *fsym,
|
||||||
value_ptr *valp, struct symbol **symp, int *staticp)
|
struct value **valp, struct symbol **symp, int *staticp)
|
||||||
{
|
{
|
||||||
int nparms;
|
int nparms;
|
||||||
struct type **parm_types;
|
struct type **parm_types;
|
||||||
|
@ -2654,7 +2653,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method,
|
||||||
struct badness_vector *bv; /* A measure of how good an overloaded instance is */
|
struct badness_vector *bv; /* A measure of how good an overloaded instance is */
|
||||||
struct badness_vector *oload_champ_bv = NULL; /* The measure for the current best match */
|
struct badness_vector *oload_champ_bv = NULL; /* The measure for the current best match */
|
||||||
|
|
||||||
value_ptr temp = obj;
|
struct value *temp = obj;
|
||||||
struct fn_field *fns_ptr = NULL; /* For methods, the list of overloaded methods */
|
struct fn_field *fns_ptr = NULL; /* For methods, the list of overloaded methods */
|
||||||
struct symbol **oload_syms = NULL; /* For non-methods, the list of overloaded function symbols */
|
struct symbol **oload_syms = NULL; /* For non-methods, the list of overloaded function symbols */
|
||||||
int num_fns = 0; /* Number of overloaded instances being considered */
|
int num_fns = 0; /* Number of overloaded instances being considered */
|
||||||
|
@ -2942,7 +2941,7 @@ check_field_in (register struct type *type, const char *name)
|
||||||
target structure/union is defined, otherwise, return 0. */
|
target structure/union is defined, otherwise, return 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
check_field (register value_ptr arg1, const char *name)
|
check_field (struct value *arg1, const char *name)
|
||||||
{
|
{
|
||||||
register struct type *t;
|
register struct type *t;
|
||||||
|
|
||||||
|
@ -2977,14 +2976,14 @@ check_field (register value_ptr arg1, const char *name)
|
||||||
"pointers to member functions". This function is used
|
"pointers to member functions". This function is used
|
||||||
to resolve user expressions of the form "DOMAIN::NAME". */
|
to resolve user expressions of the form "DOMAIN::NAME". */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_struct_elt_for_reference (struct type *domain, int offset,
|
value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
struct type *curtype, char *name,
|
struct type *curtype, char *name,
|
||||||
struct type *intype)
|
struct type *intype)
|
||||||
{
|
{
|
||||||
register struct type *t = curtype;
|
register struct type *t = curtype;
|
||||||
register int i;
|
register int i;
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
|
|
||||||
if (TYPE_CODE (t) != TYPE_CODE_STRUCT
|
if (TYPE_CODE (t) != TYPE_CODE_STRUCT
|
||||||
&& TYPE_CODE (t) != TYPE_CODE_UNION)
|
&& TYPE_CODE (t) != TYPE_CODE_UNION)
|
||||||
|
@ -3092,7 +3091,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
}
|
}
|
||||||
for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--)
|
for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
value_ptr v;
|
struct value *v;
|
||||||
int base_offset;
|
int base_offset;
|
||||||
|
|
||||||
if (BASETYPE_VIA_VIRTUAL (t, i))
|
if (BASETYPE_VIA_VIRTUAL (t, i))
|
||||||
|
@ -3117,9 +3116,9 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
and refer to the values computed for the object pointed to. */
|
and refer to the values computed for the object pointed to. */
|
||||||
|
|
||||||
struct type *
|
struct type *
|
||||||
value_rtti_target_type (value_ptr v, int *full, int *top, int *using_enc)
|
value_rtti_target_type (struct value *v, int *full, int *top, int *using_enc)
|
||||||
{
|
{
|
||||||
value_ptr target;
|
struct value *target;
|
||||||
|
|
||||||
target = value_ind (v);
|
target = value_ind (v);
|
||||||
|
|
||||||
|
@ -3136,15 +3135,15 @@ value_rtti_target_type (value_ptr v, int *full, int *top, int *using_enc)
|
||||||
they can be supplied and a second call to value_rtti_type() is avoided.
|
they can be supplied and a second call to value_rtti_type() is avoided.
|
||||||
(Pass RTYPE == NULL if they're not available */
|
(Pass RTYPE == NULL if they're not available */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_full_object (value_ptr argp, struct type *rtype, int xfull, int xtop,
|
value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
|
||||||
int xusing_enc)
|
int xusing_enc)
|
||||||
{
|
{
|
||||||
struct type *real_type;
|
struct type *real_type;
|
||||||
int full = 0;
|
int full = 0;
|
||||||
int top = -1;
|
int top = -1;
|
||||||
int using_enc = 0;
|
int using_enc = 0;
|
||||||
value_ptr new_val;
|
struct value *new_val;
|
||||||
|
|
||||||
if (rtype)
|
if (rtype)
|
||||||
{
|
{
|
||||||
|
@ -3195,14 +3194,14 @@ value_full_object (value_ptr argp, struct type *rtype, int xfull, int xtop,
|
||||||
Flag COMPLAIN signals an error if the request is made in an
|
Flag COMPLAIN signals an error if the request is made in an
|
||||||
inappropriate context. */
|
inappropriate context. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_of_this (int complain)
|
value_of_this (int complain)
|
||||||
{
|
{
|
||||||
struct symbol *func, *sym;
|
struct symbol *func, *sym;
|
||||||
struct block *b;
|
struct block *b;
|
||||||
int i;
|
int i;
|
||||||
static const char funny_this[] = "this";
|
static const char funny_this[] = "this";
|
||||||
value_ptr this;
|
struct value *this;
|
||||||
|
|
||||||
if (selected_frame == 0)
|
if (selected_frame == 0)
|
||||||
{
|
{
|
||||||
|
@ -3252,12 +3251,12 @@ value_of_this (int complain)
|
||||||
long, starting at LOWBOUND. The result has the same lower bound as
|
long, starting at LOWBOUND. The result has the same lower bound as
|
||||||
the original ARRAY. */
|
the original ARRAY. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_slice (value_ptr array, int lowbound, int length)
|
value_slice (struct value *array, int lowbound, int length)
|
||||||
{
|
{
|
||||||
struct type *slice_range_type, *slice_type, *range_type;
|
struct type *slice_range_type, *slice_type, *range_type;
|
||||||
LONGEST lowerbound, upperbound, offset;
|
LONGEST lowerbound, upperbound, offset;
|
||||||
value_ptr slice;
|
struct value *slice;
|
||||||
struct type *array_type;
|
struct type *array_type;
|
||||||
array_type = check_typedef (VALUE_TYPE (array));
|
array_type = check_typedef (VALUE_TYPE (array));
|
||||||
COERCE_VARYING_ARRAY (array, array_type);
|
COERCE_VARYING_ARRAY (array, array_type);
|
||||||
|
@ -3331,8 +3330,8 @@ value_slice (value_ptr array, int lowbound, int length)
|
||||||
/* Assuming chill_varying_type (VARRAY) is true, return an equivalent
|
/* Assuming chill_varying_type (VARRAY) is true, return an equivalent
|
||||||
value as a fixed-length array. */
|
value as a fixed-length array. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
varying_to_slice (value_ptr varray)
|
varying_to_slice (struct value *varray)
|
||||||
{
|
{
|
||||||
struct type *vtype = check_typedef (VALUE_TYPE (varray));
|
struct type *vtype = check_typedef (VALUE_TYPE (varray));
|
||||||
LONGEST length = unpack_long (TYPE_FIELD_TYPE (vtype, 0),
|
LONGEST length = unpack_long (TYPE_FIELD_TYPE (vtype, 0),
|
||||||
|
@ -3347,10 +3346,10 @@ varying_to_slice (value_ptr varray)
|
||||||
that figures out precision inteligently as opposed to assuming
|
that figures out precision inteligently as opposed to assuming
|
||||||
doubles. FIXME: fmb */
|
doubles. FIXME: fmb */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_literal_complex (value_ptr arg1, value_ptr arg2, struct type *type)
|
value_literal_complex (struct value *arg1, struct value *arg2, struct type *type)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
struct type *real_type = TYPE_TARGET_TYPE (type);
|
struct type *real_type = TYPE_TARGET_TYPE (type);
|
||||||
|
|
||||||
val = allocate_value (type);
|
val = allocate_value (type);
|
||||||
|
@ -3366,15 +3365,15 @@ value_literal_complex (value_ptr arg1, value_ptr arg2, struct type *type)
|
||||||
|
|
||||||
/* Cast a value into the appropriate complex data type. */
|
/* Cast a value into the appropriate complex data type. */
|
||||||
|
|
||||||
static value_ptr
|
static struct value *
|
||||||
cast_into_complex (struct type *type, register value_ptr val)
|
cast_into_complex (struct type *type, struct value *val)
|
||||||
{
|
{
|
||||||
struct type *real_type = TYPE_TARGET_TYPE (type);
|
struct type *real_type = TYPE_TARGET_TYPE (type);
|
||||||
if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_COMPLEX)
|
if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_COMPLEX)
|
||||||
{
|
{
|
||||||
struct type *val_real_type = TYPE_TARGET_TYPE (VALUE_TYPE (val));
|
struct type *val_real_type = TYPE_TARGET_TYPE (VALUE_TYPE (val));
|
||||||
value_ptr re_val = allocate_value (val_real_type);
|
struct value *re_val = allocate_value (val_real_type);
|
||||||
value_ptr im_val = allocate_value (val_real_type);
|
struct value *im_val = allocate_value (val_real_type);
|
||||||
|
|
||||||
memcpy (VALUE_CONTENTS_RAW (re_val),
|
memcpy (VALUE_CONTENTS_RAW (re_val),
|
||||||
VALUE_CONTENTS (val), TYPE_LENGTH (val_real_type));
|
VALUE_CONTENTS (val), TYPE_LENGTH (val_real_type));
|
||||||
|
|
237
gdb/value.h
237
gdb/value.h
|
@ -1,6 +1,6 @@
|
||||||
/* Definitions for values of C expressions, for GDB.
|
/* Definitions for values of C expressions, for GDB.
|
||||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
1996, 1997, 1998, 1999, 2000, 2001
|
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -202,7 +202,7 @@ typedef struct value *value_ptr;
|
||||||
VALUE_CONTENTS_ALL_RAW(val))
|
VALUE_CONTENTS_ALL_RAW(val))
|
||||||
|
|
||||||
|
|
||||||
extern int value_fetch_lazy (value_ptr val);
|
extern int value_fetch_lazy (struct value *val);
|
||||||
|
|
||||||
#define VALUE_LVAL(val) (val)->lval
|
#define VALUE_LVAL(val) (val)->lval
|
||||||
#define VALUE_ADDRESS(val) (val)->location.address
|
#define VALUE_ADDRESS(val) (val)->location.address
|
||||||
|
@ -266,7 +266,7 @@ struct internalvar
|
||||||
{
|
{
|
||||||
struct internalvar *next;
|
struct internalvar *next;
|
||||||
char *name;
|
char *name;
|
||||||
value_ptr value;
|
struct value *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pointer to member function. Depends on compiler implementation. */
|
/* Pointer to member function. Depends on compiler implementation. */
|
||||||
|
@ -285,11 +285,11 @@ struct fn_field;
|
||||||
|
|
||||||
extern void print_address_demangle (CORE_ADDR, struct ui_file *, int);
|
extern void print_address_demangle (CORE_ADDR, struct ui_file *, int);
|
||||||
|
|
||||||
extern LONGEST value_as_long (value_ptr val);
|
extern LONGEST value_as_long (struct value *val);
|
||||||
|
|
||||||
extern DOUBLEST value_as_double (value_ptr val);
|
extern DOUBLEST value_as_double (struct value *val);
|
||||||
|
|
||||||
extern CORE_ADDR value_as_address (value_ptr val);
|
extern CORE_ADDR value_as_address (struct value *val);
|
||||||
|
|
||||||
extern LONGEST unpack_long (struct type *type, char *valaddr);
|
extern LONGEST unpack_long (struct type *type, char *valaddr);
|
||||||
|
|
||||||
|
@ -300,138 +300,144 @@ extern CORE_ADDR unpack_pointer (struct type *type, char *valaddr);
|
||||||
extern LONGEST unpack_field_as_long (struct type *type, char *valaddr,
|
extern LONGEST unpack_field_as_long (struct type *type, char *valaddr,
|
||||||
int fieldno);
|
int fieldno);
|
||||||
|
|
||||||
extern value_ptr value_from_longest (struct type *type, LONGEST num);
|
extern struct value *value_from_longest (struct type *type, LONGEST num);
|
||||||
|
|
||||||
extern value_ptr value_from_pointer (struct type *type, CORE_ADDR addr);
|
extern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
|
||||||
|
|
||||||
extern value_ptr value_from_double (struct type *type, DOUBLEST num);
|
extern struct value *value_from_double (struct type *type, DOUBLEST num);
|
||||||
|
|
||||||
extern value_ptr value_from_string (char *string);
|
extern struct value *value_from_string (char *string);
|
||||||
|
|
||||||
extern value_ptr value_at (struct type *type, CORE_ADDR addr,
|
extern struct value *value_at (struct type *type, CORE_ADDR addr,
|
||||||
asection * sect);
|
asection * sect);
|
||||||
|
|
||||||
extern value_ptr value_at_lazy (struct type *type, CORE_ADDR addr,
|
extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr,
|
||||||
asection * sect);
|
asection * sect);
|
||||||
|
|
||||||
extern value_ptr value_from_register (struct type *type, int regnum,
|
extern struct value *value_from_register (struct type *type, int regnum,
|
||||||
struct frame_info *frame);
|
struct frame_info *frame);
|
||||||
|
|
||||||
extern value_ptr value_of_variable (struct symbol *var, struct block *b);
|
extern struct value *value_of_variable (struct symbol *var, struct block *b);
|
||||||
|
|
||||||
extern value_ptr value_of_register (int regnum);
|
extern struct value *value_of_register (int regnum);
|
||||||
|
|
||||||
extern int symbol_read_needs_frame (struct symbol *);
|
extern int symbol_read_needs_frame (struct symbol *);
|
||||||
|
|
||||||
extern value_ptr read_var_value (struct symbol *var,
|
extern struct value *read_var_value (struct symbol *var,
|
||||||
struct frame_info *frame);
|
struct frame_info *frame);
|
||||||
|
|
||||||
extern value_ptr locate_var_value (struct symbol *var,
|
extern struct value *locate_var_value (struct symbol *var,
|
||||||
struct frame_info *frame);
|
struct frame_info *frame);
|
||||||
|
|
||||||
extern value_ptr allocate_value (struct type *type);
|
extern struct value *allocate_value (struct type *type);
|
||||||
|
|
||||||
extern value_ptr allocate_repeat_value (struct type *type, int count);
|
extern struct value *allocate_repeat_value (struct type *type, int count);
|
||||||
|
|
||||||
extern value_ptr value_change_enclosing_type (value_ptr val, struct type *new_type);
|
extern struct value *value_change_enclosing_type (struct value *val,
|
||||||
|
struct type *new_type);
|
||||||
|
|
||||||
extern value_ptr value_mark (void);
|
extern struct value *value_mark (void);
|
||||||
|
|
||||||
extern void value_free_to_mark (value_ptr mark);
|
extern void value_free_to_mark (struct value *mark);
|
||||||
|
|
||||||
extern value_ptr value_string (char *ptr, int len);
|
extern struct value *value_string (char *ptr, int len);
|
||||||
extern value_ptr value_bitstring (char *ptr, int len);
|
extern struct value *value_bitstring (char *ptr, int len);
|
||||||
|
|
||||||
extern value_ptr value_array (int lowbound, int highbound,
|
extern struct value *value_array (int lowbound, int highbound,
|
||||||
value_ptr * elemvec);
|
struct value ** elemvec);
|
||||||
|
|
||||||
extern value_ptr value_concat (value_ptr arg1, value_ptr arg2);
|
extern struct value *value_concat (struct value *arg1, struct value *arg2);
|
||||||
|
|
||||||
extern value_ptr value_binop (value_ptr arg1, value_ptr arg2,
|
extern struct value *value_binop (struct value *arg1, struct value *arg2,
|
||||||
enum exp_opcode op);
|
enum exp_opcode op);
|
||||||
|
|
||||||
extern value_ptr value_add (value_ptr arg1, value_ptr arg2);
|
extern struct value *value_add (struct value *arg1, struct value *arg2);
|
||||||
|
|
||||||
extern value_ptr value_sub (value_ptr arg1, value_ptr arg2);
|
extern struct value *value_sub (struct value *arg1, struct value *arg2);
|
||||||
|
|
||||||
extern value_ptr value_coerce_array (value_ptr arg1);
|
extern struct value *value_coerce_array (struct value *arg1);
|
||||||
|
|
||||||
extern value_ptr value_coerce_function (value_ptr arg1);
|
extern struct value *value_coerce_function (struct value *arg1);
|
||||||
|
|
||||||
extern value_ptr value_ind (value_ptr arg1);
|
extern struct value *value_ind (struct value *arg1);
|
||||||
|
|
||||||
extern value_ptr value_addr (value_ptr arg1);
|
extern struct value *value_addr (struct value *arg1);
|
||||||
|
|
||||||
extern value_ptr value_assign (value_ptr toval, value_ptr fromval);
|
extern struct value *value_assign (struct value *toval, struct value *fromval);
|
||||||
|
|
||||||
extern value_ptr value_neg (value_ptr arg1);
|
extern struct value *value_neg (struct value *arg1);
|
||||||
|
|
||||||
extern value_ptr value_complement (value_ptr arg1);
|
extern struct value *value_complement (struct value *arg1);
|
||||||
|
|
||||||
extern value_ptr value_struct_elt (value_ptr * argp, value_ptr * args,
|
extern struct value *value_struct_elt (struct value **argp,
|
||||||
char *name,
|
struct value **args,
|
||||||
int *static_memfuncp, char *err);
|
char *name, int *static_memfuncp,
|
||||||
|
char *err);
|
||||||
|
|
||||||
extern value_ptr value_struct_elt_for_reference (struct type *domain,
|
extern struct value *value_struct_elt_for_reference (struct type *domain,
|
||||||
int offset,
|
int offset,
|
||||||
struct type *curtype,
|
struct type *curtype,
|
||||||
char *name,
|
char *name,
|
||||||
struct type *intype);
|
struct type *intype);
|
||||||
|
|
||||||
extern value_ptr value_static_field (struct type *type, int fieldno);
|
extern struct value *value_static_field (struct type *type, int fieldno);
|
||||||
|
|
||||||
extern struct fn_field *value_find_oload_method_list (value_ptr *, char *,
|
extern struct fn_field *value_find_oload_method_list (struct value **, char *,
|
||||||
int, int *, int *,
|
int, int *, int *,
|
||||||
struct type **, int *);
|
struct type **, int *);
|
||||||
|
|
||||||
extern int find_overload_match (struct type **arg_types, int nargs,
|
extern int find_overload_match (struct type **arg_types, int nargs,
|
||||||
char *name, int method, int lax,
|
char *name, int method, int lax,
|
||||||
value_ptr obj, struct symbol *fsym,
|
struct value *obj, struct symbol *fsym,
|
||||||
value_ptr * valp, struct symbol **symp,
|
struct value **valp, struct symbol **symp,
|
||||||
int *staticp);
|
int *staticp);
|
||||||
|
|
||||||
extern value_ptr value_field (value_ptr arg1, int fieldno);
|
extern struct value *value_field (struct value *arg1, int fieldno);
|
||||||
|
|
||||||
extern value_ptr value_primitive_field (value_ptr arg1, int offset,
|
extern struct value *value_primitive_field (struct value *arg1, int offset,
|
||||||
int fieldno, struct type *arg_type);
|
int fieldno,
|
||||||
|
struct type *arg_type);
|
||||||
|
|
||||||
|
|
||||||
extern struct type *value_rtti_target_type (value_ptr, int *, int *, int *);
|
extern struct type *value_rtti_target_type (struct value *, int *, int *,
|
||||||
|
int *);
|
||||||
|
|
||||||
extern value_ptr value_full_object (value_ptr, struct type *, int, int, int);
|
extern struct value *value_full_object (struct value *, struct type *, int,
|
||||||
|
int, int);
|
||||||
|
|
||||||
extern value_ptr value_cast (struct type *type, value_ptr arg2);
|
extern struct value *value_cast (struct type *type, struct value *arg2);
|
||||||
|
|
||||||
extern value_ptr value_zero (struct type *type, enum lval_type lv);
|
extern struct value *value_zero (struct type *type, enum lval_type lv);
|
||||||
|
|
||||||
extern value_ptr value_repeat (value_ptr arg1, int count);
|
extern struct value *value_repeat (struct value *arg1, int count);
|
||||||
|
|
||||||
extern value_ptr value_subscript (value_ptr array, value_ptr idx);
|
extern struct value *value_subscript (struct value *array, struct value *idx);
|
||||||
|
|
||||||
extern value_ptr value_from_vtable_info (value_ptr arg, struct type *type);
|
extern struct value *value_from_vtable_info (struct value *arg,
|
||||||
|
struct type *type);
|
||||||
|
|
||||||
extern value_ptr value_being_returned (struct type *valtype,
|
extern struct value *value_being_returned (struct type *valtype,
|
||||||
char *retbuf, int struct_return);
|
char *retbuf, int struct_return);
|
||||||
|
|
||||||
extern value_ptr value_in (value_ptr element, value_ptr set);
|
extern struct value *value_in (struct value *element, struct value *set);
|
||||||
|
|
||||||
extern int value_bit_index (struct type *type, char *addr, int index);
|
extern int value_bit_index (struct type *type, char *addr, int index);
|
||||||
|
|
||||||
extern int using_struct_return (value_ptr function, CORE_ADDR funcaddr,
|
extern int using_struct_return (struct value *function, CORE_ADDR funcaddr,
|
||||||
struct type *value_type, int gcc_p);
|
struct type *value_type, int gcc_p);
|
||||||
|
|
||||||
extern void set_return_value (value_ptr val);
|
extern void set_return_value (struct value *val);
|
||||||
|
|
||||||
extern value_ptr evaluate_expression (struct expression *exp);
|
extern struct value *evaluate_expression (struct expression *exp);
|
||||||
|
|
||||||
extern value_ptr evaluate_type (struct expression *exp);
|
extern struct value *evaluate_type (struct expression *exp);
|
||||||
|
|
||||||
extern value_ptr evaluate_subexp_with_coercion (struct expression *,
|
extern struct value *evaluate_subexp_with_coercion (struct expression *,
|
||||||
int *, enum noside);
|
int *, enum noside);
|
||||||
|
|
||||||
extern value_ptr parse_and_eval (char *exp);
|
extern struct value *parse_and_eval (char *exp);
|
||||||
|
|
||||||
extern value_ptr parse_to_comma_and_eval (char **expp);
|
extern struct value *parse_to_comma_and_eval (char **expp);
|
||||||
|
|
||||||
extern struct type *parse_and_eval_type (char *p, int length);
|
extern struct type *parse_and_eval_type (char *p, int length);
|
||||||
|
|
||||||
|
@ -441,43 +447,44 @@ extern CORE_ADDR parse_and_eval_address_1 (char **expptr);
|
||||||
|
|
||||||
extern LONGEST parse_and_eval_long (char *exp);
|
extern LONGEST parse_and_eval_long (char *exp);
|
||||||
|
|
||||||
extern value_ptr access_value_history (int num);
|
extern struct value *access_value_history (int num);
|
||||||
|
|
||||||
extern value_ptr value_of_internalvar (struct internalvar *var);
|
extern struct value *value_of_internalvar (struct internalvar *var);
|
||||||
|
|
||||||
extern void set_internalvar (struct internalvar *var, value_ptr val);
|
extern void set_internalvar (struct internalvar *var, struct value *val);
|
||||||
|
|
||||||
extern void set_internalvar_component (struct internalvar *var,
|
extern void set_internalvar_component (struct internalvar *var,
|
||||||
int offset,
|
int offset,
|
||||||
int bitpos, int bitsize,
|
int bitpos, int bitsize,
|
||||||
value_ptr newvalue);
|
struct value *newvalue);
|
||||||
|
|
||||||
extern struct internalvar *lookup_internalvar (char *name);
|
extern struct internalvar *lookup_internalvar (char *name);
|
||||||
|
|
||||||
extern int value_equal (value_ptr arg1, value_ptr arg2);
|
extern int value_equal (struct value *arg1, struct value *arg2);
|
||||||
|
|
||||||
extern int value_less (value_ptr arg1, value_ptr arg2);
|
extern int value_less (struct value *arg1, struct value *arg2);
|
||||||
|
|
||||||
extern int value_logical_not (value_ptr arg1);
|
extern int value_logical_not (struct value *arg1);
|
||||||
|
|
||||||
/* C++ */
|
/* C++ */
|
||||||
|
|
||||||
extern value_ptr value_of_this (int complain);
|
extern struct value *value_of_this (int complain);
|
||||||
|
|
||||||
extern value_ptr value_x_binop (value_ptr arg1, value_ptr arg2,
|
extern struct value *value_x_binop (struct value *arg1, struct value *arg2,
|
||||||
enum exp_opcode op,
|
enum exp_opcode op,
|
||||||
enum exp_opcode otherop, enum noside noside);
|
enum exp_opcode otherop,
|
||||||
|
enum noside noside);
|
||||||
|
|
||||||
extern value_ptr value_x_unop (value_ptr arg1, enum exp_opcode op,
|
extern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
|
||||||
enum noside noside);
|
enum noside noside);
|
||||||
|
|
||||||
extern value_ptr value_fn_field (value_ptr * arg1p, struct fn_field *f,
|
extern struct value *value_fn_field (struct value ** arg1p, struct fn_field *f,
|
||||||
int j, struct type *type, int offset);
|
int j, struct type *type, int offset);
|
||||||
|
|
||||||
extern int binop_user_defined_p (enum exp_opcode op,
|
extern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
|
||||||
value_ptr arg1, value_ptr arg2);
|
struct value *arg2);
|
||||||
|
|
||||||
extern int unop_user_defined_p (enum exp_opcode op, value_ptr arg1);
|
extern int unop_user_defined_p (enum exp_opcode op, struct value *arg1);
|
||||||
|
|
||||||
extern int destructor_name_p (const char *name, const struct type *type);
|
extern int destructor_name_p (const char *name, const struct type *type);
|
||||||
|
|
||||||
|
@ -485,9 +492,9 @@ extern int destructor_name_p (const char *name, const struct type *type);
|
||||||
|
|
||||||
extern void free_all_values (void);
|
extern void free_all_values (void);
|
||||||
|
|
||||||
extern void release_value (value_ptr val);
|
extern void release_value (struct value *val);
|
||||||
|
|
||||||
extern int record_latest_value (value_ptr val);
|
extern int record_latest_value (struct value *val);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
modify_field (char *addr, LONGEST fieldval, int bitpos, int bitsize);
|
modify_field (char *addr, LONGEST fieldval, int bitpos, int bitsize);
|
||||||
|
@ -495,8 +502,8 @@ modify_field (char *addr, LONGEST fieldval, int bitpos, int bitsize);
|
||||||
extern void type_print (struct type * type, char *varstring,
|
extern void type_print (struct type * type, char *varstring,
|
||||||
struct ui_file * stream, int show);
|
struct ui_file * stream, int show);
|
||||||
|
|
||||||
extern char *baseclass_addr (struct type *type, int index,
|
extern char *baseclass_addr (struct type *type, int index, char *valaddr,
|
||||||
char *valaddr, value_ptr * valuep, int *errp);
|
struct value **valuep, int *errp);
|
||||||
|
|
||||||
extern void print_longest (struct ui_file * stream, int format,
|
extern void print_longest (struct ui_file * stream, int format,
|
||||||
int use_local, LONGEST val);
|
int use_local, LONGEST val);
|
||||||
|
@ -504,15 +511,14 @@ extern void print_longest (struct ui_file * stream, int format,
|
||||||
extern void print_floating (char *valaddr, struct type * type,
|
extern void print_floating (char *valaddr, struct type * type,
|
||||||
struct ui_file * stream);
|
struct ui_file * stream);
|
||||||
|
|
||||||
extern int value_print (value_ptr val, struct ui_file *stream, int format,
|
extern int value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
enum val_prettyprint pretty);
|
enum val_prettyprint pretty);
|
||||||
|
|
||||||
extern void value_print_array_elements (value_ptr val,
|
extern void value_print_array_elements (struct value *val,
|
||||||
struct ui_file *stream,
|
struct ui_file *stream, int format,
|
||||||
int format,
|
|
||||||
enum val_prettyprint pretty);
|
enum val_prettyprint pretty);
|
||||||
|
|
||||||
extern value_ptr value_release_to_mark (value_ptr mark);
|
extern struct value *value_release_to_mark (struct value *mark);
|
||||||
|
|
||||||
extern int val_print (struct type * type, char *valaddr,
|
extern int val_print (struct type * type, char *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
|
@ -526,7 +532,7 @@ extern void print_variable_value (struct symbol * var,
|
||||||
struct frame_info * frame,
|
struct frame_info * frame,
|
||||||
struct ui_file *stream);
|
struct ui_file *stream);
|
||||||
|
|
||||||
extern int check_field (value_ptr, const char *);
|
extern int check_field (struct value *, const char *);
|
||||||
|
|
||||||
extern void typedef_print (struct type * type, struct symbol * news,
|
extern void typedef_print (struct type * type, struct symbol * news,
|
||||||
struct ui_file * stream);
|
struct ui_file * stream);
|
||||||
|
@ -539,34 +545,35 @@ extern void clear_internalvars (void);
|
||||||
|
|
||||||
/* From values.c */
|
/* From values.c */
|
||||||
|
|
||||||
extern value_ptr value_copy (value_ptr);
|
extern struct value *value_copy (struct value *);
|
||||||
|
|
||||||
extern int baseclass_offset (struct type *, int, char *, CORE_ADDR);
|
extern int baseclass_offset (struct type *, int, char *, CORE_ADDR);
|
||||||
|
|
||||||
/* From valops.c */
|
/* From valops.c */
|
||||||
|
|
||||||
extern value_ptr varying_to_slice (value_ptr);
|
extern struct value *varying_to_slice (struct value *);
|
||||||
|
|
||||||
extern value_ptr value_slice (value_ptr, int, int);
|
extern struct value *value_slice (struct value *, int, int);
|
||||||
|
|
||||||
extern value_ptr call_function_by_hand (value_ptr, int, value_ptr *);
|
extern struct value *call_function_by_hand (struct value *, int,
|
||||||
|
struct value **);
|
||||||
|
|
||||||
extern int default_coerce_float_to_double (struct type *, struct type *);
|
extern int default_coerce_float_to_double (struct type *, struct type *);
|
||||||
|
|
||||||
extern int standard_coerce_float_to_double (struct type *, struct type *);
|
extern int standard_coerce_float_to_double (struct type *, struct type *);
|
||||||
|
|
||||||
extern value_ptr value_literal_complex (value_ptr, value_ptr, struct type *);
|
extern struct value *value_literal_complex (struct value *, struct value *,
|
||||||
|
struct type *);
|
||||||
|
|
||||||
extern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
|
extern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
|
||||||
int *, int *);
|
int *, int *);
|
||||||
|
|
||||||
extern value_ptr find_function_in_inferior (char *);
|
extern struct value *find_function_in_inferior (char *);
|
||||||
|
|
||||||
extern value_ptr value_allocate_space_in_inferior (int);
|
extern struct value *value_allocate_space_in_inferior (int);
|
||||||
|
|
||||||
extern CORE_ADDR default_push_arguments (int nargs, value_ptr * args,
|
extern CORE_ADDR default_push_arguments (int nargs, struct value ** args,
|
||||||
CORE_ADDR sp,
|
CORE_ADDR sp, int struct_return,
|
||||||
int struct_return,
|
|
||||||
CORE_ADDR struct_addr);
|
CORE_ADDR struct_addr);
|
||||||
|
|
||||||
#endif /* !defined (VALUE_H) */
|
#endif /* !defined (VALUE_H) */
|
||||||
|
|
136
gdb/values.c
136
gdb/values.c
|
@ -1,6 +1,6 @@
|
||||||
/* Low level packing and unpacking of values for GDB, the GNU Debugger.
|
/* Low level packing and unpacking of values for GDB, the GNU Debugger.
|
||||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
1996, 1997, 1998, 1999, 2000
|
1995, 1996, 1997, 1998, 1999, 2000, 2002.
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -41,7 +41,7 @@ void _initialize_values (void);
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
|
||||||
static value_ptr value_headof (value_ptr, struct type *, struct type *);
|
static struct value *value_headof (struct value *, struct type *, struct type *);
|
||||||
|
|
||||||
static void show_values (char *, int);
|
static void show_values (char *, int);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ static void show_convenience (char *, int);
|
||||||
struct value_history_chunk
|
struct value_history_chunk
|
||||||
{
|
{
|
||||||
struct value_history_chunk *next;
|
struct value_history_chunk *next;
|
||||||
value_ptr values[VALUE_HISTORY_CHUNK];
|
struct value *values[VALUE_HISTORY_CHUNK];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Chain of chunks now in use. */
|
/* Chain of chunks now in use. */
|
||||||
|
@ -72,14 +72,14 @@ static int value_history_count; /* Abs number of last entry stored */
|
||||||
(except for those released by calls to release_value)
|
(except for those released by calls to release_value)
|
||||||
This is so they can be freed after each command. */
|
This is so they can be freed after each command. */
|
||||||
|
|
||||||
static value_ptr all_values;
|
static struct value *all_values;
|
||||||
|
|
||||||
/* Allocate a value that has the correct length for type TYPE. */
|
/* Allocate a value that has the correct length for type TYPE. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
allocate_value (struct type *type)
|
allocate_value (struct type *type)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
struct type *atype = check_typedef (type);
|
struct type *atype = check_typedef (type);
|
||||||
|
|
||||||
val = (struct value *) xmalloc (sizeof (struct value) + TYPE_LENGTH (atype));
|
val = (struct value *) xmalloc (sizeof (struct value) + TYPE_LENGTH (atype));
|
||||||
|
@ -106,7 +106,7 @@ allocate_value (struct type *type)
|
||||||
/* Allocate a value that has the correct length
|
/* Allocate a value that has the correct length
|
||||||
for COUNT repetitions type TYPE. */
|
for COUNT repetitions type TYPE. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
allocate_repeat_value (struct type *type, int count)
|
allocate_repeat_value (struct type *type, int count)
|
||||||
{
|
{
|
||||||
int low_bound = current_language->string_lower_bound; /* ??? */
|
int low_bound = current_language->string_lower_bound; /* ??? */
|
||||||
|
@ -124,7 +124,7 @@ allocate_repeat_value (struct type *type, int count)
|
||||||
/* Return a mark in the value chain. All values allocated after the
|
/* Return a mark in the value chain. All values allocated after the
|
||||||
mark is obtained (except for those released) are subject to being freed
|
mark is obtained (except for those released) are subject to being freed
|
||||||
if a subsequent value_free_to_mark is passed the mark. */
|
if a subsequent value_free_to_mark is passed the mark. */
|
||||||
value_ptr
|
struct value *
|
||||||
value_mark (void)
|
value_mark (void)
|
||||||
{
|
{
|
||||||
return all_values;
|
return all_values;
|
||||||
|
@ -133,9 +133,10 @@ value_mark (void)
|
||||||
/* Free all values allocated since MARK was obtained by value_mark
|
/* Free all values allocated since MARK was obtained by value_mark
|
||||||
(except for those released). */
|
(except for those released). */
|
||||||
void
|
void
|
||||||
value_free_to_mark (value_ptr mark)
|
value_free_to_mark (struct value *mark)
|
||||||
{
|
{
|
||||||
value_ptr val, next;
|
struct value *val;
|
||||||
|
struct value *next;
|
||||||
|
|
||||||
for (val = all_values; val && val != mark; val = next)
|
for (val = all_values; val && val != mark; val = next)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +152,8 @@ value_free_to_mark (value_ptr mark)
|
||||||
void
|
void
|
||||||
free_all_values (void)
|
free_all_values (void)
|
||||||
{
|
{
|
||||||
register value_ptr val, next;
|
struct value *val;
|
||||||
|
struct value *next;
|
||||||
|
|
||||||
for (val = all_values; val; val = next)
|
for (val = all_values; val; val = next)
|
||||||
{
|
{
|
||||||
|
@ -166,9 +168,9 @@ free_all_values (void)
|
||||||
so it will not be freed automatically. */
|
so it will not be freed automatically. */
|
||||||
|
|
||||||
void
|
void
|
||||||
release_value (register value_ptr val)
|
release_value (struct value *val)
|
||||||
{
|
{
|
||||||
register value_ptr v;
|
struct value *v;
|
||||||
|
|
||||||
if (all_values == val)
|
if (all_values == val)
|
||||||
{
|
{
|
||||||
|
@ -187,10 +189,11 @@ release_value (register value_ptr val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release all values up to mark */
|
/* Release all values up to mark */
|
||||||
value_ptr
|
struct value *
|
||||||
value_release_to_mark (value_ptr mark)
|
value_release_to_mark (struct value *mark)
|
||||||
{
|
{
|
||||||
value_ptr val, next;
|
struct value *val;
|
||||||
|
struct value *next;
|
||||||
|
|
||||||
for (val = next = all_values; next; next = VALUE_NEXT (next))
|
for (val = next = all_values; next; next = VALUE_NEXT (next))
|
||||||
if (VALUE_NEXT (next) == mark)
|
if (VALUE_NEXT (next) == mark)
|
||||||
|
@ -207,11 +210,11 @@ value_release_to_mark (value_ptr mark)
|
||||||
It contains the same contents, for same memory address,
|
It contains the same contents, for same memory address,
|
||||||
but it's a different block of storage. */
|
but it's a different block of storage. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_copy (value_ptr arg)
|
value_copy (struct value *arg)
|
||||||
{
|
{
|
||||||
register struct type *encl_type = VALUE_ENCLOSING_TYPE (arg);
|
register struct type *encl_type = VALUE_ENCLOSING_TYPE (arg);
|
||||||
register value_ptr val = allocate_value (encl_type);
|
struct value *val = allocate_value (encl_type);
|
||||||
VALUE_TYPE (val) = VALUE_TYPE (arg);
|
VALUE_TYPE (val) = VALUE_TYPE (arg);
|
||||||
VALUE_LVAL (val) = VALUE_LVAL (arg);
|
VALUE_LVAL (val) = VALUE_LVAL (arg);
|
||||||
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg);
|
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg);
|
||||||
|
@ -243,7 +246,7 @@ value_copy (value_ptr arg)
|
||||||
value history index of this new item. */
|
value history index of this new item. */
|
||||||
|
|
||||||
int
|
int
|
||||||
record_latest_value (value_ptr val)
|
record_latest_value (struct value *val)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -265,7 +268,7 @@ record_latest_value (value_ptr val)
|
||||||
i = value_history_count % VALUE_HISTORY_CHUNK;
|
i = value_history_count % VALUE_HISTORY_CHUNK;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
register struct value_history_chunk *new
|
struct value_history_chunk *new
|
||||||
= (struct value_history_chunk *)
|
= (struct value_history_chunk *)
|
||||||
xmalloc (sizeof (struct value_history_chunk));
|
xmalloc (sizeof (struct value_history_chunk));
|
||||||
memset (new->values, 0, sizeof new->values);
|
memset (new->values, 0, sizeof new->values);
|
||||||
|
@ -283,10 +286,10 @@ record_latest_value (value_ptr val)
|
||||||
|
|
||||||
/* Return a copy of the value in the history with sequence number NUM. */
|
/* Return a copy of the value in the history with sequence number NUM. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
access_value_history (int num)
|
access_value_history (int num)
|
||||||
{
|
{
|
||||||
register struct value_history_chunk *chunk;
|
struct value_history_chunk *chunk;
|
||||||
register int i;
|
register int i;
|
||||||
register int absnum = num;
|
register int absnum = num;
|
||||||
|
|
||||||
|
@ -324,9 +327,9 @@ access_value_history (int num)
|
||||||
void
|
void
|
||||||
clear_value_history (void)
|
clear_value_history (void)
|
||||||
{
|
{
|
||||||
register struct value_history_chunk *next;
|
struct value_history_chunk *next;
|
||||||
register int i;
|
register int i;
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
|
|
||||||
while (value_history_chain)
|
while (value_history_chain)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +347,7 @@ static void
|
||||||
show_values (char *num_exp, int from_tty)
|
show_values (char *num_exp, int from_tty)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
static int num = 1;
|
static int num = 1;
|
||||||
|
|
||||||
if (num_exp)
|
if (num_exp)
|
||||||
|
@ -415,10 +418,10 @@ lookup_internalvar (char *name)
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_of_internalvar (struct internalvar *var)
|
value_of_internalvar (struct internalvar *var)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
|
|
||||||
#ifdef IS_TRAPPED_INTERNALVAR
|
#ifdef IS_TRAPPED_INTERNALVAR
|
||||||
if (IS_TRAPPED_INTERNALVAR (var->name))
|
if (IS_TRAPPED_INTERNALVAR (var->name))
|
||||||
|
@ -435,7 +438,7 @@ value_of_internalvar (struct internalvar *var)
|
||||||
|
|
||||||
void
|
void
|
||||||
set_internalvar_component (struct internalvar *var, int offset, int bitpos,
|
set_internalvar_component (struct internalvar *var, int offset, int bitpos,
|
||||||
int bitsize, value_ptr newval)
|
int bitsize, struct value *newval)
|
||||||
{
|
{
|
||||||
register char *addr = VALUE_CONTENTS (var->value) + offset;
|
register char *addr = VALUE_CONTENTS (var->value) + offset;
|
||||||
|
|
||||||
|
@ -452,9 +455,9 @@ set_internalvar_component (struct internalvar *var, int offset, int bitpos,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_internalvar (struct internalvar *var, value_ptr val)
|
set_internalvar (struct internalvar *var, struct value *val)
|
||||||
{
|
{
|
||||||
value_ptr newval;
|
struct value *newval;
|
||||||
|
|
||||||
#ifdef IS_TRAPPED_INTERNALVAR
|
#ifdef IS_TRAPPED_INTERNALVAR
|
||||||
if (IS_TRAPPED_INTERNALVAR (var->name))
|
if (IS_TRAPPED_INTERNALVAR (var->name))
|
||||||
|
@ -538,7 +541,7 @@ use \"set\" as in \"set $foo = 5\" to define them.\n");
|
||||||
Does not deallocate the value. */
|
Does not deallocate the value. */
|
||||||
|
|
||||||
LONGEST
|
LONGEST
|
||||||
value_as_long (register value_ptr val)
|
value_as_long (struct value *val)
|
||||||
{
|
{
|
||||||
/* This coerces arrays and functions, which is necessary (e.g.
|
/* This coerces arrays and functions, which is necessary (e.g.
|
||||||
in disassemble_command). It also dereferences references, which
|
in disassemble_command). It also dereferences references, which
|
||||||
|
@ -548,7 +551,7 @@ value_as_long (register value_ptr val)
|
||||||
}
|
}
|
||||||
|
|
||||||
DOUBLEST
|
DOUBLEST
|
||||||
value_as_double (register value_ptr val)
|
value_as_double (struct value *val)
|
||||||
{
|
{
|
||||||
DOUBLEST foo;
|
DOUBLEST foo;
|
||||||
int inv;
|
int inv;
|
||||||
|
@ -562,7 +565,7 @@ value_as_double (register value_ptr val)
|
||||||
Note that val's type may not actually be a pointer; value_as_long
|
Note that val's type may not actually be a pointer; value_as_long
|
||||||
handles all the cases. */
|
handles all the cases. */
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
value_as_address (value_ptr val)
|
value_as_address (struct value *val)
|
||||||
{
|
{
|
||||||
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
|
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
|
||||||
whether we want this to be true eventually. */
|
whether we want this to be true eventually. */
|
||||||
|
@ -784,7 +787,7 @@ unpack_pointer (struct type *type, char *valaddr)
|
||||||
|
|
||||||
/* Get the value of the FIELDN'th field (which must be static) of TYPE. */
|
/* Get the value of the FIELDN'th field (which must be static) of TYPE. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_static_field (struct type *type, int fieldno)
|
value_static_field (struct type *type, int fieldno)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
@ -836,8 +839,8 @@ value_static_field (struct type *type, int fieldno)
|
||||||
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 data.
|
||||||
The return value is a pointer to the new version of this value structure. */
|
The return value is a pointer to the new version of this value structure. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_change_enclosing_type (value_ptr val, struct type *new_encl_type)
|
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)))
|
||||||
{
|
{
|
||||||
|
@ -846,10 +849,10 @@ value_change_enclosing_type (value_ptr val, struct type *new_encl_type)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value_ptr new_val;
|
struct value *new_val;
|
||||||
register value_ptr prev;
|
struct value *prev;
|
||||||
|
|
||||||
new_val = (value_ptr) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type));
|
new_val = (struct value *) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type));
|
||||||
|
|
||||||
/* We have to make sure this ends up in the same place in the value
|
/* 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.
|
chain as the original copy, so it's clean-up behavior is the same.
|
||||||
|
@ -877,11 +880,11 @@ value_change_enclosing_type (value_ptr val, struct type *new_encl_type)
|
||||||
extract and return the value of one of its (non-static) fields.
|
extract and return the value of one of its (non-static) fields.
|
||||||
FIELDNO says which field. */
|
FIELDNO says which field. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_primitive_field (register value_ptr arg1, int offset,
|
value_primitive_field (struct value *arg1, int offset,
|
||||||
register int fieldno, register struct type *arg_type)
|
register int fieldno, register struct type *arg_type)
|
||||||
{
|
{
|
||||||
register value_ptr v;
|
struct value *v;
|
||||||
register struct type *type;
|
register struct type *type;
|
||||||
|
|
||||||
CHECK_TYPEDEF (arg_type);
|
CHECK_TYPEDEF (arg_type);
|
||||||
|
@ -947,8 +950,8 @@ value_primitive_field (register value_ptr arg1, int offset,
|
||||||
extract and return the value of one of its (non-static) fields.
|
extract and return the value of one of its (non-static) fields.
|
||||||
FIELDNO says which field. */
|
FIELDNO says which field. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_field (register value_ptr arg1, register int fieldno)
|
value_field (struct value *arg1, register int fieldno)
|
||||||
{
|
{
|
||||||
return value_primitive_field (arg1, 0, fieldno, VALUE_TYPE (arg1));
|
return value_primitive_field (arg1, 0, fieldno, VALUE_TYPE (arg1));
|
||||||
}
|
}
|
||||||
|
@ -961,11 +964,11 @@ value_field (register value_ptr arg1, register int fieldno)
|
||||||
full symbol or a minimal symbol.
|
full symbol or a minimal symbol.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_fn_field (value_ptr *arg1p, struct fn_field *f, int j, struct type *type,
|
value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *type,
|
||||||
int offset)
|
int offset)
|
||||||
{
|
{
|
||||||
register value_ptr v;
|
struct value *v;
|
||||||
register struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
|
register struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
|
||||||
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
|
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
@ -1022,11 +1025,12 @@ value_fn_field (value_ptr *arg1p, struct fn_field *f, int j, struct type *type,
|
||||||
by value_rtti_type efficiently.
|
by value_rtti_type efficiently.
|
||||||
Consider it gone for 5.1. */
|
Consider it gone for 5.1. */
|
||||||
|
|
||||||
static value_ptr
|
static struct value *
|
||||||
value_headof (value_ptr in_arg, struct type *btype, struct type *dtype)
|
value_headof (struct value *in_arg, struct type *btype, struct type *dtype)
|
||||||
{
|
{
|
||||||
/* First collect the vtables we must look at for this object. */
|
/* First collect the vtables we must look at for this object. */
|
||||||
value_ptr arg, vtbl;
|
struct value *arg;
|
||||||
|
struct value *vtbl;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
char *demangled_name;
|
char *demangled_name;
|
||||||
struct minimal_symbol *msymbol;
|
struct minimal_symbol *msymbol;
|
||||||
|
@ -1083,8 +1087,8 @@ value_headof (value_ptr in_arg, struct type *btype, struct type *dtype)
|
||||||
of its baseclasses) to figure out the most derived type that ARG
|
of its baseclasses) to figure out the most derived type that ARG
|
||||||
could actually be a pointer to. */
|
could actually be a pointer to. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_from_vtable_info (value_ptr arg, struct type *type)
|
value_from_vtable_info (struct value *arg, struct type *type)
|
||||||
{
|
{
|
||||||
/* Take care of preliminaries. */
|
/* Take care of preliminaries. */
|
||||||
if (TYPE_VPTR_FIELDNO (type) < 0)
|
if (TYPE_VPTR_FIELDNO (type) < 0)
|
||||||
|
@ -1290,10 +1294,10 @@ modify_field (char *addr, LONGEST fieldval, int bitpos, int bitsize)
|
||||||
|
|
||||||
/* Convert C numbers into newly allocated values */
|
/* Convert C numbers into newly allocated values */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_from_longest (struct type *type, register LONGEST num)
|
value_from_longest (struct type *type, register LONGEST num)
|
||||||
{
|
{
|
||||||
register value_ptr val = allocate_value (type);
|
struct value *val = allocate_value (type);
|
||||||
register enum type_code code;
|
register enum type_code code;
|
||||||
register int len;
|
register int len;
|
||||||
retry:
|
retry:
|
||||||
|
@ -1327,10 +1331,10 @@ retry:
|
||||||
|
|
||||||
/* Create a value representing a pointer of type TYPE to the address
|
/* Create a value representing a pointer of type TYPE to the address
|
||||||
ADDR. */
|
ADDR. */
|
||||||
value_ptr
|
struct value *
|
||||||
value_from_pointer (struct type *type, CORE_ADDR addr)
|
value_from_pointer (struct type *type, CORE_ADDR addr)
|
||||||
{
|
{
|
||||||
value_ptr val = allocate_value (type);
|
struct value *val = allocate_value (type);
|
||||||
store_typed_address (VALUE_CONTENTS_RAW (val), type, addr);
|
store_typed_address (VALUE_CONTENTS_RAW (val), type, addr);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -1341,10 +1345,10 @@ value_from_pointer (struct type *type, CORE_ADDR addr)
|
||||||
This is analogous to value_from_longest, which also does not
|
This is analogous to value_from_longest, which also does not
|
||||||
use inferior memory. String shall NOT contain embedded nulls. */
|
use inferior memory. String shall NOT contain embedded nulls. */
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_from_string (char *ptr)
|
value_from_string (char *ptr)
|
||||||
{
|
{
|
||||||
value_ptr val;
|
struct value *val;
|
||||||
int len = strlen (ptr);
|
int len = strlen (ptr);
|
||||||
int lowbound = current_language->string_lower_bound;
|
int lowbound = current_language->string_lower_bound;
|
||||||
struct type *rangetype =
|
struct type *rangetype =
|
||||||
|
@ -1361,10 +1365,10 @@ value_from_string (char *ptr)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ptr
|
struct value *
|
||||||
value_from_double (struct type *type, DOUBLEST num)
|
value_from_double (struct type *type, DOUBLEST num)
|
||||||
{
|
{
|
||||||
register value_ptr val = allocate_value (type);
|
struct value *val = allocate_value (type);
|
||||||
struct type *base_type = check_typedef (type);
|
struct type *base_type = check_typedef (type);
|
||||||
register enum type_code code = TYPE_CODE (base_type);
|
register enum type_code code = TYPE_CODE (base_type);
|
||||||
register int len = TYPE_LENGTH (base_type);
|
register int len = TYPE_LENGTH (base_type);
|
||||||
|
@ -1394,10 +1398,10 @@ value_from_double (struct type *type, DOUBLEST num)
|
||||||
means returning pointer to where structure is vs. returning value). */
|
means returning pointer to where structure is vs. returning value). */
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
value_ptr
|
struct value *
|
||||||
value_being_returned (struct type *valtype, char *retbuf, int struct_return)
|
value_being_returned (struct type *valtype, char *retbuf, int struct_return)
|
||||||
{
|
{
|
||||||
register value_ptr val;
|
struct value *val;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
|
||||||
/* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
|
/* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
|
||||||
|
@ -1451,7 +1455,7 @@ generic_use_struct_convention (int gcc_p, struct type *value_type)
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
using_struct_return (value_ptr function, CORE_ADDR funcaddr,
|
using_struct_return (struct value *function, CORE_ADDR funcaddr,
|
||||||
struct type *value_type, int gcc_p)
|
struct type *value_type, int gcc_p)
|
||||||
{
|
{
|
||||||
register enum type_code code = TYPE_CODE (value_type);
|
register enum type_code code = TYPE_CODE (value_type);
|
||||||
|
@ -1473,7 +1477,7 @@ using_struct_return (value_ptr function, CORE_ADDR funcaddr,
|
||||||
function wants to return. */
|
function wants to return. */
|
||||||
|
|
||||||
void
|
void
|
||||||
set_return_value (value_ptr val)
|
set_return_value (struct value *val)
|
||||||
{
|
{
|
||||||
struct type *type = check_typedef (VALUE_TYPE (val));
|
struct type *type = check_typedef (VALUE_TYPE (val));
|
||||||
register enum type_code code = TYPE_CODE (type);
|
register enum type_code code = TYPE_CODE (type);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue