From: Dmitry V. L. <ld...@al...> - 2011-06-20 21:25:38
|
On Mon, Jun 20, 2011 at 09:24:15PM +0200, Denys Vlasenko wrote: [...] > int options = ptrace_setoptions_for_all; > if (followfork) // && (tcp->parent == NULL)) <=== HERE > options |= ptrace_setoptions_followfork; > if (options) { > if (debug) > fprintf(stderr, "setting opts %x on pid %d\n", options, tcp->pid); > if (ptrace(PTRACE_SETOPTIONS, tcp->pid, NULL, options) < 0) { > if (errno != ESRCH) { > /* Should never happen, really */ > error_msg_and_die("PTRACE_SETOPTIONS"); > } > } > } > > The check (tcp->parent == NULL) in old code was meant to check > "if we are not a child created by auto-attach" - in this case, > options need to be set on the child; otherwise they are inherited > and do not need to be set. > > I misunderstood the check and if tcp->parent is not NULL, I was > setting only ptrace_setoptions_for_all bits! > > Simple solution is depicted above - just comment out "&& (tcp->parent == NULL))". > > I will test the "more optimal" solution which does the check, but sets correct opts. > > Meanwhile, can you confirm that commenting-out works for you too? Yes, removing this "tcp->parent == NULL" check fixes the issue, thanks. -- ldv |