This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw) (timeout) with Linux 2.6.32 and older version
- From: Pedro Alves <palves at redhat dot com>
- To: Hui Zhu <hui_zhu at mentor dot com>, gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Thu, 05 Jun 2014 09:43:22 +0100
- Subject: Re: [PATCH] Fix gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw) (timeout) with Linux 2.6.32 and older version
- Authentication-results: sourceware.org; auth=none
- References: <533D17E2 dot 9070402 at mentor dot com> <538636AF dot 9040208 at redhat dot com> <539020AB dot 8050105 at mentor dot com>
On 06/05/2014 08:47 AM, Hui Zhu wrote:
>
> 2014-06-05 Hui Zhu <hui@codesourcery.com>
>
> * common/linux-ptrace.c (linux_disable_event_reporting): New.
> * common/linux-ptrace.h (linux_disable_event_reporting): New extern.
You're not adding an extern to an existing function, but adding new declaration
that happens to declare a function with extern linkage.
> * linux-nat.c (linux_child_follow_fork): do a single step before
> detach
Capitalization, and full stop both missing. Write instead:
* common/linux-ptrace.c (linux_disable_event_reporting): New function.
* common/linux-ptrace.h (linux_disable_event_reporting): New declaration.
* linux-nat.c (linux_child_follow_fork): Do a single step before
detach.
> + if (ptrace (PTRACE_SINGLESTEP, child_pid, 0, 0) < 0)
> + perror_with_name (_("Couldn't do single step"));
> + if (my_waitpid (child_pid, &status, 0) < 0)
> + perror_with_name (_("Couldn't wait vfork process"));
> + }
> +
> + ptrace (PTRACE_DETACH, child_pid, 0, WSTOPSIG (status));
The child could have exited with that single-step. So:
if (WIFSTOPPED (status))
ptrace (PTRACE_DETACH, child_pid, 0, WSTOPSIG (status));
OK with that change.
--
Pedro Alves