1 --- debugger.c 2007-04-07 10:17:12.000000000 +0200
2 +++ debugger.c-childhandler 2007-04-07 10:16:39.000000000 +0200
7 +static int attach_handler_count;
9 +static void attach_handler (int signo)
11 + attach_handler_count++;
14 /* Debugging only: Number of signal needing redelivery on PTRACE_ATTACH. */
15 int attach_redelivered;
21 + attach_handler_count = 0;
22 + /* Fill SA_SIGACTION _before_ SA_HANDLER as they may be in union! */
23 + act.sa_sigaction = NULL;
24 + act.sa_handler = attach_handler;
25 + i = sigemptyset (&act.sa_mask);
28 + act.sa_restorer = NULL;
30 + attach_handler_orig = signal (SIGCHLD, attach_handler);
32 i = ptrace (PTRACE_ATTACH, pid, NULL, NULL);
39 + attach_handler_orig = signal (SIGCHLD, attach_handler_orig);
40 + assert (attach_handler_orig == attach_handler);
42 + if (stopped == 1 && attach_handler_count == 2)
44 + else if (stopped == 1 && attach_handler_count == 1)
46 + else if (stopped == 0 && attach_handler_count == 1)
50 + fprintf (stderr, "stopped = %d, attach_handler_count = %d\n", stopped,
51 + attach_handler_count);