aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2010-06-23 12:46:37 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2010-06-23 12:46:37 +0000
commitd03285ec7b543bb910328d0cc55ff094486ea126 (patch)
treeb15447c5b4fa2424ac99931ac4a08317393078d0 /gdb/breakpoint.c
parent61e8a5ea173059baf957e65885fbaa3613cc6076 (diff)
downloadgdb-d03285ec7b543bb910328d0cc55ff094486ea126.zip
gdb-d03285ec7b543bb910328d0cc55ff094486ea126.tar.gz
gdb-d03285ec7b543bb910328d0cc55ff094486ea126.tar.bz2
ChangeLog:
* infrun.c (handle_inferior_event): Handle presence of single-step breakpoints for TARGET_WAITKIND_FORKED and TARGET_WAITKIND_VFORKED. Cancel single-step breakpoints for TARGET_WAITKIND_EXITED, TARGET_WAITKIND_SIGNALED, and TARGET_WAITKIND_EXECD. * breakpoint.c (detach_single_step_breakpoints): New function. (detach_breakpoints): Call it. (cancel_single_step_breakpoints): New function. * breakpoint.h (cancel_single_step_breakpoints): Add prototype. * spu-tdep.c (spu_memory_remove_breakpoint): New function. (spu_gdbarch_init): Install it. testsuite/ChangeLog: * gdb.cell/fork.exp: New file. * gdb.cell/fork.c: Likewise. * gdb.cell/fork-spu.c: Likewise.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4cf9e67..f2b973a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -196,6 +196,8 @@ static void tcatch_command (char *arg, int from_tty);
static void ep_skip_leading_whitespace (char **s);
+static void detach_single_step_breakpoints (void);
+
static int single_step_breakpoint_inserted_here_p (struct address_space *,
CORE_ADDR pc);
@@ -2383,6 +2385,10 @@ detach_breakpoints (int pid)
if (b->inserted)
val |= remove_breakpoint_1 (b, mark_inserted);
}
+
+ /* Detach single-step breakpoints as well. */
+ detach_single_step_breakpoints ();
+
do_cleanups (old_chain);
return val;
}
@@ -10491,6 +10497,39 @@ remove_single_step_breakpoints (void)
}
}
+/* Delete software single step breakpoints without removing them from
+ the inferior. This is intended to be used if the inferior's address
+ space where they were inserted is already gone, e.g. after exit or
+ exec. */
+
+void
+cancel_single_step_breakpoints (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ if (single_step_breakpoints[i])
+ {
+ xfree (single_step_breakpoints[i]);
+ single_step_breakpoints[i] = NULL;
+ single_step_gdbarch[i] = NULL;
+ }
+}
+
+/* Detach software single-step breakpoints from INFERIOR_PTID without
+ removing them. */
+
+static void
+detach_single_step_breakpoints (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ if (single_step_breakpoints[i])
+ target_remove_breakpoint (single_step_gdbarch[i],
+ single_step_breakpoints[i]);
+}
+
/* Check whether a software single-step breakpoint is inserted at PC. */
static int