gdb: imply --once if connecting via stdio

Currently, gdbserver hangs after stdin is closed while it tries to
write: "Remote side has terminated connection.  GDBserver will reopen
the connection." This hang disappears if --once is also given. Since
the stdin connection won't ever reopen if it's closed, it's safe to
assume --once is desired.

The gdb.server/server-pipe.exp test was also updated to reflect this
change. There is now a second disconnect at the end of the proc,
with a tighter-than-normal timeout to catch if the command hangs as
it used to.

Co-Authored-By: Guinevere Larsen <blarsen@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29796

Approved-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
William Ferreira
2024-07-18 16:38:31 -03:00
committed by Andrew Burgess
parent 0891970109
commit a733b2c904
2 changed files with 16 additions and 1 deletions

View File

@@ -4209,6 +4209,10 @@ captured_main (int argc, char *argv[])
/* "-" specifies a stdio connection and is a form of port
specification. */
port = STDIO_CONNECTION_NAME;
/* Implying --once here prevents a hang after stdin has been closed. */
run_once = true;
next_arg++;
break;
}