public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug server/16359] New: gdbserver needs to handle gdb going away more robustly
Date: Fri, 20 Dec 2013 20:09:00 -0000	[thread overview]
Message-ID: <bug-16359-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=16359

            Bug ID: 16359
           Summary: gdbserver needs to handle gdb going away more robustly
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: server
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

gdbserver --multi, target extended-remote, amd64-linux

If you kill -9 gdb (as a proxy for gdb being terminated for unexpected
reasons), gdbserver will arrive here:

static void
input_interrupt (int unused)
{
  fd_set readset;
  struct timeval immediate = { 0, 0 };

  /* Protect against spurious interrupts.  This has been observed to            
     be a problem under NetBSD 1.4 and 1.5.  */

  FD_ZERO (&readset);
  FD_SET (remote_desc, &readset);
  if (select (remote_desc + 1, &readset, 0, 0, &immediate) > 0)
    {
      int cc;
      char c = 0;

      cc = read_prim (&c, 1);

      if (cc != 1 || c != '\003' || current_inferior == NULL)
        {
          fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n",
                   cc, c, c);
          return;
        }

      (*the_target->request_interrupt) ();
    }
}

and print:

input_interrupt, count = 0 c = 0 ('^@')

Subsequent connection attempts from gdb do not succeed.
gdbserver could handle this more robustly by detecting EOF and treating it like
any other disconnect (detaching from inferior and going back to waiting for a
connection).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2013-12-20 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 20:09 dje at google dot com [this message]
2014-04-17 16:10 ` [Bug server/16359] " rtaylor at synopsys dot com

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=bug-16359-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).