(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.
+2006-02-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * 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.
+
2005-12-23 Eli Zaretskii <eliz@gnu.org>
* linux-arm-low.c:
# Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-# 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
# This file is part of GDB.
TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
- utils.o \
+ utils.o version.o \
mem-break.o \
$(DEPFILES)
GDBSERVER_LIBS = @GDBSERVER_LIBS@
clean:
rm -f *.o ${ADD_FILES} *~
+ rm -f version.c
rm -f gdbserver gdbreplay core make.log
rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c reg-mips.c
rm -f reg-ppc.c reg-sh.c reg-x86-64.c reg-i386-linux.c
rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log
rm -f Makefile
-STAGESTUFF=${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} init.c init.o version.c gdb
-
config.h: stamp-h ; @true
stamp-h: config.in config.status
CONFIG_FILES="" CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
force:
-version.c: Makefile
- echo 'char *version = "$(VERSION)";' >version.c
+version.c: Makefile $(srcdir)/../version.in
+ rm -f version.c-tmp version.c
+ echo '#include "server.h"' >> version.c-tmp
+ echo 'const char version[] = "'"`sed q ${srcdir}/../version.in`"'";' >> version.c-tmp
+ echo 'const char host_name[] = "$(host_alias)";' >> version.c-tmp
+ mv version.c-tmp version.c
+version.o: version.c $(server_h)
# GNU Make has an annoying habit of putting *all* the Makefile variables
# into the environment, unless you include this target as a circumvention.
/* 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.
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
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");
}
if (argc < 3 || bad_attach)
- gdbserver_usage();
+ {
+ gdbserver_usage ();
+ exit (1);
+ }
initialize_low ();
? (registers_length () + 32) \
: 2000)
+/* Version information, from version.c. */
+extern const char version[];
+extern const char host_name[];
+
#endif /* SERVER_H */