From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>,
Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org, Simon Marchi <simon.marchi@ericsson.com>
Subject: Re: [Regression] Segfault on native-extended-gdbserver + fork
Date: Mon, 29 Jan 2018 16:01:00 -0000 [thread overview]
Message-ID: <669ec8c3-caa3-6901-b26c-00a7e20bc0d1@redhat.com> (raw)
In-Reply-To: <931f8b594f7405649778f66ab2960a40@polymtl.ca>
On 01/28/2018 04:50 PM, Simon Marchi wrote:
> On 2018-01-28 01:32, Sergio Durigan Junior wrote:
> I'm fine with this, but I was curious about what happens in Pedro's multi-target branch. I remember he said that the detach_inferior(int) version disappears in that branch, though I can't find where he said that. But looking at the branch I can see it's indeed the case:
>
> Â https://github.com/palves/gdb/blob/palves/multi-target/gdb/inferior.c#L250
>
> So I was wondering what remote_follow_fork calls in that case, since it can't call the detach_inferior(inferior *) version without an inferior. Apparently it calls a new remote_detach_pid function:
>
> Â https://github.com/palves/gdb/blob/palves/multi-target/gdb/remote.c#L5859
remote_detach_pid is not new. It exists in master. What that url shows
is that I commented out the detach_inferior call in the branch.
Because in this case, we'd detaching a remote process that the core
of gdb never learned about.
>
> This means (I just tried it) that it won't show the "[Inferior %d detached]\n" message in that case. So what I would suggest is putting
>
> Â if (print_inferior_events)
> Â Â Â printf_unfiltered (_("[Inferior %d detached]\n"), pid);
>
> in its own function, called by both versions of detach_inferior for now (bonus, it de-duplicates the printing of the message). In the multi-target branch, remote_target::follow_fork (renamed from remote_follow_fork) can call this function in the case where we don't have an inferior object.
But why would we want to print that? We will have already printed
"Detaching after fork from child process PID."
from the common code. When native debugging, in this scenario,
we don't call detach_inferior either, right? Can't see why
we'd want to call it for remote.
I think we should just remove that detach_inferior call, like in
the multi-target branch.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2018-01-29 16:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 16:16 [PATCH v2 1/3] Remove args from target detach Simon Marchi
2018-01-19 16:16 ` [PATCH v2 2/3] Pass inferior down to target_detach and to_detach Simon Marchi
2018-01-19 16:16 ` [PATCH v2 3/3] Make linux_nat_detach/thread_db_detach use the inferior parameter Simon Marchi
2018-01-28 6:32 ` [Regression] Segfault on native-extended-gdbserver + fork (was: Re: [PATCH v2 3/3] Make linux_nat_detach/thread_db_detach use the inferior parameter) Sergio Durigan Junior
2018-01-28 16:50 ` [Regression] Segfault on native-extended-gdbserver + fork Simon Marchi
2018-01-29 16:01 ` Pedro Alves [this message]
2018-01-29 16:25 ` Simon Marchi
2018-01-29 16:58 ` Pedro Alves
2018-01-29 17:04 ` Simon Marchi
2018-01-29 17:31 ` Pedro Alves
2018-01-29 17:36 ` Pedro Alves
[not found] ` <87mv0w8tnr.fsf@redhat.com>
2018-01-29 17:36 ` Sergio Durigan Junior
2018-01-29 17:47 ` Pedro Alves
2018-01-29 18:06 ` Sergio Durigan Junior
2018-01-19 16:35 ` [PATCH v2 1/3] Remove args from target detach Pedro Alves
2018-01-19 16:57 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=669ec8c3-caa3-6901-b26c-00a7e20bc0d1@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=sergiodj@redhat.com \
--cc=simon.marchi@ericsson.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox