aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-02-02 00:20:07 +0000
committerAndrew Cagney <cagney@redhat.com>2005-02-02 00:20:07 +0000
commit990a07abf64d4a77851368ad9fafebb51ef25136 (patch)
tree8d021aa2eaa9ec89014b91f49ced5800d7d2878b
parentf08562818b089d1f3d69fd30a15e3596aef04c01 (diff)
downloadgdb-990a07abf64d4a77851368ad9fafebb51ef25136.zip
gdb-990a07abf64d4a77851368ad9fafebb51ef25136.tar.gz
gdb-990a07abf64d4a77851368ad9fafebb51ef25136.tar.bz2
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.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/ada-lang.c12
-rw-r--r--gdb/eval.c16
-rw-r--r--gdb/findvar.c18
-rw-r--r--gdb/infcall.c4
-rw-r--r--gdb/infcmd.c7
-rw-r--r--gdb/std-regs.c8
-rw-r--r--gdb/tracepoint.c8
-rw-r--r--gdb/valarith.c12
-rw-r--r--gdb/valops.c33
-rw-r--r--gdb/value.c35
-rw-r--r--gdb/value.h14
-rw-r--r--gdb/varobj.c2
13 files changed, 102 insertions, 77 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d2d49112..8564db6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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>
* regformats/reg-cris.dat: New file with register definitions for CRIS.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2fa5e0b..97ffba8 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -422,7 +422,7 @@ value_from_contents_and_address (struct type *type,
if (valaddr == NULL)
VALUE_LAZY (v) = 1;
else
- memcpy (VALUE_CONTENTS_RAW (v), valaddr, TYPE_LENGTH (type));
+ memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type));
VALUE_ADDRESS (v) = address;
if (address != 0)
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)))
VALUE_LAZY (result) = 1;
else
- memcpy (VALUE_CONTENTS_RAW (result), VALUE_CONTENTS (val),
+ memcpy (value_contents_raw (result), VALUE_CONTENTS (val),
TYPE_LENGTH (type));
return result;
}
@@ -2038,7 +2038,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
len);
val = value_copy (toval);
- memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval),
+ memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
TYPE_LENGTH (type));
val->type = type;
@@ -3503,7 +3503,7 @@ ensure_lval (struct value *val, CORE_ADDR *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;
@@ -3542,7 +3542,7 @@ convert_actual (struct value *actual, struct type *formal_type0,
struct value *val;
actual_type = ada_check_typedef (value_type (actual));
val = allocate_value (actual_type);
- memcpy ((char *) VALUE_CONTENTS_RAW (val),
+ memcpy ((char *) value_contents_raw (val),
(char *) VALUE_CONTENTS (actual),
TYPE_LENGTH (actual_type));
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);
- store_unsigned_integer (VALUE_CONTENTS_RAW (val),
+ store_unsigned_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)), v);
return val;
}
diff --git a/gdb/eval.c b/gdb/eval.c
index 7e0e9ed..592a9b2 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1,8 +1,8 @@
/* Evaluate expressions for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
- Foundation, Inc.
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free
+ Software Foundation, Inc.
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");
for (index = low; index <= high; index++)
{
- memcpy (VALUE_CONTENTS_RAW (array)
+ memcpy (value_contents_raw (array)
+ (index - low_bound) * 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));
if (index < low_bound || index > high_bound)
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);
}
return index;
@@ -500,7 +500,7 @@ evaluate_subexp_standard (struct type *expect_type,
&& TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
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);
}
@@ -518,7 +518,7 @@ evaluate_subexp_standard (struct type *expect_type,
high_bound = (TYPE_LENGTH (type) / element_size) - 1;
}
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;)
{
struct value *element;
@@ -544,7 +544,7 @@ evaluate_subexp_standard (struct type *expect_type,
if (index > high_bound)
/* to avoid memory corruption */
error ("Too many array elements");
- memcpy (VALUE_CONTENTS_RAW (array)
+ memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size,
VALUE_CONTENTS (element),
element_size);
@@ -558,7 +558,7 @@ evaluate_subexp_standard (struct type *expect_type,
&& TYPE_CODE (type) == TYPE_CODE_SET)
{
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 *check_type = element_type;
LONGEST low_bound, high_bound;
diff --git a/gdb/findvar.c b/gdb/findvar.c
index cc7d7a5..5fc3685 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -1,8 +1,8 @@
/* Find a variable's value in memory, for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software
- Foundation, Inc.
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
+ Software Foundation, Inc.
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));
- memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
+ memcpy (value_contents_raw (reg_val), raw_buffer,
register_size (current_gdbarch, regnum));
VALUE_LVAL (reg_val) = lval;
VALUE_ADDRESS (reg_val) = addr;
@@ -400,7 +400,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
{
case LOC_CONST:
/* 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));
VALUE_LVAL (v) = not_lval;
return v;
@@ -412,10 +412,10 @@ read_var_value (struct symbol *var, struct frame_info *frame)
CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_BFD_SECTION (var));
- store_typed_address (VALUE_CONTENTS_RAW (v), type, addr);
+ store_typed_address (value_contents_raw (v), type, addr);
}
else
- store_typed_address (VALUE_CONTENTS_RAW (v), type,
+ store_typed_address (value_contents_raw (v), type,
SYMBOL_VALUE_ADDRESS (var));
VALUE_LVAL (v) = not_lval;
return v;
@@ -424,7 +424,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
{
char *bytes_addr;
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;
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
is that REGISTER_TO_VALUE populates the entire value
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_FRAME_ID (v) = get_frame_id (frame);
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;
else
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;
}
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 0f677cc..0617ce9 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1,7 +1,7 @@
/* Perform an inferior function call, for GDB, the GNU debugger.
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.
This file is part of GDB.
@@ -861,7 +861,7 @@ the function call).", name);
NULL, NULL, NULL)
== RETURN_VALUE_REGISTER_CONVENTION);
gdbarch_return_value (current_gdbarch, values_type, retbuf,
- VALUE_CONTENTS_RAW (retval) /*read*/,
+ value_contents_raw (retval) /*read*/,
NULL /*write*/);
}
do_cleanups (retbuf_cleanup);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 7f40180..1a7f03e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1,6 +1,7 @@
/* 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.
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);
CHECK_TYPEDEF (value_type);
gdbarch_return_value (current_gdbarch, value_type, stop_registers,
- VALUE_CONTENTS_RAW (value), NULL);
+ value_contents_raw (value), NULL);
break;
case RETURN_VALUE_STRUCT_CONVENTION:
value = NULL;
diff --git a/gdb/std-regs.c b/gdb/std-regs.c
index f11bb57..0d711a6 100644
--- a/gdb/std-regs.c
+++ b/gdb/std-regs.c
@@ -1,6 +1,6 @@
/* 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.
@@ -60,7 +60,7 @@ value_of_builtin_frame_reg (struct frame_info *frame)
build_builtin_type_frame_reg ();
val = allocate_value (builtin_type_frame_reg);
VALUE_LVAL (val) = not_lval;
- buf = VALUE_CONTENTS_RAW (val);
+ buf = value_contents_raw (val);
memset (buf, TYPE_LENGTH (value_type (val)), 0);
/* frame.base. */
if (frame != NULL)
@@ -85,7 +85,7 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame)
else
{
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)
memset (buf, TYPE_LENGTH (value_type (val)), 0);
else
@@ -103,7 +103,7 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame)
else
{
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)
memset (buf, TYPE_LENGTH (value_type (val)), 0);
else
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index de9709d..74a0d55 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1,7 +1,7 @@
/* Tracing functionality for remote targets in custom GDB protocol
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
+ Software Foundation, Inc.
This file is part of GDB.
@@ -297,7 +297,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
builtin_type_char, func_range);
func_val = allocate_value (func_string);
func_val->type = func_string;
- memcpy (VALUE_CONTENTS_RAW (func_val),
+ memcpy (value_contents_raw (func_val),
DEPRECATED_SYMBOL_NAME (traceframe_fun),
len);
func_val->modifiable = 0;
@@ -319,7 +319,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
builtin_type_char, file_range);
file_val = allocate_value (file_string);
file_val->type = file_string;
- memcpy (VALUE_CONTENTS_RAW (file_val),
+ memcpy (value_contents_raw (file_val),
traceframe_sal.symtab->filename,
len);
file_val->modifiable = 0;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 418397a..5233d08 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1,8 +1,8 @@
/* Perform arithmetic and other operations on values, for GDB.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
- Foundation, Inc.
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
+ Software Foundation, Inc.
This file is part of GDB.
@@ -806,7 +806,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
else
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
&&
@@ -843,7 +843,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
}
val = allocate_value (type1);
- store_signed_integer (VALUE_CONTENTS_RAW (val),
+ store_signed_integer (value_contents_raw (val),
TYPE_LENGTH (type1),
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
? builtin_type_unsigned_long_long
: builtin_type_unsigned_long);
- store_unsigned_integer (VALUE_CONTENTS_RAW (val),
+ store_unsigned_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)),
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
? builtin_type_long_long
: builtin_type_long);
- store_signed_integer (VALUE_CONTENTS_RAW (val),
+ store_signed_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)),
v);
}
diff --git a/gdb/valops.c b/gdb/valops.c
index e17ca3c..1d45ad2 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1,6 +1,7 @@
/* Perform non-arithmetic operations on values, for GDB.
+
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.
This file is part of GDB.
@@ -457,7 +458,7 @@ value_at (struct type *type, CORE_ADDR addr)
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_ADDRESS (val) = addr;
@@ -504,7 +505,7 @@ value_fetch_lazy (struct value *val)
struct type *type = value_type (val);
if (length)
- read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length);
+ read_memory (addr, value_contents_all_raw (val), length);
VALUE_LAZY (val) = 0;
return 0;
@@ -728,7 +729,7 @@ value_assign (struct value *toval, struct value *fromval)
}
val = value_copy (toval);
- memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval),
+ memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
TYPE_LENGTH (type));
val->type = type;
val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval));
@@ -753,7 +754,7 @@ value_repeat (struct value *arg1, int count)
val = allocate_repeat_value (VALUE_ENCLOSING_TYPE (arg1), count);
read_memory (VALUE_ADDRESS (arg1) + value_offset (arg1),
- VALUE_CONTENTS_ALL_RAW (val),
+ value_contents_all_raw (val),
TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)));
VALUE_LVAL (val) = lval_memory;
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);
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]),
typelength);
}
@@ -1069,7 +1070,7 @@ value_string (char *ptr, int len)
if (current_language->c_style_arrays == 0)
{
val = allocate_value (stringtype);
- memcpy (VALUE_CONTENTS_RAW (val), ptr, len);
+ memcpy (value_contents_raw (val), ptr, len);
return val;
}
@@ -1093,7 +1094,7 @@ value_bitstring (char *ptr, int len)
struct type *type = create_set_type ((struct type *) NULL, domain_type);
TYPE_CODE (type) = TYPE_CODE_BITSTRING;
val = allocate_value (type);
- memcpy (VALUE_CONTENTS_RAW (val), ptr, TYPE_LENGTH (type));
+ memcpy (value_contents_raw (val), ptr, TYPE_LENGTH (type));
return val;
}
@@ -1297,7 +1298,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
CORE_ADDR base_addr;
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)
error ("virtual baseclass botch");
VALUE_LVAL (v2) = lval_memory;
@@ -1312,8 +1313,8 @@ search_struct_field (char *name, struct value *arg1, int offset,
if (VALUE_LAZY (arg1))
VALUE_LAZY (v2) = 1;
else
- memcpy (VALUE_CONTENTS_RAW (v2),
- VALUE_CONTENTS_RAW (arg1) + boffset,
+ memcpy (value_contents_raw (v2),
+ value_contents_raw (arg1) + boffset,
TYPE_LENGTH (basetype));
}
@@ -2744,7 +2745,7 @@ value_slice (struct value *array, int lowbound, int length)
int j = i % TARGET_CHAR_BIT;
if (BITS_BIG_ENDIAN)
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
@@ -2792,9 +2793,9 @@ value_literal_complex (struct value *arg1, struct value *arg2, struct type *type
arg1 = value_cast (real_type, arg1);
arg2 = value_cast (real_type, arg2);
- memcpy (VALUE_CONTENTS_RAW (val),
+ memcpy (value_contents_raw (val),
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));
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 *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));
- memcpy (VALUE_CONTENTS_RAW (im_val),
+ memcpy (value_contents_raw (im_val),
VALUE_CONTENTS (val) + TYPE_LENGTH (val_real_type),
TYPE_LENGTH (val_real_type));
diff --git a/gdb/value.c b/gdb/value.c
index 3835a8a..a9c990c 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1,8 +1,8 @@
/* Low level packing and unpacking of values for GDB, the GNU Debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software
- Foundation, Inc.
+ 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005 Free
+ Software Foundation, Inc.
This file is part of GDB.
@@ -147,6 +147,19 @@ value_bitsize (struct value *value)
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
mark is obtained (except for those released) are subject to being freed
if a subsequent value_free_to_mark is passed the mark. */
@@ -256,7 +269,7 @@ value_copy (struct value *arg)
val->modifiable = arg->modifiable;
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)));
}
@@ -938,7 +951,7 @@ value_primitive_field (struct value *arg1, int offset,
if (VALUE_LAZY (arg1))
VALUE_LAZY (v) = 1;
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)));
v->offset = value_offset (arg1);
VALUE_EMBEDDED_OFFSET (v)
@@ -954,8 +967,8 @@ value_primitive_field (struct value *arg1, int offset,
if (VALUE_LAZY (arg1))
VALUE_LAZY (v) = 1;
else
- memcpy (VALUE_CONTENTS_RAW (v),
- VALUE_CONTENTS_RAW (arg1) + offset,
+ memcpy (value_contents_raw (v),
+ value_contents_raw (arg1) + offset,
TYPE_LENGTH (type));
v->offset = (value_offset (arg1) + offset
+ VALUE_EMBEDDED_OFFSET (arg1));
@@ -1154,12 +1167,12 @@ retry:
case TYPE_CODE_ENUM:
case TYPE_CODE_BOOL:
case TYPE_CODE_RANGE:
- store_signed_integer (VALUE_CONTENTS_RAW (val), len, num);
+ store_signed_integer (value_contents_raw (val), len, num);
break;
case TYPE_CODE_REF:
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;
default:
@@ -1175,7 +1188,7 @@ struct value *
value_from_pointer (struct type *type, CORE_ADDR addr)
{
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;
}
@@ -1204,7 +1217,7 @@ value_from_string (char *ptr)
string_char_type,
rangetype);
val = allocate_value (stringtype);
- memcpy (VALUE_CONTENTS_RAW (val), ptr, len);
+ memcpy (value_contents_raw (val), ptr, len);
return val;
}
@@ -1218,7 +1231,7 @@ value_from_double (struct type *type, DOUBLEST num)
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
error ("Unexpected type encountered for floating constant.");
diff --git a/gdb/value.h b/gdb/value.h
index f071b55..844d6fc 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -181,12 +181,12 @@ extern int value_offset (struct value *);
#define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type
#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.
VALUE_CONTENTS is used when the contents of the buffer are needed
-- it uses value_fetch_lazy() to load the buffer from the process
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
valid.
@@ -194,18 +194,18 @@ extern int value_offset (struct value *);
get to the real subobject, if the value happens to represent
something embedded in a larger run-time object. */
-#define VALUE_CONTENTS_RAW(val) \
- ((val)->aligner.contents + (val)->embedded_offset)
+extern bfd_byte *value_contents_raw (struct value *);
#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
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) \
((void) (VALUE_LAZY(val) && value_fetch_lazy(val)), \
- VALUE_CONTENTS_ALL_RAW(val))
+ (val)->aligner.contents)
extern int value_fetch_lazy (struct value *val);
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 175fd43..d58c8bd 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2095,7 +2095,7 @@ c_value_of_variable (struct varobj *var)
if (VALUE_LAZY (var->value))
gdb_value_fetch_lazy (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,
format_code[(int) var->format], 1, 0, 0);
thevalue = ui_file_xstrdup (stb, &dummy);