aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-04-24 08:02:21 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-04-24 08:02:21 +0000
commit03f2bd594285c4077619f9039748ac7389cffaef (patch)
tree051f5ae03938fcd6dc87cf08b0bfdbb8d4214281 /gdb/gdbserver/server.c
parent3b488de17a147e0a1c7e93d68c6024353a00db72 (diff)
downloadgdb-03f2bd594285c4077619f9039748ac7389cffaef.zip
gdb-03f2bd594285c4077619f9039748ac7389cffaef.tar.gz
gdb-03f2bd594285c4077619f9039748ac7389cffaef.tar.bz2
gdb/
* NEWS: Document the new gdbserver --once option. gdb/doc/ * gdb.texinfo (Starting and Stopping Trace Experiments): New anchor for disconnected tracing. (Multi-Process Mode for @code{gdbserver}): Mention --multi and extended-remote relationship. Mention --once. (TCP port allocation lifecycle of @code{gdbserver}): New. gdb/gdbserver/ * remote-utils.c (handle_accept_event): Close LISTEN_DESC only if RUN_ONCE. Comment for the LISTEN_DESC delete_file_handler call. (remote_prepare): New function with most of the TCP code from ... (remote_open): ... here. Detect PORT here unconditionally. Move also setting transport_is_reliable. * server.c (run_once): New variable. (gdbserver_usage): Document it. (main): Set run_once for `--once'. Call remote_prepare. Exit after the first run if RUN_ONCE. * server.h (run_once, remote_prepare): New declarations. gdb/testsuite/ * gdb.base/solib-disc.exp: Set gdbserver_reconnect_p. * lib/gdb.exp (gdb_init): Clear gdbserver_reconnect_p. * lib/gdbserver-support.exp (gdbserver_start): Add `--once' if !gdbserver_reconnect_p.. (gdbserver_reconnect): Call error if !gdbserver_reconnect_p..
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 2f4484f..8b9133b 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -40,6 +40,9 @@ static int extended_protocol;
static int response_needed;
static int exit_requested;
+/* --once: Exit after the first connection has closed. */
+int run_once;
+
int multi_process;
int non_stop;
@@ -2312,7 +2315,9 @@ gdbserver_usage (FILE *stream)
" --debug Enable general debugging output.\n"
" --remote-debug Enable remote protocol debugging output.\n"
" --version Display version information and exit.\n"
- " --wrapper WRAPPER -- Run WRAPPER to start new programs.\n");
+ " --wrapper WRAPPER -- Run WRAPPER to start new programs.\n"
+ " --once Exit after the first connection has "
+ "closed.\n");
if (REPORT_BUGS_TO[0] && stream == stdout)
fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO);
}
@@ -2536,6 +2541,8 @@ main (int argc, char *argv[])
}
}
}
+ else if (strcmp (*next_arg, "--once") == 0)
+ run_once = 1;
else
{
fprintf (stderr, "Unknown argument: %s\n", *next_arg);
@@ -2648,6 +2655,8 @@ main (int argc, char *argv[])
exit (1);
}
+ remote_prepare (port);
+
while (1)
{
noack_mode = 0;
@@ -2676,7 +2685,7 @@ main (int argc, char *argv[])
getpkt to fail; close the connection and reopen it at the
top of the loop. */
- if (exit_requested)
+ if (exit_requested || run_once)
{
detach_or_kill_for_exit ();
exit (0);