[RFA/commit 1/3] Do not call detach_breakpoints in inf_ttrace_follow_fork.
Pedro Alves
palves@redhat.com
Thu Jun 21 14:37:00 GMT 2012
On 06/14/2012 07:29 PM, Joel Brobecker wrote:
> These calls are unnecessary because handle_inferior_events already
> called detach_breakpoints for us before calling the target_ops'
> to_follow_fork hook.
Only in the fork case, and only from the child. vfork is more
complicated. See linux-nat.c:linux_child_follow_fork:
if (! follow_child)
{
struct lwp_info *child_lp = NULL;
/* We're already attached to the parent, by default. */
/* Detach new forked process? */
if (detach_fork)
{
struct cleanup *old_chain;
/* Before detaching from the child, remove all breakpoints
from it. If we forked, then this has already been taken
care of by infrun.c. If we vforked however, any
breakpoint inserted in the parent is visible in the
child, even those added while stopped in a vfork
catchpoint. This will remove the breakpoints from the
parent also, but they'll be reinserted below. */
if (has_vforked)
{
/* keep breakpoints list in sync. */
remove_breakpoints_pid (GET_PID (inferior_ptid));
}
> Without this change, we would get a warning
> when trying to remove the breakpoint the second time, because
> the ia64 code detects that the breakpoint address does not point
> to a breakpoint instruction (any more):
>
> warning: Cannot remove breakpoint at address 0x4000000000000d52, no break instruction at such address.
>
> gdb/ChangeLog:
>
> * inf-ttrace.c (inf_ttrace_follow_fork): Remove calls to
> detach_breakpoints.
>
> I am sufficiently confident in this patch that I think I can commit
> on my own, but a second pair of eyes wouldn't hurt...
>
> ---
> gdb/inf-ttrace.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
> index 2c620d5..ffe56e1 100644
> --- a/gdb/inf-ttrace.c
> +++ b/gdb/inf-ttrace.c
> @@ -457,7 +457,6 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
> inf->pspace = parent_inf->pspace;
> inf->aspace = parent_inf->aspace;
> copy_terminal_info (inf, parent_inf);
> - detach_breakpoints (pid);
This branch is detaching breakpoints from the parent, not the child.
>
> target_terminal_ours ();
> fprintf_unfiltered (gdb_stdlog,
> @@ -467,7 +466,6 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
> else
> {
> inferior_ptid = ptid_build (pid, lwpid, 0);
> - detach_breakpoints (fpid);
>
> target_terminal_ours ();
> fprintf_unfiltered (gdb_stdlog,
--
Pedro Alves
More information about the Gdb-patches
mailing list