This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
--with-pkgversion and --with-bugurl support for GDB
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 19 May 2008 17:06:55 +0000 (UTC)
- Subject: --with-pkgversion and --with-bugurl support for GDB
This patch adds support for the --with-pkgversion and --with-bugurl
configure options to GDB. These options are used to specify a version and
bug-reporting URL for a packaged version of GDB, and are supported by GCC
and GNU Binutils using the same configure macros as this patch makes GDB
use.
A previous version was submitted by Vladimir in 2006
<http://sourceware.org/ml/gdb-patches/2006-07/msg00171.html>; since
then, the feature has been added to GCC and GNU Binutils as noted
above, so addressing
<http://sourceware.org/ml/gdb-patches/2006-07/msg00173.html> which was
the only comment on the previous patch.
This patch deals with GDB proper, the manual, gdbserver and gdbreplay
(to which previously missing --version and --help support is added).
We have a patch for the simulators as well, but I'd like to resolve
any issues with this patch before preparing that one for submission.
Tested on i686-pc-linux-gnu. OK to commit?
2008-05-19 Vladimir Prus <vladimir@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* acinclude.m4: Include ../config/acx.m4.
* configure.ac: Use ACX_PKGVERSION and ACX_BUGURL.
* configure: Regenerate.
* Makefile.in (PKGVERSION, REPORT_BUGS_TO): Define.
(GDB_CFLAGS): Define to include PKGVERSION and REPORT_BUGS_TO
settings.
* main.c (print_gdb_help): Use REPORT_BUGS_TO for bug-reporting
address.
* top.c (print_gdb_version): Use PKGVERSION and REPORT_BUGS_TO.
doc:
2008-05-19 Vladimir Prus <vladimir@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure.ac: Include ../../config/acx.m4. Use ACX_PKGVERSION
and ACX_BUGURL.
* configure: Regenerate.
* Makefile.in (PKGVERSION, BUGURL_TEXI): Define.
(GDBvn.texi): Define VERSION_PACKAGE and BUGURL.
* gdb.texinfo: Use VERSION_PACKAGE and BUGURL. Remove
mailing-list-specific text about bug reporting.
gdbserver:
2008-05-19 Vladimir Prus <vladimir@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* acinclude.m4: Include ../../config/acx.m4.
* configure.ac: Use ACX_PKGVERSION and ACX_BUGURL.
* configure: Regenerate.
* Makefile.in (PKGVERSION, REPORT_BUGS_TO): New.
(GLOBAL_CFLAGS): Add them.
(gdbreplay$(EXEEXT)): Add version.o.
* server.c (gdbserver_version): Print PKGVERSION.
(gdbsrever_usage): Add stream parameter. Print REPORT_BUGS_TO.
(main): Adjust gdbserver_usage calls.
* gdbreplay.c (version, host_name): Add declarations.
(gdbreplay_version, gdbreplay_usage): New.
(main): Accept --version and --help options.
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1021
diff -u -p -r1.1021 Makefile.in
--- gdb/Makefile.in 16 May 2008 12:51:21 -0000 1.1021
+++ gdb/Makefile.in 19 May 2008 15:50:41 -0000
@@ -348,7 +348,11 @@ CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
# your system doesn't have fcntl.h in /usr/include (which is where it
# should be according to Posix).
DEFS = @DEFS@
-GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config -DLOCALEDIR="\"$(localedir)\"" $(DEFS)
+PKGVERSION := "\"@PKGVERSION@\""
+REPORT_BUGS_TO = "\"@REPORT_BUGS_TO@\""
+GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config \
+ -DLOCALEDIR="\"$(localedir)\"" -DPKGVERSION=$(PKGVERSION) \
+ -DREPORT_BUGS_TO=$(REPORT_BUGS_TO) $(DEFS)
# MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory.
GLOBAL_CFLAGS = $(MH_CFLAGS)
Index: gdb/acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.18
diff -u -p -r1.18 acinclude.m4
--- gdb/acinclude.m4 23 Apr 2008 12:21:47 -0000 1.18
+++ gdb/acinclude.m4 19 May 2008 15:50:42 -0000
@@ -20,6 +20,9 @@ sinclude(../config/lib-ld.m4)
sinclude(../config/lib-prefix.m4)
sinclude(../config/lib-link.m4)
+dnl For ACX_PKGVERSION and ACX_BUGURL.
+sinclude(../config/acx.m4)
+
#
# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
# makes configure think it's cross compiling. If --target wasn't used, then
Index: gdb/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.68
diff -u -p -r1.68 configure.ac
--- gdb/configure.ac 19 Apr 2008 05:06:54 -0000 1.68
+++ gdb/configure.ac 19 May 2008 15:50:44 -0000
@@ -362,6 +362,9 @@ if test "$enable_profiling" = yes ; then
CFLAGS="$OLD_CFLAGS"
fi
+ACX_PKGVERSION([GDB])
+ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
+
# --------------------- #
# Checks for programs. #
# --------------------- #
Index: gdb/main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.67
diff -u -p -r1.67 main.c
--- gdb/main.c 14 Mar 2008 17:21:07 -0000 1.67
+++ gdb/main.c 19 May 2008 15:50:44 -0000
@@ -966,6 +966,9 @@ Options:\n\n\
fputs_unfiltered (_("\n\
For more information, type \"help\" from within GDB, or consult the\n\
GDB manual (available as on-line info or a printed manual).\n\
-Report bugs to \"bug-gdb@gnu.org\".\
"), stream);
+ if (REPORT_BUGS_TO[0] && stream == gdb_stdout)
+ fprintf_unfiltered (stream, _("\
+Report bugs to \"%s\".\n\
+"), REPORT_BUGS_TO);
}
Index: gdb/top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.141
diff -u -p -r1.141 top.c
--- gdb/top.c 5 May 2008 09:47:46 -0000 1.141
+++ gdb/top.c 19 May 2008 15:50:45 -0000
@@ -1125,7 +1125,7 @@ print_gdb_version (struct ui_file *strea
program to parse, and is just canonical program name and version
number, which starts after last space. */
- fprintf_filtered (stream, "GNU gdb %s\n", version);
+ fprintf_filtered (stream, "GNU gdb %s%s\n", PKGVERSION, version);
/* Second line is a copyright notice. */
@@ -1154,6 +1154,12 @@ and \"show warranty\" for details.\n");
fprintf_filtered (stream, "%s", host_name);
}
fprintf_filtered (stream, "\".");
+
+#ifdef REPORT_BUGS_TO
+ fprintf_filtered (stream,
+ _("\nFor bug reporting instructions, please see:\n"));
+ fprintf_filtered (stream, "%s.\n", REPORT_BUGS_TO);
+#endif
}
/* get_prompt: access method for the GDB prompt string. */
Index: gdb/doc/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/doc/Makefile.in,v
retrieving revision 1.41
diff -u -p -r1.41 Makefile.in
--- gdb/doc/Makefile.in 1 Jan 2008 22:53:14 -0000 1.41
+++ gdb/doc/Makefile.in 19 May 2008 15:50:45 -0000
@@ -61,6 +61,10 @@ TEXI2ROFF=texi2roff
# where to find texi2dvi, ditto
TEXI2DVI=texi2dvi
+# Package version and bug-reporting URL.
+PKGVERSION = @PKGVERSION@
+BUGURL_TEXI = @REPORT_BUGS_TEXI@
+
# Where is the source dir for the READLINE library doc?
# Traditionally readline is in .. or .
READLINE_DIR = ${gdbdir}/../readline/doc
@@ -279,6 +283,10 @@ refcard.pdf : refcard.tex $(REFEDITS)
# File to record current GDB version number (copied from main dir version.in)
GDBvn.texi : ${gdbdir}/version.in
echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
+ if [ -n "$(PKGVERSION)" ]; then \
+ echo "@set VERSION_PACKAGE $(PKGVERSION)" >> ./GDBvn.new; \
+ fi
+ echo "@set BUGURL $(BUGURL_TEXI)" >> ./GDBvn.new
mv GDBvn.new GDBvn.texi
# Updated atomically
Index: gdb/doc/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/doc/configure.ac,v
retrieving revision 1.1
diff -u -p -r1.1 configure.ac
--- gdb/doc/configure.ac 7 Jan 2005 21:53:22 -0000 1.1
+++ gdb/doc/configure.ac 19 May 2008 15:50:45 -0000
@@ -1,5 +1,8 @@
AC_PREREQ(2.59)
AC_INIT(refcard.tex)
+sinclude(../../config/acx.m4)
AC_PROG_INSTALL
AC_PROG_LN_S
+ACX_PKGVERSION([GDB])
+ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
AC_OUTPUT(Makefile)
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.495
diff -u -p -r1.495 gdb.texinfo
--- gdb/doc/gdb.texinfo 9 May 2008 17:02:01 -0000 1.495
+++ gdb/doc/gdb.texinfo 19 May 2008 15:50:51 -0000
@@ -49,6 +49,9 @@ This file documents the @sc{gnu} debugge
This is the @value{EDITION} Edition, of @cite{Debugging with
@value{GDBN}: the @sc{gnu} Source-Level Debugger} for @value{GDBN}
+@ifset VERSION_PACKAGE
+@value{VERSION_PACKAGE}
+@end ifset
Version @value{GDBVN}.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,@*
@@ -72,11 +75,15 @@ developing GNU and promoting software fr
@subtitle The @sc{gnu} Source-Level Debugger
@sp 1
@subtitle @value{EDITION} Edition, for @value{GDBN} version @value{GDBVN}
+@ifset VERSION_PACKAGE
+@sp 1
+@subtitle @value{VERSION_PACKAGE}
+@end ifset
@author Richard Stallman, Roland Pesch, Stan Shebs, et al.
@page
@tex
{\parskip=0pt
-\hfill (Send bugs and comments on @value{GDBN} to bug-gdb\@gnu.org.)\par
+\hfill (Send bugs and comments on @value{GDBN} to @value{BUGURL}.)\par
\hfill {\it Debugging with @value{GDBN}}\par
\hfill \TeX{}info \texinfoversion\par
}
@@ -116,8 +123,11 @@ software in general. We will miss him.
This file describes @value{GDBN}, the @sc{gnu} symbolic debugger.
-This is the @value{EDITION} Edition, for @value{GDBN} Version
-@value{GDBVN}.
+This is the @value{EDITION} Edition, for @value{GDBN}
+@ifset VERSION_PACKAGE
+@value{VERSION_PACKAGE}
+@end ifset
+Version @value{GDBVN}.
Copyright (C) 1988-2006 Free Software Foundation, Inc.
@@ -22632,25 +22642,10 @@ individuals in the file @file{etc/SERVIC
distribution.
@c should add a web page ref...
+@ifset BUGURL
In any event, we also recommend that you submit bug reports for
-@value{GDBN}. The preferred method is to submit them directly using
-@uref{http://www.gnu.org/software/gdb/bugs/, @value{GDBN}'s Bugs web
-page}. Alternatively, the @email{bug-gdb@@gnu.org, e-mail gateway} can
-be used.
-
-@strong{Do not send bug reports to @samp{info-gdb}, or to
-@samp{help-gdb}, or to any newsgroups.} Most users of @value{GDBN} do
-not want to receive bug reports. Those that do have arranged to receive
-@samp{bug-gdb}.
-
-The mailing list @samp{bug-gdb} has a newsgroup @samp{gnu.gdb.bug} which
-serves as a repeater. The mailing list and the newsgroup carry exactly
-the same messages. Often people think of posting bug reports to the
-newsgroup instead of mailing them. This appears to work, but it has one
-problem which can be crucial: a newsgroup posting often lacks a mail
-path back to the sender. Thus, if we need to ask for more information,
-we may be unable to reach you. For this reason, it is better to send
-bug reports to the mailing list.
+@value{GDBN} to @value{BUGURL}.
+@end ifset
The fundamental principle of reporting bugs usefully is this:
@strong{report all the facts}. If you are not sure whether to state a
Index: gdb/gdbserver/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/Makefile.in,v
retrieving revision 1.58
diff -u -p -r1.58 Makefile.in
--- gdb/gdbserver/Makefile.in 3 May 2008 17:16:43 -0000 1.58
+++ gdb/gdbserver/Makefile.in 19 May 2008 15:50:51 -0000
@@ -87,9 +87,13 @@ READLINE_DEP = $$(READLINE_DIR)
# -I$(srcdir)/../regformats for regdef.h.
INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR)
+PKGVERSION := "\"@PKGVERSION@\""
+REPORT_BUGS_TO = "\"@REPORT_BUGS_TO@\""
+
# M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
# from the config/ directory.
-GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
+GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS} -DPKGVERSION=$(PKGVERSION) \
+ -DREPORT_BUGS_TO=$(REPORT_BUGS_TO)
#PROFILE_CFLAGS = -pg
WARN_CFLAGS = -Wall
@@ -194,9 +198,9 @@ gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} $
${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
$(GDBSERVER_LIBS) $(XM_CLIBS)
-gdbreplay$(EXEEXT): gdbreplay.o
+gdbreplay$(EXEEXT): gdbreplay.o version.o
rm -f gdbreplay$(EXEEXT)
- ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) gdbreplay.o \
+ ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $^ \
$(XM_CLIBS)
# Put the proper machine-specific files first, so M-. on a machine
Index: gdb/gdbserver/acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/acinclude.m4,v
retrieving revision 1.6
diff -u -p -r1.6 acinclude.m4
--- gdb/gdbserver/acinclude.m4 23 Apr 2008 12:21:50 -0000 1.6
+++ gdb/gdbserver/acinclude.m4 19 May 2008 15:50:51 -0000
@@ -4,6 +4,9 @@ sinclude(../../bfd/bfd.m4)
dnl This gets autoconf bugfixes
sinclude(../../config/override.m4)
+dnl For ACX_PKGVERSION and ACX_BUGURL.
+sinclude(../../config/acx.m4)
+
AC_DEFUN([SRV_CHECK_THREAD_DB],
[AC_CACHE_CHECK([for libthread_db],[srv_cv_thread_db],
[old_LIBS="$LIBS"
Index: gdb/gdbserver/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.22
diff -u -p -r1.22 configure.ac
--- gdb/gdbserver/configure.ac 14 Apr 2008 18:04:00 -0000 1.22
+++ gdb/gdbserver/configure.ac 19 May 2008 15:50:52 -0000
@@ -68,6 +68,9 @@ AC_CHECK_TYPES(socklen_t, [], [],
#include <sys/socket.h>
])
+ACX_PKGVERSION([GDB])
+ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
+
. ${srcdir}/configure.srv
if test "${srv_mingwce}" = "yes"; then
Index: gdb/gdbserver/gdbreplay.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/gdbreplay.c,v
retrieving revision 1.16
diff -u -p -r1.16 gdbreplay.c
--- gdb/gdbserver/gdbreplay.c 1 Jan 2008 22:53:14 -0000 1.16
+++ gdb/gdbserver/gdbreplay.c 19 May 2008 15:50:52 -0000
@@ -69,6 +69,10 @@ typedef int socklen_t;
/* Sort of a hack... */
#define EOL (EOF - 1)
+/* Version information, from version.c. */
+extern const char version[];
+extern const char host_name[];
+
static int remote_desc;
#ifdef __MINGW32CE__
@@ -387,16 +391,44 @@ play (FILE *fp)
}
}
+static void
+gdbreplay_version (void)
+{
+ printf ("GNU gdbreplay %s%s\n"
+ "Copyright (C) 2008 Free Software Foundation, Inc.\n"
+ "gdbserver is free software, covered by the GNU General Public License.\n"
+ "This gdbserver was configured as \"%s\"\n",
+ PKGVERSION, version, host_name);
+}
+
+static void
+gdbreplay_usage (FILE *stream)
+{
+ fprintf (stream, "Usage:\tgdbreplay <logfile> <host:port>\n");
+ if (REPORT_BUGS_TO[0] && stream == stdout)
+ fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO);
+}
+
int
main (int argc, char *argv[])
{
FILE *fp;
int ch;
+ if (argc >= 2 && strcmp (argv[1], "--version") == 0)
+ {
+ gdbreplay_version ();
+ exit (0);
+ }
+ if (argc >= 2 && strcmp (argv[1], "--help") == 0)
+ {
+ gdbreplay_usage (stdout);
+ exit (0);
+ }
+
if (argc < 3)
{
- fprintf (stderr, "Usage: gdbreplay <logfile> <host:port>\n");
- fflush (stderr);
+ gdbreplay_usage (stderr);
exit (1);
}
fp = fopen (argv[1], "r");
Index: gdb/gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.72
diff -u -p -r1.72 server.c
--- gdb/gdbserver/server.c 9 May 2008 17:37:36 -0000 1.72
+++ gdb/gdbserver/server.c 19 May 2008 15:50:52 -0000
@@ -1178,26 +1178,28 @@ myresume (char *own_buf, int step, int *
static void
gdbserver_version (void)
{
- printf ("GNU gdbserver %s\n"
+ printf ("GNU gdbserver %s%s\n"
"Copyright (C) 2007 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);
+ PKGVERSION, version, host_name);
}
static void
-gdbserver_usage (void)
+gdbserver_usage (FILE *stream)
{
- printf ("Usage:\tgdbserver [OPTIONS] COMM PROG [ARGS ...]\n"
- "\tgdbserver [OPTIONS] --attach COMM PID\n"
- "\tgdbserver [OPTIONS] --multi COMM\n"
- "\n"
- "COMM may either be a tty device (for serial debugging), or \n"
- "HOST:PORT to listen for a TCP connection.\n"
- "\n"
- "Options:\n"
- " --debug\t\tEnable debugging output.\n"
- " --wrapper WRAPPER --\tRun WRAPPER to start new programs.\n");
+ fprintf (stream, "Usage:\tgdbserver [OPTIONS] COMM PROG [ARGS ...]\n"
+ "\tgdbserver [OPTIONS] --attach COMM PID\n"
+ "\tgdbserver [OPTIONS] --multi COMM\n"
+ "\n"
+ "COMM may either be a tty device (for serial debugging), or \n"
+ "HOST:PORT to listen for a TCP connection.\n"
+ "\n"
+ "Options:\n"
+ " --debug\t\tEnable debugging output.\n"
+ " --wrapper WRAPPER --\tRun WRAPPER to start new programs.\n");
+ if (REPORT_BUGS_TO[0] && stream == stdout)
+ fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO);
}
#undef require_running
@@ -1234,7 +1236,7 @@ main (int argc, char *argv[])
}
else if (strcmp (*next_arg, "--help") == 0)
{
- gdbserver_usage ();
+ gdbserver_usage (stdout);
exit (0);
}
else if (strcmp (*next_arg, "--attach") == 0)
@@ -1251,7 +1253,7 @@ main (int argc, char *argv[])
if (next_arg == wrapper_argv || *next_arg == NULL)
{
- gdbserver_usage ();
+ gdbserver_usage (stderr);
exit (1);
}
@@ -1280,7 +1282,7 @@ main (int argc, char *argv[])
next_arg++;
if (port == NULL || (!attach && !multi_mode && *next_arg == NULL))
{
- gdbserver_usage ();
+ gdbserver_usage (stderr);
exit (1);
}
@@ -1305,7 +1307,7 @@ main (int argc, char *argv[])
if (bad_attach)
{
- gdbserver_usage ();
+ gdbserver_usage (stderr);
exit (1);
}
--
Joseph S. Myers
joseph@codesourcery.com