This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 05/12] Handle reinsert breakpoints for vforked child
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Mon, 13 Jun 2016 16:07:04 +0100
- Subject: Re: [PATCH 05/12] Handle reinsert breakpoints for vforked child
- Authentication-results: sourceware.org; auth=none
- References: <1464859846-15619-1-git-send-email-yao dot qi at linaro dot org> <1464859846-15619-6-git-send-email-yao dot qi at linaro dot org>
On 06/02/2016 10:30 AM, Yao Qi wrote:
> When a thread is doing step-over with reinsert breakpoint, and the
> instruction executed is a syscall doing vfork, both parent and child
> share the memory, so the reinsert breakpoint in the space is visible
> to both of them. Also, removing the reinsert breakpoints from the
> child will effectively remove them from the parent. We should
> carefully manipulate reinsert breakpoints for both processes.
>
> What we are doing here is that
>
> - uninsert reinsert breakpoints from the parent before cloning the
> breakpoint list. We use "uninsert" instead of "remove", because
> we need to "reinsert" them back after vfork is done. In fact,
> "uninsert" removes them from both child and parent process space.
> - reinsert breakpoints in parent process are still copied to child's
> breakpoint list,
> - remove them from child's breakpoint list as what we did for fork,
> at this point, reinsert breakpoints are removed from the child and
> the parent, but they are still tracked by the parent's breakpoint
> list,
> - once vfork is done, "reinsert" them back to the parent,
>
> gdb/gdbserver:
>
> 2016-05-26 Yao Qi <yao.qi@linaro.org>
>
> * linux-low.c (handle_extended_wait): Call
> uninsert_reinsert_breakpoints for the parent process. Remove
> reinsert breakpoints from the child process. Reinsert them to
> the parent process when vfork is done.
> * mem-break.c (uninsert_reinsert_breakpoints): New function.
> (reinsert_reinsert_breakpoints): New function.
> * mem-break.h (uninsert_reinsert_breakpoints): Declare
> (reinsert_reinsert_breakpoints): Declare.
>
> gdb/testsuite:
>
> 2016-05-26 Yao Qi <yao.qi@linaro.org>
>
> * gdb.base/step-over-fork-1.exp: Extend the test for vfork.
OK.
Thanks,
Pedro Alves