This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug server/16359] New: gdbserver needs to handle gdb going away more robustly


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]