diff options
author | Pedro Alves <palves@redhat.com> | 2011-02-14 11:30:37 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-02-14 11:30:37 +0000 |
commit | 39d37385568d667a2f5fab7e10adda5813a54467 (patch) | |
tree | 4d9623ad33dc78fd0a5036ef9a97eaaa28bdc914 /gdb/valops.c | |
parent | 06d72e16c409574a7facc283ef1fcd7c5fd5fa05 (diff) | |
download | gdb-39d37385568d667a2f5fab7e10adda5813a54467.zip gdb-39d37385568d667a2f5fab7e10adda5813a54467.tar.gz gdb-39d37385568d667a2f5fab7e10adda5813a54467.tar.bz2 |
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.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index ab31976..1c37fae 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); |