This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 04/12] Delete reinsert breakpoints from forked child
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 14 Jun 2016 12:40:17 +0100
- Subject: Re: [PATCH 04/12] Delete reinsert breakpoints from forked child
- Authentication-results: sourceware.org; auth=none
- References: <1464859846-15619-1-git-send-email-yao dot qi at linaro dot org> <1464859846-15619-5-git-send-email-yao dot qi at linaro dot org> <eca5a71d-867b-1f84-e66a-bca6e1e0254e at redhat dot com> <86twgxt4hg dot fsf at gmail dot com> <f5c12eca-f7f4-c953-bbb6-469e6b8cc8c5 at redhat dot com> <86porkt3yy dot fsf at gmail dot com>
On 06/14/2016 12:16 PM, Yao Qi wrote:
>> >
>>> >> I think
>>> >> they've already covered by gdb.base/step-over-syscall.exp.
>> >
>> > In that case, shouldn't we be extending that test instead?
> OK, I extend step-over-syscall.exp by setting different
> combinations of follow-fork and detach-on-fork modes, and it still can
> trigger GDBserver internal errors. How about the patch below?
Fine with me. One suggestion below.
> + foreach_with_prefix detach-on-fork {"on" "off"} {
> + foreach_with_prefix follow-fork {"parent" "child"} {
> + foreach syscall { "fork" "vfork" "clone" } {
> +
> + if { $syscall != "vfork"
> + || ${follow-fork} != "parent"
> + || ${detach-on-fork} != "off" } {
> + # Both vforked child process and parent process are
> + # under GDB's control, but GDB follows the parent
> + # process only, which can't be run until vforked child
> + # finishes. Skip the test in this scenario.
> + break_cond_on_syscall $syscall ${follow-fork} ${detach-on-fork}
> + }
I'd suggest reversing the condition logic, making it match the
comment, like this:
if { $syscall == "vfork"
&& ${follow-fork} == "parent"
&& ${detach-on-fork} == "off" } {
# Both vforked child process and parent process are
# under GDB's control, but GDB follows the parent
# process only, which can't be run until vforked child
# finishes. Skip the test in this scenario.
continue
}
break_cond_on_syscall $syscall ${follow-fork} ${detach-on-fork}
This way makes it easier to add more "skip" conditions in the future too. E.g.,
if { $syscall == "vfork"
&& ${follow-fork} == "parent"
&& ${detach-on-fork} == "off" } {
# Both vforked child process and parent process are
# under GDB's control, but GDB follows the parent
# process only, which can't be run until vforked child
# finishes. Skip the test in this scenario.
continue
}
+ if { $syscall == "whatnot"
+ && ${follow-fork} == "parent"} {
+ # For whatever reason, this shouldn't be tested either.
+ continue
+ }
break_cond_on_syscall $syscall ${follow-fork} ${detach-on-fork}
> + }
> + }
> + }
> }
Thanks,
Pedro Alves