aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-02-04 21:04:30 +0000
committerTom Tromey <tromey@redhat.com>2010-02-04 21:04:30 +0000
commit1a334831c050446a99a2b5c7ec8e0d452d2f9842 (patch)
treedaa7a9251f3220dddfc69b186fb4de2405e66896 /gdb/valops.c
parent6ac33a4e87237c25f790fbee916ebdfd83a2e983 (diff)
downloadgdb-1a334831c050446a99a2b5c7ec8e0d452d2f9842.zip
gdb-1a334831c050446a99a2b5c7ec8e0d452d2f9842.tar.gz
gdb-1a334831c050446a99a2b5c7ec8e0d452d2f9842.tar.bz2
gdb
* valops.c (search_struct_field): Account for value_embedded_offset. Fix check for virtual base past the end of the object. Use value_copy when making a slice of the value. gdb/testsuite * gdb.cp/virtbase.exp: Make test case names unique.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index cee10fb..cc7eadf 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1903,7 +1903,9 @@ search_struct_field (char *name, struct value *arg1, int offset,
boffset = baseclass_offset (type, i,
value_contents (arg1) + offset,
- value_address (arg1) + offset);
+ value_address (arg1)
+ + value_embedded_offset (arg1)
+ + offset);
if (boffset == -1)
error (_("virtual baseclass botch"));
@@ -1911,8 +1913,9 @@ search_struct_field (char *name, struct value *arg1, int offset,
by the user program. Make sure that it still points to a
valid memory location. */
- boffset += offset;
- if (boffset < 0 || boffset >= TYPE_LENGTH (type))
+ boffset += value_embedded_offset (arg1) + offset;
+ if (boffset < 0
+ || boffset >= TYPE_LENGTH (value_enclosing_type (arg1)))
{
CORE_ADDR base_addr;
@@ -1927,18 +1930,9 @@ search_struct_field (char *name, struct value *arg1, int offset,
}
else
{
- if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
- v2 = allocate_value_lazy (basetype);
- else
- {
- v2 = allocate_value (basetype);
- memcpy (value_contents_raw (v2),
- value_contents_raw (arg1) + boffset,
- TYPE_LENGTH (basetype));
- }
- set_value_component_location (v2, arg1);
- VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
- set_value_offset (v2, value_offset (arg1) + boffset);
+ v2 = value_copy (arg1);
+ deprecated_set_value_type (v2, basetype);
+ set_value_embedded_offset (v2, boffset);
}
if (found_baseclass)