diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-02-01 21:37:21 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-02-01 21:37:21 +0000 |
commit | dd24457ddffffda0617dda1beb6f21cf6bd87901 (patch) | |
tree | 97785d1ddd96d3a5b510b9cb7e0cd177692612f6 /gdb/gdbserver/server.c | |
parent | 6b31ad165d5b94d0a207bc2eab1855599a81033b (diff) | |
download | gdb-dd24457ddffffda0617dda1beb6f21cf6bd87901.zip gdb-dd24457ddffffda0617dda1beb6f21cf6bd87901.tar.gz gdb-dd24457ddffffda0617dda1beb6f21cf6bd87901.tar.bz2 |
* Makefile.in (OBS): Add version.o.
(STAGESTUFF): Delete.
(version.o): Add dependencies.
(version.c): Replace rule.
(clean): Remove version.c.
* server.c (gdbserver_version): New.
(gdbserver_usage): Use printf.
(main): Handle --version and --help.
* server.h (version, host_name): Add declarations.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r-- | gdb/gdbserver/server.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index fc90e74..9ea2b72 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1,6 +1,6 @@ /* Main code for remote server for GDB. Copyright (C) 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004, - 2005 + 2005, 2006 Free Software Foundation, Inc. This file is part of GDB. @@ -309,13 +309,23 @@ myresume (int step, int sig) static int attached; static void +gdbserver_version (void) +{ + printf ("GNU gdbserver %s\n" + "Copyright (C) 2006 Free Software Foundation, Inc.\n" + "gdbserver is free software, covered by the GNU General Public License.\n" + "This gdbserver was configured as \"%s\"\n", + version, host_name); +} + +static void gdbserver_usage (void) { - error ("Usage:\tgdbserver COMM PROG [ARGS ...]\n" - "\tgdbserver COMM --attach PID\n" - "\n" - "COMM may either be a tty device (for serial debugging), or \n" - "HOST:PORT to listen for a TCP connection.\n"); + printf ("Usage:\tgdbserver COMM PROG [ARGS ...]\n" + "\tgdbserver COMM --attach PID\n" + "\n" + "COMM may either be a tty device (for serial debugging), or \n" + "HOST:PORT to listen for a TCP connection.\n"); } int @@ -331,6 +341,18 @@ main (int argc, char *argv[]) int pid; char *arg_end; + if (argc >= 2 && strcmp (argv[1], "--version") == 0) + { + gdbserver_version (); + exit (0); + } + + if (argc >= 2 && strcmp (argv[1], "--help") == 0) + { + gdbserver_usage (); + exit (0); + } + if (setjmp (toplevel)) { fprintf (stderr, "Exiting\n"); @@ -354,7 +376,10 @@ main (int argc, char *argv[]) } if (argc < 3 || bad_attach) - gdbserver_usage(); + { + gdbserver_usage (); + exit (1); + } initialize_low (); |