+2012-08-16 Joel Brobecker <brobecker@adacore.com>
+
+ * breakpoint.h (detach_breakpoints): pid parameter is now a ptid.
+ * breakpoint.c (detach_breakpoints): Change pid parameter into
+ a ptid. Adjust code accordingly.
+ * infrun.c (handle_inferior_event): Delete variable child_pid.
+ Update call to detach_breakpoints to pass the child ptid for
+ fork events.
+ * linux-nat.c (linux_nat_iterate_watchpoint_lwps): Remove
+ assert that inferior_ptid's lwp is zero.
+ (linux_handle_extended_wait): Update call to detach_breakpoints.
+ * inf-ttrace.c (inf_ttrace_follow_fork): Update call to
+ detach_breakpoints.
+
2012-08-16 Joel Brobecker <brobecker@adacore.com>
* inf-ttrace.c (inf_ttrace_follow_fork): When following the
}
int
-detach_breakpoints (int pid)
+detach_breakpoints (ptid_t ptid)
{
struct bp_location *bl, **blp_tmp;
int val = 0;
struct cleanup *old_chain = save_inferior_ptid ();
struct inferior *inf = current_inferior ();
- if (pid == PIDGET (inferior_ptid))
+ if (PIDGET (ptid) == PIDGET (inferior_ptid))
error (_("Cannot detach breakpoints of inferior_ptid"));
/* Set inferior_ptid; remove_breakpoint_1 uses this global. */
- inferior_ptid = pid_to_ptid (pid);
+ inferior_ptid = ptid;
ALL_BP_LOCATIONS (bl, blp_tmp)
{
if (bl->pspace != inf->pspace)
It is an error to use this function on the process whose id is
inferior_ptid. */
-extern int detach_breakpoints (int);
+extern int detach_breakpoints (ptid_t ptid);
/* This function is called when program space PSPACE is about to be
deleted. It takes care of updating breakpoints to not reference
inf->pspace = parent_inf->pspace;
inf->aspace = parent_inf->aspace;
copy_terminal_info (inf, parent_inf);
- detach_breakpoints (pid);
+ detach_breakpoints (ptid_build (pid, lwpid, 0));
target_terminal_ours ();
fprintf_unfiltered (gdb_stdlog,
of fork events, we do not need to do this, because breakpoints
should have already been removed earlier. */
if (tts.tts_event == TTEVT_VFORK)
- detach_breakpoints (fpid);
+ detach_breakpoints (ptid_build (fpid, flwpid, 0));
target_terminal_ours ();
fprintf_unfiltered (gdb_stdlog,
vfork follow are detached. */
if (ecs->ws.kind != TARGET_WAITKIND_VFORKED)
{
- int child_pid = ptid_get_pid (ecs->ws.value.related_pid);
-
/* This won't actually modify the breakpoint list, but will
physically remove the breakpoints from the child. */
- detach_breakpoints (child_pid);
+ detach_breakpoints (ecs->ws.value.related_pid);
}
if (singlestep_breakpoints_inserted_p)
pid_t child_pid = GET_PID (inferior_ptid);
ptid_t child_ptid = ptid_build (child_pid, child_pid, 0);
- gdb_assert (!is_lwp (inferior_ptid));
gdb_assert (find_lwp_pid (child_ptid) == NULL);
child_lp = add_lwp (child_ptid);
child_lp->stopped = 1;
/* This won't actually modify the breakpoint list, but will
physically remove the breakpoints from the child. */
- detach_breakpoints (new_pid);
+ detach_breakpoints (ptid_build (new_pid, new_pid, 0));
/* Retain child fork in ptrace (stopped) state. */
if (!find_fork_pid (new_pid))