This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Version string added to gdbserver
- From: Girish Shilamkar <girish at linsyssoft dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 31 Jan 2006 16:30:00 +0530
- Subject: Version string added to gdbserver
Hi,
gdbserver Makefile consists of following line:
# Perhaps should come from parent Makefile
VERSION = gdbserver-4.12.3
In order to know which gdbserver is being run, the following patch
prints gdbserver version when gdbserver is started.
Should the gdb version also be displayed, from which gdbserver was
built (i.e gdb 6.4 etc), since gdbserver built from different gdb
versions may be different even if gdbserver version is same?
-Girish.
Index: gdb/gdbserver/Makefile.in
===================================================================
--- gdb.orig/gdbserver/Makefile.in 2006-01-31 14:44:32.000000000 +0530
+++ gdb/gdbserver/Makefile.in 2006-01-31 14:57:21.000000000 +0530
@@ -126,7 +126,8 @@
$(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
$(srcdir)/linux-ppc-low.c $(srcdir)/linux-ppc64-low.c \
$(srcdir)/linux-s390-low.c \
- $(srcdir)/linux-sh-low.c $(srcdir)/linux-x86-64-low.c
+ $(srcdir)/linux-sh-low.c $(srcdir)/linux-x86-64-low.c \
+ $(srcdir)/version.c
DEPFILES = @GDBSERVER_DEPFILES@
@@ -136,6 +137,7 @@
OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
utils.o \
mem-break.o \
+ version.o \
$(DEPFILES)
GDBSERVER_LIBS = @GDBSERVER_LIBS@
@@ -204,6 +206,7 @@
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 reg-cris.c reg-crisv32.c
+ rm -f version.c
maintainer-clean realclean distclean: clean
rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log
@@ -224,7 +227,8 @@
force:
version.c: Makefile
- echo 'char *version = "$(VERSION)";' >version.c
+ echo '#include "version.h"' >version.c
+ echo 'const char version[] = "$(VERSION)";' >>version.c
# GNU Make has an annoying habit of putting *all* the Makefile variables
# into the environment, unless you include this target as a circumvention.
@@ -243,7 +247,9 @@
regcache_h = $(srcdir)/regcache.h
server_h = $(srcdir)/server.h $(regcache_h) config.h $(srcdir)/target.h \
$(srcdir)/mem-break.h
+version_h = $(srcdir)/version.h
+version.o: version.c $(server_h)
inferiors.o: inferiors.c $(server_h)
mem-break.o: mem-break.c $(server_h)
proc-service.o: proc-service.c $(server_h) $(gdb_proc_service_h)
Index: gdb/gdbserver/version.h
===================================================================
--- gdb.orig/gdbserver/version.h 2006-01-31 11:29:08.772974888 +0530
+++ gdb/gdbserver/version.h 2006-01-31 15:10:21.293967032 +0530
@@ -0,0 +1,8 @@
+#ifndef VERSION_H
+#define VERSION_H
+
+/* Version number of gdbserver, as a string. */
+extern const char version[];
+
+#endif /* #ifndef VERSION_H */
+
Index: gdb/gdbserver/server.c
===================================================================
--- gdb.orig/gdbserver/server.c 2006-01-31 14:52:10.000000000 +0530
+++ gdb/gdbserver/server.c 2006-01-31 14:59:11.098852176 +0530
@@ -21,6 +21,7 @@
Boston, MA 02110-1301, USA. */
#include "server.h"
+#include "version.h"
#include <unistd.h>
#include <signal.h>
@@ -358,6 +359,8 @@
initialize_low ();
+ fprintf(stderr, "GNU %s\n",version);
+
own_buf = malloc (PBUFSIZ);
mem_buf = malloc (PBUFSIZ);