From d03285ec7b543bb910328d0cc55ff094486ea126 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 23 Jun 2010 12:46:37 +0000 Subject: 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. --- gdb/breakpoint.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'gdb/breakpoint.c') 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 -- cgit v1.1