From: Jim Chen <nchen@mozilla.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [GDBServer] Send SIGINT using process group ID
Date: Thu, 19 May 2016 16:01:00 -0000 [thread overview]
Message-ID: <562afb38-a633-95c1-5b49-cf2e02454edb@mozilla.com> (raw)
In-Reply-To: <fed7cbcf-3561-aeca-1dba-841de62258c4@redhat.com>
The use case was attaching, like you mentioned, on Android. And I just
found PR/18945 [1], which describes the problem. I now see that my patch
is not a good solution either because on Android, the pgid is the zygote
process, and all running apps on the system belong to that group.
Seems like the best solution is to handle attaching separately? Or maybe
send SIGINT to the process first, and if that fails, send it to the
process group, in order to address the original bug of a dead main
thread when pausing?
Thanks,
Jim
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=18945
On 5/18/2016 8:10 AM, Pedro Alves wrote:
> On 05/11/2016 10:51 PM, Jim Chen wrote:
>> Hi,
>>
>> linux_request_interrupt is supposed to send SIGINT to the process group,
>> but it passes the process ID to kill() instead of the process group ID,
>> which may not be the same as the process ID.
>> The patch calls getpgid
>> first to get the process group ID.
>>
>> Patch tested on arm-linux.
>
> Can you expand on the use case you see this happening on, please?
> I can imagine some, but I'd like to hear it from you.
>
> Some have expressed desire to _not_ send the SIGINT to the whole
> process group, which may make sense when you're attached to a
> process rather than having started it. IIRC, there's a bug filed in
> bugzilla about this.
>
> Looking at the code, not-sending-to-process-group-when-attached
> is what native GNU/Linux does too (inflow.c:pass_signal).
>
> Seems like "c&" -> "interrupt" doesn't consider "attach" either,
> as inf-ptrace.c:inf_ptrace_interrupt sends the SIGINT
> to the process, and like gdbserver, assumes the inferior's
> PID is the process group id.
>
> Thanks,
> Pedro Alves
>
next prev parent reply other threads:[~2016-05-19 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 21:54 [PATCH] Specify python2 or python3 as Python program name Jim Chen
2016-05-11 21:54 ` [PATCH] [GDBServer] Send SIGINT using process group ID Jim Chen
2016-05-18 12:10 ` Pedro Alves
2016-05-19 16:01 ` Jim Chen [this message]
2016-05-12 5:54 ` [PATCH] Specify python2 or python3 as Python program name Eli Zaretskii
2016-05-12 12:50 ` Yao Qi
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=562afb38-a633-95c1-5b49-cf2e02454edb@mozilla.com \
--to=nchen@mozilla.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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