summaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-02-14 11:30:36 +0000
committerPedro Alves <pedro@codesourcery.com>2011-02-14 11:30:36 +0000
commit727a3a5532e6b18c632a5d404fa9d2bf9a8f4473 (patch)
tree76166fe061e35cda4060bc8c1463a5e4bb890fa3 /gdb/valops.c
parentcb90d2231795e71f93b6298cb3195f52eee7accd (diff)
downloadgdb-727a3a5532e6b18c632a5d404fa9d2bf9a8f4473.tar.gz
gdb/
* value.h (value_contents_copy, value_contents_copy_raw): Declare. * value.c (value_contents_copy_raw, value_contents_copy): New functions. (value_primitive_field): Use value_contents_copy_raw instead of memcpy. * valops.c (value_fetch_lazy): Use value_contents_copy instead of memcpy. (value_array, value_slice): Ditto. * valarith.c (value_subscripted_rvalue): Use value_contents_copy_raw instead of memcpy. gdb/testsuite/ * gdb.trace/unavailable.exp (gdb_collect_globals_test): Add new tests for building arrays from unavailable values, subscripting non-memory rvalue unvailable arrays, and accessing fields or baseclasses of non-lazy unavailable values, * gdb.trace/unavailable.cc (small_struct, small_struct_b): New struct types. (g_smallstruct, g_smallstruct_b): New globals.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index ab31976041c..1c37fae46a9 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1044,12 +1044,16 @@ value_fetch_lazy (struct value *val)
if (value_lazy (new_val))
value_fetch_lazy (new_val);
- /* If the register was not saved, mark it unavailable. */
+ /* If the register was not saved, mark it optimized out. */
if (value_optimized_out (new_val))
set_value_optimized_out (val, 1);
else
- memcpy (value_contents_raw (val), value_contents (new_val),
- TYPE_LENGTH (type));
+ {
+ set_value_lazy (val, 0);
+ value_contents_copy (val, value_embedded_offset (val),
+ new_val, value_embedded_offset (new_val),
+ TYPE_LENGTH (type));
+ }
if (frame_debug)
{
@@ -1765,9 +1769,8 @@ value_ind (struct value *arg1)
return 0; /* For lint -- never reached. */
}
-/* Create a value for an array by allocating space in GDB, copying
- copying the data into that space, and then setting up an array
- value.
+/* Create a value for an array by allocating space in GDB, copying the
+ data into that space, and then setting up an array value.
The array bounds are set from LOWBOUND and HIGHBOUND, and the array
is populated from the values passed in ELEMVEC.
@@ -1809,11 +1812,8 @@ 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),
- value_contents_all (elemvec[idx]),
- typelength);
- }
+ value_contents_copy (val, idx * typelength, elemvec[idx], 0,
+ typelength);
return val;
}
@@ -1822,9 +1822,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
val = allocate_value (arraytype);
for (idx = 0; idx < nelem; idx++)
- memcpy (value_contents_writeable (val) + (idx * typelength),
- value_contents_all (elemvec[idx]),
- typelength);
+ value_contents_copy (val, idx * typelength, elemvec[idx], 0, typelength);
return val;
}
@@ -3711,9 +3709,8 @@ value_slice (struct value *array, int lowbound, int length)
else
{
slice = allocate_value (slice_type);
- memcpy (value_contents_writeable (slice),
- value_contents (array) + offset,
- TYPE_LENGTH (slice_type));
+ value_contents_copy (slice, 0, array, offset,
+ TYPE_LENGTH (slice_type));
}
set_value_component_location (slice, array);