gdb
authorTom Tromey <tromey@redhat.com>
Thu, 4 Feb 2010 21:04:30 +0000 (21:04 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 4 Feb 2010 21:04:30 +0000 (21:04 +0000)
* 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.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/virtbase.exp
gdb/valops.c

index 3543b1f164fd600ba20eddcf967e5470fbd7e340..2b05b9b49c28e01d2971573aff957afa47f42262 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-04  Tom Tromey  <tromey@redhat.com>
+
+       * 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.
+
 2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR tui/9622
index 4e0ba4ccea96bf5a2ae96f7089b7e6205323eaad..38668ba937d7cbe171a3c18d5d924a067c946518 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-04  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.cp/virtbase.exp: Make test case names unique.
+
 2010-02-02  Tom Tromey  <tromey@redhat.com>
 
        * gdb.cp/virtbase.exp: Add regression tests.
index 5a0de97337effef03d4df39433df620bc763a591..3631db5394c8dfa38e7126569bf89fffd5a2640c 100644 (file)
@@ -42,13 +42,13 @@ gdb_continue_to_breakpoint "first breakpoint"
 # In PR 11226, we failed to print x correctly in the "print *this"
 # case.
 gdb_test "print *this" " = {<mc::Base> = {x = 2}, _vptr.Middle = $hex, y = 3}"
-gdb_test "print x" " = 2"
+gdb_test "print x" " = 2" "print x in get_y"
 
 gdb_breakpoint [gdb_get_line_number "breakpoint 2"]
 gdb_continue_to_breakpoint "second breakpoint"
 
 # In PR 11226, we could not find x here.
-gdb_test "print x" " = 2"
+gdb_test "print x" " = 2" "print x in get_z"
 
 gdb_breakpoint [gdb_get_line_number "breakpoint 3"]
 gdb_continue_to_breakpoint "third breakpoint"
index cee10fb922293b9dfd964935927525b9845afeba..cc7eadf5991c2aa68ed0b94919f87754f6f8b424 100644 (file)
@@ -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)
This page took 0.044583 seconds and 4 git commands to generate.