From: "周春明(日月)" <riyue.zcm@alibaba-inc.com>
To: "Pedro Alves" <pedro@palves.net>,
"Simon Marchi" <simon.marchi@polymtl.ca>,
"Gdb-patches"
<gdb-patches-bounces+riyue.zcm=alibaba-inc.com@sourceware.org>,
"gdb-patches" <gdb-patches@sourceware.org>
Subject: 回复:Re:Re:GDB often is blocked at async_file_flush
Date: Mon, 05 Jul 2021 21:11:46 +0800 [thread overview]
Message-ID: <6c63de92-1d02-47f2-bc79-d58edbf2bde1.riyue.zcm@alibaba-inc.com> (raw)
In-Reply-To: <bf94c6ed-aebc-dd9c-e2a1-ef53fc633bec@palves.net>
------------------------------------------------------------------
发件人:Pedro Alves <pedro@palves.net>
发送时间:2021年7月5日(星期一) 20:38
收件人:周春明(日月) <riyue.zcm@alibaba-inc.com>; Simon Marchi <simon.marchi@polymtl.ca>; Gdb-patches <gdb-patches-bounces+riyue.zcm=alibaba-inc.com@sourceware.org>; gdb-patches <gdb-patches@sourceware.org>
主 题:Re: Re:Re:GDB often is blocked at async_file_flush
On 2021-07-05 1:25 p.m., 周春明(日月) via Gdb-patches wrote:
> Hi Simon,
> I did more experiments today, basically I can confirm the reason of GDB stuck in that loop is the linux_nat_event_pipe[1] is closed while SIGCHLD happens.
> They are asynchronize, so the issue is random.
> But I still don't know exactly why linux_nat_event_pipe[1] is closed with unexpected. Even sometimes SIGCHLD happens at same time as below line52: target_async(0);
>
> 36| void
> 37| inferior_event_handler (enum inferior_event_type event_type)
> 38| {
> 39| switch (event_type)
> 40| {
> 41| case INF_REG_EVENT:
> 42| fetch_inferior_event ();
> 43| break;
> 44|
> 45| case INF_EXEC_COMPLETE:
> 46| if (!non_stop)
> 47| {
> 48| /* Unregister the inferior from the event loop. This is done
> 49| so that when the inferior is not running we don't get
> 50| distracted by spurious inferior output. */
> 51| if (target_has_execution && target_can_async_p ())
> 52+> target_async (0);
> 53| }
Note that linux_async_pipe closes the pipe with SIGCHLD blocked. See
block_child_signals call.
[David] Not sure:
1. SIGCHLD comes, run into below handler:
staticvoid
sigchld_handler (int signo)
{
int old_errno = errno;
if (debug_linux_nat)
gdb_stdlog->write_async_safe ("sigchld\n", sizeof ("sigchld\n") - 1);
if (signo == SIGCHLD
&& linux_nat_event_pipe[0] != -1)
async_file_mark (); /* Let the event loop know that there are
events to handle. */
errno = old_errno;
}
When run to async_file_mark, Not sure where close the linux_nat_event_pipe[1], suddenly.
I think you mentioned you're targeting some private architecture?
Could there be some bug at the libc or kernel level with blocking signals?
This is a glibc-based system?
[David]ldd (Ubuntu GLIBC 2.23-0ubuntu11.3) 2.23
Or maybe there's some stray code elsewhere in your GDB that closes
the wrong file descriptor?
I would maybe debug gdb and put a conditional breakpoint at "close" (conditional
on the file descriptor number), trying to catch where the pipe is closed.
[David] could you detail the conditional breakpoint? I don't which variable should be used for close. "b close if xxx==12" ?
next prev parent reply other threads:[~2021-07-05 13:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 12:25 Re:Re:GDB " 周春明(日月)
2021-07-05 12:38 ` Pedro Alves
2021-07-05 13:11 ` 周春明(日月) [this message]
2021-07-05 13:48 ` 回复:Re:Re:GDB " Pedro Alves
2021-07-05 14:06 ` 回复:回复:Re:Re:GDB " 周春明(日月)
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=6c63de92-1d02-47f2-bc79-d58edbf2bde1.riyue.zcm@alibaba-inc.com \
--to=riyue.zcm@alibaba-inc.com \
--cc=gdb-patches-bounces+riyue.zcm=alibaba-inc.com@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).