* breakpoint.c (remove_breakpoint): Do not remove software
authorUlrich Weigand <uweigand@de.ibm.com>
Fri, 11 May 2007 20:01:31 +0000 (20:01 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Fri, 11 May 2007 20:01:31 +0000 (20:01 +0000)
breakpoints in unmapped overlay sections.

gdb/ChangeLog
gdb/breakpoint.c

index be0bc8fe3f1b3e0e04e3f84a1a7ec873068deab2..a78ade4955ec5c92d06f70a32b813e4f1abc2207 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-11  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * breakpoint.c (remove_breakpoint): Do not remove software
+       breakpoints in unmapped overlay sections.
+
 2007-05-11  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * spu-tdep.c: Include "observer.h".
index 176a17cdbe57e8d70d8b5501b40699046be39055..59cb151b516dee7b82d0c6b5be27a9d1ae5d0d74 100644 (file)
@@ -1587,8 +1587,14 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
                 don't know what the overlay manager might do.  */
              if (b->loc_type == bp_loc_hardware_breakpoint)
                val = target_remove_hw_breakpoint (&b->target_info);
-             else
+
+             /* However, we should remove *software* breakpoints only
+                if the section is still mapped, or else we overwrite
+                wrong code with the saved shadow contents.  */
+             else if (section_is_mapped (b->section))
                val = target_remove_breakpoint (&b->target_info);
+             else
+               val = 0;
            }
          else
            {