Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Marc Khouzam <marc.khouzam@ericsson.com>
Cc: "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>
Subject: Re: [Patch] Broken multi-process detach
Date: Mon, 16 Jul 2012 17:49:00 -0000	[thread overview]
Message-ID: <50044E25.70301@redhat.com> (raw)
In-Reply-To: <F7CE05678329534C957159168FA70DEC5979611424@EUSAACMS0703.eamcs.ericsson.se>

On 07/16/2012 02:54 PM, Marc Khouzam wrote:
> Hi,
> 
> Detaching from an inferior in multi-process is broken.
> The problem seems to be that in linux_nat.c:linux_nat_detach()
> GDB first unregisters from the event loop by calling 
> linux_nat_async (NULL, 0).  In multi-process, further
> events received from running inferiors are missed; breakpoint
> hits are not reported, interrupting a thread is not reported,
> and so on.  See below for a broken session example.
> 
> We could remove the call to linux_nat_async (NULL, 0) but I didn't
> know if that would have bad side-effects.  Here is the patch that
> does that, if it is felt that is the correct solution.

I'm not thinking of any.  Looks like I added it in the first
async mode version of linux-nat.c (which was much rewritten
later on).  Let's remove it.

Remove also the target_async call below:

  if (forks_exist_p ())
    {
      /* Multi-fork case.  The current inferior_ptid is being detached
	 from, but there are other viable forks to debug.  Detach from
	 the current fork, and context-switch to the first
	 available.  */
      linux_fork_detach (args, from_tty);

      if (non_stop && target_can_async_p ())
 	target_async (inferior_event_handler, 0);


as this was re-installing the target on the event loop if there were
other checkpoints (checkpoint/info checkpoint) to debug.  It is now
unnecessary if we don't unregister from the event loop in the first place.

> 
> The testsuite hangs on HEAD so I wasn't able to run it yet.
> But I'll do so once it works again.

It doesn't hang for me.  I've tested the patch on x86_64 Fedora 17, both
sync and async modes.  No regressions.

Thanks!

-- 
Pedro Alves


  reply	other threads:[~2012-07-16 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16 13:54 Marc Khouzam
2012-07-16 17:49 ` Pedro Alves [this message]
2012-07-16 19:08   ` Marc Khouzam

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=50044E25.70301@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.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