2005-02-01 Andrew Cagney <cagney@gnu.org>

* value.c (value_contents_all_raw)
	(value_contents_raw): New functions.
	* value.h (VALUE_CONTENTS_ALL_RAW, VALUE_CONTENTS_RAW): Delete.
	(value_contents_raw, value_contents_all_raw): Declare functions.
	(VALUE_CONTENTS, VALUE_CONTENTS_ALL): Update.
	* std-regs.c, valarith.c, valops.c, eval.c: Update.
	* tracepoint.c, findvar.c: Update.
This commit is contained in:
Andrew Cagney 2005-02-02 00:20:07 +00:00
parent f08562818b
commit 990a07abf6
13 changed files with 102 additions and 77 deletions

View file

@ -1,3 +1,13 @@
2005-02-01 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents_all_raw)
(value_contents_raw): New functions.
* value.h (VALUE_CONTENTS_ALL_RAW, VALUE_CONTENTS_RAW): Delete.
(value_contents_raw, value_contents_all_raw): Declare functions.
(VALUE_CONTENTS, VALUE_CONTENTS_ALL): Update.
* std-regs.c, valarith.c, valops.c, eval.c: Update.
* tracepoint.c, findvar.c: Update.
2005-02-01 Orjan Friberg <orjanf@axis.com> 2005-02-01 Orjan Friberg <orjanf@axis.com>
* regformats/reg-cris.dat: New file with register definitions for CRIS. * regformats/reg-cris.dat: New file with register definitions for CRIS.

View file

@ -422,7 +422,7 @@ value_from_contents_and_address (struct type *type,
if (valaddr == NULL) if (valaddr == NULL)
VALUE_LAZY (v) = 1; VALUE_LAZY (v) = 1;
else else
memcpy (VALUE_CONTENTS_RAW (v), valaddr, TYPE_LENGTH (type)); memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type));
VALUE_ADDRESS (v) = address; VALUE_ADDRESS (v) = address;
if (address != 0) if (address != 0)
VALUE_LVAL (v) = lval_memory; VALUE_LVAL (v) = lval_memory;
@ -455,7 +455,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
VALUE_LAZY (result) = 1; VALUE_LAZY (result) = 1;
else else
memcpy (VALUE_CONTENTS_RAW (result), VALUE_CONTENTS (val), memcpy (value_contents_raw (result), VALUE_CONTENTS (val),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
return result; return result;
} }
@ -2038,7 +2038,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
len); len);
val = value_copy (toval); val = value_copy (toval);
memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval), memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
val->type = type; val->type = type;
@ -3503,7 +3503,7 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
*sp = gdbarch_frame_align (current_gdbarch, *sp); *sp = gdbarch_frame_align (current_gdbarch, *sp);
} }
write_memory (VALUE_ADDRESS (val), VALUE_CONTENTS_RAW (val), len); write_memory (VALUE_ADDRESS (val), value_contents_raw (val), len);
} }
return val; return val;
@ -3542,7 +3542,7 @@ convert_actual (struct value *actual, struct type *formal_type0,
struct value *val; struct value *val;
actual_type = ada_check_typedef (value_type (actual)); actual_type = ada_check_typedef (value_type (actual));
val = allocate_value (actual_type); val = allocate_value (actual_type);
memcpy ((char *) VALUE_CONTENTS_RAW (val), memcpy ((char *) value_contents_raw (val),
(char *) VALUE_CONTENTS (actual), (char *) VALUE_CONTENTS (actual),
TYPE_LENGTH (actual_type)); TYPE_LENGTH (actual_type));
actual = ensure_lval (val, sp); actual = ensure_lval (val, sp);
@ -7103,7 +7103,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
} }
val = allocate_value (type1); val = allocate_value (type1);
store_unsigned_integer (VALUE_CONTENTS_RAW (val), store_unsigned_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)), v); TYPE_LENGTH (value_type (val)), v);
return val; return val;
} }

View file

@ -1,8 +1,8 @@
/* Evaluate expressions for GDB. /* Evaluate expressions for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free
Foundation, Inc. Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -360,7 +360,7 @@ init_array_element (struct value *array, struct value *element,
error ("tuple range index out of range"); error ("tuple range index out of range");
for (index = low; index <= high; index++) for (index = low; index <= high; index++)
{ {
memcpy (VALUE_CONTENTS_RAW (array) memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size, + (index - low_bound) * element_size,
VALUE_CONTENTS (element), element_size); VALUE_CONTENTS (element), element_size);
} }
@ -370,7 +370,7 @@ init_array_element (struct value *array, struct value *element,
index = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); index = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
if (index < low_bound || index > high_bound) if (index < low_bound || index > high_bound)
error ("tuple index out of range"); error ("tuple index out of range");
memcpy (VALUE_CONTENTS_RAW (array) + (index - low_bound) * element_size, memcpy (value_contents_raw (array) + (index - low_bound) * element_size,
VALUE_CONTENTS (element), element_size); VALUE_CONTENTS (element), element_size);
} }
return index; return index;
@ -500,7 +500,7 @@ evaluate_subexp_standard (struct type *expect_type,
&& TYPE_CODE (type) == TYPE_CODE_STRUCT) && TYPE_CODE (type) == TYPE_CODE_STRUCT)
{ {
struct value *rec = allocate_value (expect_type); struct value *rec = allocate_value (expect_type);
memset (VALUE_CONTENTS_RAW (rec), '\0', TYPE_LENGTH (type)); memset (value_contents_raw (rec), '\0', TYPE_LENGTH (type));
return evaluate_struct_tuple (rec, exp, pos, noside, nargs); return evaluate_struct_tuple (rec, exp, pos, noside, nargs);
} }
@ -518,7 +518,7 @@ evaluate_subexp_standard (struct type *expect_type,
high_bound = (TYPE_LENGTH (type) / element_size) - 1; high_bound = (TYPE_LENGTH (type) / element_size) - 1;
} }
index = low_bound; index = low_bound;
memset (VALUE_CONTENTS_RAW (array), 0, TYPE_LENGTH (expect_type)); memset (value_contents_raw (array), 0, TYPE_LENGTH (expect_type));
for (tem = nargs; --nargs >= 0;) for (tem = nargs; --nargs >= 0;)
{ {
struct value *element; struct value *element;
@ -544,7 +544,7 @@ evaluate_subexp_standard (struct type *expect_type,
if (index > high_bound) if (index > high_bound)
/* to avoid memory corruption */ /* to avoid memory corruption */
error ("Too many array elements"); error ("Too many array elements");
memcpy (VALUE_CONTENTS_RAW (array) memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size, + (index - low_bound) * element_size,
VALUE_CONTENTS (element), VALUE_CONTENTS (element),
element_size); element_size);
@ -558,7 +558,7 @@ evaluate_subexp_standard (struct type *expect_type,
&& TYPE_CODE (type) == TYPE_CODE_SET) && TYPE_CODE (type) == TYPE_CODE_SET)
{ {
struct value *set = allocate_value (expect_type); struct value *set = allocate_value (expect_type);
char *valaddr = VALUE_CONTENTS_RAW (set); char *valaddr = value_contents_raw (set);
struct type *element_type = TYPE_INDEX_TYPE (type); struct type *element_type = TYPE_INDEX_TYPE (type);
struct type *check_type = element_type; struct type *check_type = element_type;
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;

View file

@ -1,8 +1,8 @@
/* Find a variable's value in memory, for GDB, the GNU debugger. /* Find a variable's value in memory, for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
Foundation, Inc. Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -282,7 +282,7 @@ value_of_register (int regnum, struct frame_info *frame)
reg_val = allocate_value (register_type (current_gdbarch, regnum)); reg_val = allocate_value (register_type (current_gdbarch, regnum));
memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer, memcpy (value_contents_raw (reg_val), raw_buffer,
register_size (current_gdbarch, regnum)); register_size (current_gdbarch, regnum));
VALUE_LVAL (reg_val) = lval; VALUE_LVAL (reg_val) = lval;
VALUE_ADDRESS (reg_val) = addr; VALUE_ADDRESS (reg_val) = addr;
@ -400,7 +400,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
{ {
case LOC_CONST: case LOC_CONST:
/* Put the constant back in target format. */ /* Put the constant back in target format. */
store_signed_integer (VALUE_CONTENTS_RAW (v), len, store_signed_integer (value_contents_raw (v), len,
(LONGEST) SYMBOL_VALUE (var)); (LONGEST) SYMBOL_VALUE (var));
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;
@ -412,10 +412,10 @@ read_var_value (struct symbol *var, struct frame_info *frame)
CORE_ADDR addr CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_BFD_SECTION (var)); SYMBOL_BFD_SECTION (var));
store_typed_address (VALUE_CONTENTS_RAW (v), type, addr); store_typed_address (value_contents_raw (v), type, addr);
} }
else else
store_typed_address (VALUE_CONTENTS_RAW (v), type, store_typed_address (value_contents_raw (v), type,
SYMBOL_VALUE_ADDRESS (var)); SYMBOL_VALUE_ADDRESS (var));
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;
@ -424,7 +424,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
{ {
char *bytes_addr; char *bytes_addr;
bytes_addr = SYMBOL_VALUE_BYTES (var); bytes_addr = SYMBOL_VALUE_BYTES (var);
memcpy (VALUE_CONTENTS_RAW (v), bytes_addr, len); memcpy (value_contents_raw (v), bytes_addr, len);
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;
} }
@ -634,7 +634,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
the corresponding [integer] type (see Alpha). The assumption the corresponding [integer] type (see Alpha). The assumption
is that REGISTER_TO_VALUE populates the entire value is that REGISTER_TO_VALUE populates the entire value
including the location. */ including the location. */
REGISTER_TO_VALUE (frame, regnum, type, VALUE_CONTENTS_RAW (v)); REGISTER_TO_VALUE (frame, regnum, type, value_contents_raw (v));
VALUE_LVAL (v) = lval_register; VALUE_LVAL (v) = lval_register;
VALUE_FRAME_ID (v) = get_frame_id (frame); VALUE_FRAME_ID (v) = get_frame_id (frame);
VALUE_REGNUM (v) = regnum; VALUE_REGNUM (v) = regnum;
@ -713,7 +713,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
v->offset = register_size (current_gdbarch, regnum) - len; v->offset = register_size (current_gdbarch, regnum) - len;
else else
v->offset = 0; v->offset = 0;
memcpy (VALUE_CONTENTS_RAW (v), value_bytes + value_offset (v), len); memcpy (value_contents_raw (v), value_bytes + value_offset (v), len);
} }
return v; return v;
} }

View file

@ -1,7 +1,7 @@
/* Perform an inferior function call, for GDB, the GNU debugger. /* Perform an inferior function call, for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -861,7 +861,7 @@ the function call).", name);
NULL, NULL, NULL) NULL, NULL, NULL)
== RETURN_VALUE_REGISTER_CONVENTION); == RETURN_VALUE_REGISTER_CONVENTION);
gdbarch_return_value (current_gdbarch, values_type, retbuf, gdbarch_return_value (current_gdbarch, values_type, retbuf,
VALUE_CONTENTS_RAW (retval) /*read*/, value_contents_raw (retval) /*read*/,
NULL /*write*/); NULL /*write*/);
} }
do_cleanups (retbuf_cleanup); do_cleanups (retbuf_cleanup);

View file

@ -1,6 +1,7 @@
/* Memory-access and commands for "inferior" process, for GDB. /* Memory-access and commands for "inferior" process, for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1098,7 +1099,7 @@ print_return_value (int struct_return, struct type *value_type)
value = allocate_value (value_type); value = allocate_value (value_type);
CHECK_TYPEDEF (value_type); CHECK_TYPEDEF (value_type);
gdbarch_return_value (current_gdbarch, value_type, stop_registers, gdbarch_return_value (current_gdbarch, value_type, stop_registers,
VALUE_CONTENTS_RAW (value), NULL); value_contents_raw (value), NULL);
break; break;
case RETURN_VALUE_STRUCT_CONVENTION: case RETURN_VALUE_STRUCT_CONVENTION:
value = NULL; value = NULL;

View file

@ -1,6 +1,6 @@
/* Builtin frame register, for GDB, the GNU debugger. /* Builtin frame register, for GDB, the GNU debugger.
Copyright 2002 Free Software Foundation, Inc. Copyright 2002, 2005 Free Software Foundation, Inc.
Contributed by Red Hat. Contributed by Red Hat.
@ -60,7 +60,7 @@ value_of_builtin_frame_reg (struct frame_info *frame)
build_builtin_type_frame_reg (); build_builtin_type_frame_reg ();
val = allocate_value (builtin_type_frame_reg); val = allocate_value (builtin_type_frame_reg);
VALUE_LVAL (val) = not_lval; VALUE_LVAL (val) = not_lval;
buf = VALUE_CONTENTS_RAW (val); buf = value_contents_raw (val);
memset (buf, TYPE_LENGTH (value_type (val)), 0); memset (buf, TYPE_LENGTH (value_type (val)), 0);
/* frame.base. */ /* frame.base. */
if (frame != NULL) if (frame != NULL)
@ -85,7 +85,7 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame)
else else
{ {
struct value *val = allocate_value (builtin_type_void_data_ptr); struct value *val = allocate_value (builtin_type_void_data_ptr);
char *buf = VALUE_CONTENTS_RAW (val); char *buf = value_contents_raw (val);
if (frame == NULL) if (frame == NULL)
memset (buf, TYPE_LENGTH (value_type (val)), 0); memset (buf, TYPE_LENGTH (value_type (val)), 0);
else else
@ -103,7 +103,7 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame)
else else
{ {
struct value *val = allocate_value (builtin_type_void_data_ptr); struct value *val = allocate_value (builtin_type_void_data_ptr);
char *buf = VALUE_CONTENTS_RAW (val); char *buf = value_contents_raw (val);
if (frame == NULL) if (frame == NULL)
memset (buf, TYPE_LENGTH (value_type (val)), 0); memset (buf, TYPE_LENGTH (value_type (val)), 0);
else else

View file

@ -1,7 +1,7 @@
/* Tracing functionality for remote targets in custom GDB protocol /* Tracing functionality for remote targets in custom GDB protocol
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Free Software Foundation, Inc. Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -297,7 +297,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
builtin_type_char, func_range); builtin_type_char, func_range);
func_val = allocate_value (func_string); func_val = allocate_value (func_string);
func_val->type = func_string; func_val->type = func_string;
memcpy (VALUE_CONTENTS_RAW (func_val), memcpy (value_contents_raw (func_val),
DEPRECATED_SYMBOL_NAME (traceframe_fun), DEPRECATED_SYMBOL_NAME (traceframe_fun),
len); len);
func_val->modifiable = 0; func_val->modifiable = 0;
@ -319,7 +319,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
builtin_type_char, file_range); builtin_type_char, file_range);
file_val = allocate_value (file_string); file_val = allocate_value (file_string);
file_val->type = file_string; file_val->type = file_string;
memcpy (VALUE_CONTENTS_RAW (file_val), memcpy (value_contents_raw (file_val),
traceframe_sal.symtab->filename, traceframe_sal.symtab->filename,
len); len);
file_val->modifiable = 0; file_val->modifiable = 0;

View file

@ -1,8 +1,8 @@
/* 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, Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Foundation, Inc. Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -806,7 +806,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
else else
val = allocate_value (builtin_type_double); val = allocate_value (builtin_type_double);
store_typed_floating (VALUE_CONTENTS_RAW (val), value_type (val), v); store_typed_floating (value_contents_raw (val), value_type (val), v);
} }
else if (TYPE_CODE (type1) == TYPE_CODE_BOOL else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
&& &&
@ -843,7 +843,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
} }
val = allocate_value (type1); val = allocate_value (type1);
store_signed_integer (VALUE_CONTENTS_RAW (val), store_signed_integer (value_contents_raw (val),
TYPE_LENGTH (type1), TYPE_LENGTH (type1),
v); v);
} }
@ -1015,7 +1015,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
(result_len > TARGET_LONG_BIT / HOST_CHAR_BIT (result_len > TARGET_LONG_BIT / HOST_CHAR_BIT
? builtin_type_unsigned_long_long ? builtin_type_unsigned_long_long
: builtin_type_unsigned_long); : builtin_type_unsigned_long);
store_unsigned_integer (VALUE_CONTENTS_RAW (val), store_unsigned_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)), TYPE_LENGTH (value_type (val)),
v); v);
} }
@ -1139,7 +1139,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
(result_len > TARGET_LONG_BIT / HOST_CHAR_BIT (result_len > TARGET_LONG_BIT / HOST_CHAR_BIT
? builtin_type_long_long ? builtin_type_long_long
: builtin_type_long); : builtin_type_long);
store_signed_integer (VALUE_CONTENTS_RAW (val), store_signed_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)), TYPE_LENGTH (value_type (val)),
v); v);
} }

View file

@ -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, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -457,7 +458,7 @@ value_at (struct type *type, CORE_ADDR addr)
val = allocate_value (type); val = allocate_value (type);
read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), TYPE_LENGTH (type)); read_memory (addr, value_contents_all_raw (val), TYPE_LENGTH (type));
VALUE_LVAL (val) = lval_memory; VALUE_LVAL (val) = lval_memory;
VALUE_ADDRESS (val) = addr; VALUE_ADDRESS (val) = addr;
@ -504,7 +505,7 @@ value_fetch_lazy (struct value *val)
struct type *type = value_type (val); struct type *type = value_type (val);
if (length) if (length)
read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length); read_memory (addr, value_contents_all_raw (val), length);
VALUE_LAZY (val) = 0; VALUE_LAZY (val) = 0;
return 0; return 0;
@ -728,7 +729,7 @@ value_assign (struct value *toval, struct value *fromval)
} }
val = value_copy (toval); val = value_copy (toval);
memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval), memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
val->type = type; val->type = type;
val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval)); val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval));
@ -753,7 +754,7 @@ value_repeat (struct value *arg1, int count)
val = allocate_repeat_value (VALUE_ENCLOSING_TYPE (arg1), count); val = allocate_repeat_value (VALUE_ENCLOSING_TYPE (arg1), count);
read_memory (VALUE_ADDRESS (arg1) + value_offset (arg1), read_memory (VALUE_ADDRESS (arg1) + value_offset (arg1),
VALUE_CONTENTS_ALL_RAW (val), value_contents_all_raw (val),
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val))); TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)));
VALUE_LVAL (val) = lval_memory; VALUE_LVAL (val) = lval_memory;
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1); VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1);
@ -1021,7 +1022,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
val = allocate_value (arraytype); val = allocate_value (arraytype);
for (idx = 0; idx < nelem; idx++) for (idx = 0; idx < nelem; idx++)
{ {
memcpy (VALUE_CONTENTS_ALL_RAW (val) + (idx * typelength), memcpy (value_contents_all_raw (val) + (idx * typelength),
VALUE_CONTENTS_ALL (elemvec[idx]), VALUE_CONTENTS_ALL (elemvec[idx]),
typelength); typelength);
} }
@ -1069,7 +1070,7 @@ value_string (char *ptr, int len)
if (current_language->c_style_arrays == 0) if (current_language->c_style_arrays == 0)
{ {
val = allocate_value (stringtype); val = allocate_value (stringtype);
memcpy (VALUE_CONTENTS_RAW (val), ptr, len); memcpy (value_contents_raw (val), ptr, len);
return val; return val;
} }
@ -1093,7 +1094,7 @@ value_bitstring (char *ptr, int len)
struct type *type = create_set_type ((struct type *) NULL, domain_type); struct type *type = create_set_type ((struct type *) NULL, domain_type);
TYPE_CODE (type) = TYPE_CODE_BITSTRING; TYPE_CODE (type) = TYPE_CODE_BITSTRING;
val = allocate_value (type); val = allocate_value (type);
memcpy (VALUE_CONTENTS_RAW (val), ptr, TYPE_LENGTH (type)); memcpy (value_contents_raw (val), ptr, TYPE_LENGTH (type));
return val; return val;
} }
@ -1297,7 +1298,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
CORE_ADDR base_addr; CORE_ADDR base_addr;
base_addr = VALUE_ADDRESS (arg1) + value_offset (arg1) + boffset; base_addr = VALUE_ADDRESS (arg1) + value_offset (arg1) + boffset;
if (target_read_memory (base_addr, VALUE_CONTENTS_RAW (v2), if (target_read_memory (base_addr, value_contents_raw (v2),
TYPE_LENGTH (basetype)) != 0) TYPE_LENGTH (basetype)) != 0)
error ("virtual baseclass botch"); error ("virtual baseclass botch");
VALUE_LVAL (v2) = lval_memory; VALUE_LVAL (v2) = lval_memory;
@ -1312,8 +1313,8 @@ search_struct_field (char *name, struct value *arg1, int offset,
if (VALUE_LAZY (arg1)) if (VALUE_LAZY (arg1))
VALUE_LAZY (v2) = 1; VALUE_LAZY (v2) = 1;
else else
memcpy (VALUE_CONTENTS_RAW (v2), memcpy (value_contents_raw (v2),
VALUE_CONTENTS_RAW (arg1) + boffset, value_contents_raw (arg1) + boffset,
TYPE_LENGTH (basetype)); TYPE_LENGTH (basetype));
} }
@ -2744,7 +2745,7 @@ value_slice (struct value *array, int lowbound, int length)
int j = i % TARGET_CHAR_BIT; int j = i % TARGET_CHAR_BIT;
if (BITS_BIG_ENDIAN) if (BITS_BIG_ENDIAN)
j = TARGET_CHAR_BIT - 1 - j; j = TARGET_CHAR_BIT - 1 - j;
VALUE_CONTENTS_RAW (slice)[i / TARGET_CHAR_BIT] |= (1 << j); value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
} }
} }
/* We should set the address, bitssize, and bitspos, so the clice /* We should set the address, bitssize, and bitspos, so the clice
@ -2792,9 +2793,9 @@ value_literal_complex (struct value *arg1, struct value *arg2, struct type *type
arg1 = value_cast (real_type, arg1); arg1 = value_cast (real_type, arg1);
arg2 = value_cast (real_type, arg2); arg2 = value_cast (real_type, arg2);
memcpy (VALUE_CONTENTS_RAW (val), memcpy (value_contents_raw (val),
VALUE_CONTENTS (arg1), TYPE_LENGTH (real_type)); VALUE_CONTENTS (arg1), TYPE_LENGTH (real_type));
memcpy (VALUE_CONTENTS_RAW (val) + TYPE_LENGTH (real_type), memcpy (value_contents_raw (val) + TYPE_LENGTH (real_type),
VALUE_CONTENTS (arg2), TYPE_LENGTH (real_type)); VALUE_CONTENTS (arg2), TYPE_LENGTH (real_type));
return val; return val;
} }
@ -2811,9 +2812,9 @@ cast_into_complex (struct type *type, struct value *val)
struct value *re_val = allocate_value (val_real_type); struct value *re_val = allocate_value (val_real_type);
struct value *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));
memcpy (VALUE_CONTENTS_RAW (im_val), memcpy (value_contents_raw (im_val),
VALUE_CONTENTS (val) + TYPE_LENGTH (val_real_type), VALUE_CONTENTS (val) + TYPE_LENGTH (val_real_type),
TYPE_LENGTH (val_real_type)); TYPE_LENGTH (val_real_type));

View file

@ -1,8 +1,8 @@
/* 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, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005 Free
Foundation, Inc. Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -147,6 +147,19 @@ value_bitsize (struct value *value)
return value->bitsize; return value->bitsize;
} }
bfd_byte *
value_contents_raw (struct value *value)
{
return value->aligner.contents + value->embedded_offset;
}
bfd_byte *
value_contents_all_raw (struct value *value)
{
return value->aligner.contents;
}
/* 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. */
@ -256,7 +269,7 @@ value_copy (struct value *arg)
val->modifiable = arg->modifiable; val->modifiable = arg->modifiable;
if (!VALUE_LAZY (val)) if (!VALUE_LAZY (val))
{ {
memcpy (VALUE_CONTENTS_ALL_RAW (val), VALUE_CONTENTS_ALL_RAW (arg), memcpy (value_contents_all_raw (val), value_contents_all_raw (arg),
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg))); TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg)));
} }
@ -938,7 +951,7 @@ value_primitive_field (struct value *arg1, int offset,
if (VALUE_LAZY (arg1)) if (VALUE_LAZY (arg1))
VALUE_LAZY (v) = 1; VALUE_LAZY (v) = 1;
else else
memcpy (VALUE_CONTENTS_ALL_RAW (v), VALUE_CONTENTS_ALL_RAW (arg1), memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg1))); TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg1)));
v->offset = value_offset (arg1); v->offset = value_offset (arg1);
VALUE_EMBEDDED_OFFSET (v) VALUE_EMBEDDED_OFFSET (v)
@ -954,8 +967,8 @@ value_primitive_field (struct value *arg1, int offset,
if (VALUE_LAZY (arg1)) if (VALUE_LAZY (arg1))
VALUE_LAZY (v) = 1; VALUE_LAZY (v) = 1;
else else
memcpy (VALUE_CONTENTS_RAW (v), memcpy (value_contents_raw (v),
VALUE_CONTENTS_RAW (arg1) + offset, value_contents_raw (arg1) + offset,
TYPE_LENGTH (type)); TYPE_LENGTH (type));
v->offset = (value_offset (arg1) + offset v->offset = (value_offset (arg1) + offset
+ VALUE_EMBEDDED_OFFSET (arg1)); + VALUE_EMBEDDED_OFFSET (arg1));
@ -1154,12 +1167,12 @@ retry:
case TYPE_CODE_ENUM: case TYPE_CODE_ENUM:
case TYPE_CODE_BOOL: case TYPE_CODE_BOOL:
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
store_signed_integer (VALUE_CONTENTS_RAW (val), len, num); store_signed_integer (value_contents_raw (val), len, num);
break; break;
case TYPE_CODE_REF: case TYPE_CODE_REF:
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
store_typed_address (VALUE_CONTENTS_RAW (val), type, (CORE_ADDR) num); store_typed_address (value_contents_raw (val), type, (CORE_ADDR) num);
break; break;
default: default:
@ -1175,7 +1188,7 @@ struct value *
value_from_pointer (struct type *type, CORE_ADDR addr) value_from_pointer (struct type *type, CORE_ADDR addr)
{ {
struct value *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;
} }
@ -1204,7 +1217,7 @@ value_from_string (char *ptr)
string_char_type, string_char_type,
rangetype); rangetype);
val = allocate_value (stringtype); val = allocate_value (stringtype);
memcpy (VALUE_CONTENTS_RAW (val), ptr, len); memcpy (value_contents_raw (val), ptr, len);
return val; return val;
} }
@ -1218,7 +1231,7 @@ value_from_double (struct type *type, DOUBLEST num)
if (code == TYPE_CODE_FLT) if (code == TYPE_CODE_FLT)
{ {
store_typed_floating (VALUE_CONTENTS_RAW (val), base_type, num); store_typed_floating (value_contents_raw (val), base_type, num);
} }
else else
error ("Unexpected type encountered for floating constant."); error ("Unexpected type encountered for floating constant.");

View file

@ -181,12 +181,12 @@ extern int value_offset (struct value *);
#define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type #define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type
#define VALUE_LAZY(val) (val)->lazy #define VALUE_LAZY(val) (val)->lazy
/* VALUE_CONTENTS and VALUE_CONTENTS_RAW both return the address of /* VALUE_CONTENTS and value_contents_raw() both return the address of
the gdb buffer used to hold a copy of the contents of the lval. the gdb buffer used to hold a copy of the contents of the lval.
VALUE_CONTENTS is used when the contents of the buffer are needed VALUE_CONTENTS is used when the contents of the buffer are needed
-- it uses value_fetch_lazy() to load the buffer from the process -- it uses value_fetch_lazy() to load the buffer from the process
being debugged if it hasn't already been loaded. being debugged if it hasn't already been loaded.
VALUE_CONTENTS_RAW is used when data is being stored into the value_contents_raw() is used when data is being stored into the
buffer, or when it is certain that the contents of the buffer are buffer, or when it is certain that the contents of the buffer are
valid. valid.
@ -194,18 +194,18 @@ extern int value_offset (struct value *);
get to the real subobject, if the value happens to represent get to the real subobject, if the value happens to represent
something embedded in a larger run-time object. */ something embedded in a larger run-time object. */
#define VALUE_CONTENTS_RAW(val) \ extern bfd_byte *value_contents_raw (struct value *);
((val)->aligner.contents + (val)->embedded_offset)
#define VALUE_CONTENTS(val) \ #define VALUE_CONTENTS(val) \
((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), VALUE_CONTENTS_RAW(val)) ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), \
(val)->aligner.contents)
/* The ALL variants of the above two macros do not adjust the returned /* The ALL variants of the above two macros do not adjust the returned
pointer by the embedded_offset value. */ pointer by the embedded_offset value. */
#define VALUE_CONTENTS_ALL_RAW(val) ((char *) (val)->aligner.contents) extern bfd_byte *value_contents_all_raw (struct value *);
#define VALUE_CONTENTS_ALL(val) \ #define VALUE_CONTENTS_ALL(val) \
((void) (VALUE_LAZY(val) && value_fetch_lazy(val)), \ ((void) (VALUE_LAZY(val) && value_fetch_lazy(val)), \
VALUE_CONTENTS_ALL_RAW(val)) (val)->aligner.contents)
extern int value_fetch_lazy (struct value *val); extern int value_fetch_lazy (struct value *val);

View file

@ -2095,7 +2095,7 @@ c_value_of_variable (struct varobj *var)
if (VALUE_LAZY (var->value)) if (VALUE_LAZY (var->value))
gdb_value_fetch_lazy (var->value); gdb_value_fetch_lazy (var->value);
val_print (value_type (var->value), val_print (value_type (var->value),
VALUE_CONTENTS_RAW (var->value), 0, value_contents_raw (var->value), 0,
VALUE_ADDRESS (var->value), stb, VALUE_ADDRESS (var->value), stb,
format_code[(int) var->format], 1, 0, 0); format_code[(int) var->format], 1, 0, 0);
thevalue = ui_file_xstrdup (stb, &dummy); thevalue = ui_file_xstrdup (stb, &dummy);