]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/
authorPedro Alves <palves@redhat.com>
Mon, 27 Dec 2010 19:53:55 +0000 (19:53 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 27 Dec 2010 19:53:55 +0000 (19:53 +0000)
* breakpoint.c (breakpoint_restore_shadows): When looking for the
location with the lowest address that overlaps the memory range we
want to restore shadows for, account for multiple locations at the
same address.

gdb/ChangeLog
gdb/breakpoint.c

index d8e3f42711d4b17606abacc3948f86e0cd108320..dfb440db89fefb90e768013b0f0e256887a112be 100644 (file)
@@ -1,3 +1,10 @@
+2010-12-27  Pedro Alves  <pedro@codesourcery.com>
+
+       * breakpoint.c (breakpoint_restore_shadows): When looking for the
+       location with the lowest address that overlaps the memory range we
+       want to restore shadows for, account for multiple locations at the
+       same address.
+
 2010-12-23  Joel Brobecker  <brobecker@adacore.com>
 
        * mi/mi-main.c (mi_cmd_remove_inferior): Use _() marker for error
index 484cc3791112ae45bbd5ebd0813c9a81572a1026..9e1d6ee6fb3ed81aa861be67e2f685b8906e35a6 100644 (file)
@@ -1138,6 +1138,23 @@ breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len)
        bc_r = bc;
     }
 
+  /* Due to the binary search above, we need to make sure we pick the
+     first location that's at BC_L's address.  E.g., if there are
+     multiple locations at the same address, BC_L may end up pointing
+     at a duplicate location, and miss the "master"/"inserted"
+     location.  Say, given locations L1, L2 and L3 at addresses A and
+     B:
+
+      L1@A, L2@A, L3@B, ...
+
+     BC_L could end up pointing at location L2, while the "master"
+     location could be L1.  Since the `loc->inserted' flag is only set
+     on "master" locations, we'd forget to restore the shadow of L1
+     and L2.  */
+  while (bc_l > 0
+        && bp_location[bc_l]->address == bp_location[bc_l - 1]->address)
+    bc_l--;
+
   /* Now do full processing of the found relevant range of elements.  */
 
   for (bc = bc_l; bc < bp_location_count; bc++)