Re: [PATCH v4 6/7] Remote follow vfork

Pedro Alves
2015-02-10T16:39:23Z

Hi Don,

No major comments here, other than what's been said in
previous patches. A couple remarks only.

On 01/25/2015 09:46 PM, Don Breazeal wrote:
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -1481,7 +1481,10 @@ remote_follow_fork (struct target_ops *target, int follow_child,
> pid_t child_pid;
>
> gdb_assert ((inferior_thread ()->pending_follow.kind
> - == TARGET_WAITKIND_FORKED));
> + == TARGET_WAITKIND_FORKED)
> + || (inferior_thread ()->pending_follow.kind
> + == TARGET_WAITKIND_VFORKED));
> +

Please use a temporary variable, something like:

kind = inferior_thread ()->pending_follow.kind
gdb_assert (kind == TARGET_WAITKIND_FORKED)
|| (kind == TARGET_WAITKIND_VFORKED));

Makes it easier to debug a core dump caused by this assert.

> child_ptid = inferior_thread ()->pending_follow.value.related_pid;
> child_pid = ptid_get_pid (child_ptid);
>
> @@ -4502,7 +4505,8 @@ remote_detach_1 (struct target_ops *ops, const char *args,
> {
> inferior_ptid = null_ptid;
> detach_inferior (pid);
> - inf_child_maybe_unpush_target (ops);
> + if (!extended)
> + inf_child_maybe_unpush_target (ops);

Hmm, I'm afraid I don't understand why is this part of this patch?

Thanks,
Pedro Alves