+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.
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;
|| 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;
}
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;
*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;
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);
}
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;
}
/* 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.
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);
}
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;
&& 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);
}
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;
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);
&& 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;
/* 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.
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;
{
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;
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;
{
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;
}
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;
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;
}
/* 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.
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);
/* 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.
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;
/* 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.
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)
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
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
/* 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.
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;
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;
/* 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.
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
&&
}
val = allocate_value (type1);
- store_signed_integer (VALUE_CONTENTS_RAW (val),
+ store_signed_integer (value_contents_raw (val),
TYPE_LENGTH (type1),
v);
}
(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);
}
(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);
}
/* 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.
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;
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;
}
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));
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);
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);
}
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;
}
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;
}
\f
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;
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));
}
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
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;
}
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));
/* 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.
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;
+}
+
+\f
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed
if a subsequent value_free_to_mark is passed the mark. */
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)));
}
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)
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));
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:
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;
}
string_char_type,
rangetype);
val = allocate_value (stringtype);
- memcpy (VALUE_CONTENTS_RAW (val), ptr, len);
+ memcpy (value_contents_raw (val), ptr, len);
return val;
}
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.");
#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.
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);
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);