public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: "周春明(日月)" <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>
Subject: Re: Re:Re:GDB often is blocked at async_file_flush
Date: Mon, 5 Jul 2021 13:38:27 +0100	[thread overview]
Message-ID: <bf94c6ed-aebc-dd9c-e2a1-ef53fc633bec@palves.net> (raw)
In-Reply-To: <0eb7e2ec-44d0-49dc-8765-1ef76c9f7363.riyue.zcm@alibaba-inc.com>

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.

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?

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.

  reply	other threads:[~2021-07-05 12:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 12:25 周春明(日月)
2021-07-05 12:38 ` Pedro Alves [this message]
2021-07-05 13:11   ` 回复:Re:Re:GDB " 周春明(日月)
2021-07-05 13:48     ` Pedro Alves
2021-07-05 14:06       ` 回复:回复:Re:Re:GDB " 周春明(日月)
  -- strict thread matches above, loose matches on Subject: below --
2021-07-05  5:30 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=bf94c6ed-aebc-dd9c-e2a1-ef53fc633bec@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches-bounces+riyue.zcm=alibaba-inc.com@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=riyue.zcm@alibaba-inc.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).