From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29513 invoked by alias); 6 Jun 2008 20:45:19 -0000 Received: (qmail 29497 invoked by uid 22791); 6 Jun 2008 20:45:17 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 06 Jun 2008 20:44:43 +0000 Received: (qmail 32501 invoked from network); 6 Jun 2008 20:44:41 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Jun 2008 20:44:41 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.68) (envelope-from ) id 1K4ing-0001tJ-Ol for gdb-patches@sourceware.org; Fri, 06 Jun 2008 20:44:40 +0000 Date: Fri, 06 Jun 2008 20:45:00 -0000 From: "Joseph S. Myers" To: gdb-patches@sourceware.org Subject: Simulators --with-pkgversion --with-bugurl support Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00123.txt.bz2 This patch adds --with-pkgversion and --with-bugurl support to the simulators. Tested for arm-none-eabi and powerpc-none-eabi. OK to commit? sim/common: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * aclocal.m4: Include ../../config/acx.m4. * common.m4: Use ACX_PKGVERSION and ACX_BUGURL. * configure, config.in: Regenerate. * Make-common.in (LIB_OBJS): Add version.o. (version.c, version.o): New rules. * run.c: Include version.h. (usage): Add help parameter. Print output either to stdout or stderr depending on that parameter. (print_version): New. (main): Check for --help and --version. * run-sim.h (sim_target_display_usage): Add help parameter. * version.h: New. sim/arm: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. * wrapper.c (sim_target_display_usage): Add help parameter. sim/cr16: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/cris: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/d10v: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/erc32: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/frv: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/h8300: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/iq2000: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/m32c: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/m32r: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/m68hc11: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/mcore: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/mips: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/mn10300: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/ppc: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure.ac: Use ACX_PKGVERSION and ACX_BUGURL. * configure, config.in: Regenerated. * Makefile.in (LIB_OBJ): Add version.o. (version.c, version.o): New rules. * psim.c (psim_usage): Add help parameter. Print the bug URL. Exit with code 0 for help. (psim_options): Update calls to psim_usage. Handle --help and --version. * psim.h (psim_usage): Update prototype. * main.c (main): Update psim_usage call. sim/sh: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/sh64: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. sim/v850: 2008-06-06 Vladimir Prus Daniel Jacobowitz Joseph Myers * configure: Regenerate. Index: arm/wrapper.c =================================================================== RCS file: /cvs/src/src/sim/arm/wrapper.c,v retrieving revision 1.35 diff -u -p -r1.35 wrapper.c --- arm/wrapper.c 1 Jan 2008 22:53:23 -0000 1.35 +++ arm/wrapper.c 6 Jun 2008 20:24:34 -0000 @@ -772,9 +772,12 @@ sim_target_parse_arg_array (argv) } void -sim_target_display_usage () +sim_target_display_usage (help) + int help; { - fprintf (stderr, "%s= Comma seperated list of SWI protocols to supoport.\n\ + FILE *stream = help ? stdout : stderr; + + fprintf (stream, "%s= Comma seperated list of SWI protocols to supoport.\n\ This list can contain: NONE, DEMON, ANGEL, REDBOOT and/or ALL.\n", SWI_SWITCH); } Index: common/Make-common.in =================================================================== RCS file: /cvs/src/src/sim/common/Make-common.in,v retrieving revision 1.28 diff -u -p -r1.28 Make-common.in --- common/Make-common.in 1 Jan 2008 22:53:23 -0000 1.28 +++ common/Make-common.in 6 Jun 2008 20:24:34 -0000 @@ -245,7 +245,7 @@ LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LI EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \ $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) -LIB_OBJS = callback.o syscall.o targ-map.o $(SIM_OBJS) +LIB_OBJS = callback.o syscall.o targ-map.o version.o $(SIM_OBJS) RUNTESTFLAGS = @@ -291,6 +291,14 @@ stamp-tvals: gentmap $(SHELL) $(srcroot)/move-if-change tmp-tmap.c targ-map.c touch stamp-tvals +version.c: Makefile ../../gdb/version.in + rm -f version.c-tmp version.c + echo '#include "version.h"' >> version.c-tmp + echo 'const char version[] = "'"`sed q ${srcdir}/../../gdb/version.in`"'";' >> version.c-tmp + mv version.c-tmp version.c +version.o: version.c $(version_h) + + # # Rules for building sim-* components. Triggered by listing the corresponding # .o file in the list of simulator targets. Index: common/aclocal.m4 =================================================================== RCS file: /cvs/src/src/sim/common/aclocal.m4,v retrieving revision 1.14 diff -u -p -r1.14 aclocal.m4 --- common/aclocal.m4 13 Jun 2006 08:06:48 -0000 1.14 +++ common/aclocal.m4 6 Jun 2008 20:24:34 -0000 @@ -893,6 +893,7 @@ AC_OUTPUT ]) sinclude(../../config/gettext-sister.m4) +sinclude(../../config/acx.m4) dnl --enable-cgen-maint support AC_DEFUN(SIM_AC_OPTION_CGEN_MAINT, Index: common/common.m4 =================================================================== RCS file: /cvs/src/src/sim/common/common.m4,v retrieving revision 1.4 diff -u -p -r1.4 common.m4 --- common/common.m4 13 Jun 2006 08:06:48 -0000 1.4 +++ common/common.m4 6 Jun 2008 20:24:34 -0000 @@ -195,6 +195,10 @@ if test x"$silent" != x"yes" && test x"$ fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl AC_SUBST(sim_profile) +ACX_PKGVERSION([GDB]) +ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/]) +AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) +AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) dnl Types used by common code AC_TYPE_SIGNAL Index: common/run-sim.h =================================================================== RCS file: /cvs/src/src/sim/common/run-sim.h,v retrieving revision 1.5 diff -u -p -r1.5 run-sim.h --- common/run-sim.h 1 Jan 2008 22:53:23 -0000 1.5 +++ common/run-sim.h 6 Jun 2008 20:24:35 -0000 @@ -30,7 +30,7 @@ int sim_target_parse_command_line PARAMS /* Display a list of target specific switches supported by this target. */ -void sim_target_display_usage PARAMS ((void)); +void sim_target_display_usage PARAMS ((int help)); #endif Index: common/run.c =================================================================== RCS file: /cvs/src/src/sim/common/run.c,v retrieving revision 1.19 diff -u -p -r1.19 run.c --- common/run.c 1 Jan 2008 22:53:23 -0000 1.19 +++ common/run.c 6 Jun 2008 20:24:35 -0000 @@ -49,8 +49,10 @@ along with this program. If not, see . */ + +#ifndef VERSION_H +#define VERSION_H + +/* Version number of GDB, as a string. */ +extern const char version[]; + +#endif /* #ifndef VERSION_H */ Index: ppc/Makefile.in =================================================================== RCS file: /cvs/src/src/sim/ppc/Makefile.in,v retrieving revision 1.22 diff -u -p -r1.22 Makefile.in --- ppc/Makefile.in 31 May 2006 15:14:45 -0000 1.22 +++ ppc/Makefile.in 6 Jun 2008 20:24:46 -0000 @@ -534,6 +534,7 @@ LIB_OBJ = \ support.o \ @sim_fpu@ \ psim.o \ + version.o \ $(PACKAGE_OBJ) \ $(HW_OBJ) \ options.o @@ -560,6 +561,13 @@ $(TARGETLIB): tmp-igen tmp-dgen tmp-hw t $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ) $(RANLIB) $(TARGETLIB) +version.c: Makefile ../../gdb/version.in + rm -f version.c-tmp version.c + echo '#include "version.h"' >> version.c-tmp + echo 'const char version[] = "'"`sed q ${srcdir}/../../gdb/version.in`"'";' >> version.c-tmp + mv version.c-tmp version.c +version.o: version.c $(version_h) + psim.o: psim.c $(CPU_H) $(IDECODE_H) $(OPTIONS_H) $(TREE_H) $(BFD_H) bits.o: bits.c $(BASICS_H) Index: ppc/configure.ac =================================================================== RCS file: /cvs/src/src/sim/ppc/configure.ac,v retrieving revision 1.7 diff -u -p -r1.7 configure.ac --- ppc/configure.ac 14 Mar 2008 20:26:49 -0000 1.7 +++ ppc/configure.ac 6 Jun 2008 20:24:47 -0000 @@ -563,6 +563,11 @@ if test x"$silent" != x"yes" && test x"$ fi],[sim_xor_endian=""])dnl +ACX_PKGVERSION([GDB]) +ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/]) +AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) +AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) + AC_CANONICAL_SYSTEM AC_ARG_PROGRAM Index: ppc/main.c =================================================================== RCS file: /cvs/src/src/sim/ppc/main.c,v retrieving revision 1.4 diff -u -p -r1.4 main.c --- ppc/main.c 9 Jun 2002 15:45:51 -0000 1.4 +++ ppc/main.c 6 Jun 2008 20:24:47 -0000 @@ -283,7 +283,7 @@ main(int argc, char **argv) print_options (); return 0; } else { - psim_usage(0); + psim_usage(0, 0); } } name_of_file = argv[0]; Index: ppc/psim.c =================================================================== RCS file: /cvs/src/src/sim/ppc/psim.c,v retrieving revision 1.7 diff -u -p -r1.7 psim.c --- ppc/psim.c 28 Nov 2005 21:30:07 -0000 1.7 +++ ppc/psim.c 6 Jun 2008 20:24:47 -0000 @@ -119,7 +119,7 @@ find_arg(char *err_msg, INLINE_PSIM\ (void) -psim_usage(int verbose) +psim_usage(int verbose, int help) { printf_filtered("Usage:\n"); printf_filtered("\n"); @@ -217,7 +217,10 @@ psim_usage(int verbose) printf_filtered("\n"); print_options(); } - error(""); + + if (REPORT_BUGS_TO[0]) + printf ("Report bugs to %s\n", REPORT_BUGS_TO); + exit (help ? 0 : 1); } /* Test "string" for containing a string of digits that form a number @@ -258,7 +261,7 @@ psim_options(device *root, while (*p != '\0') { switch (*p) { default: - psim_usage(0); + psim_usage(0, 0); error (""); break; case 'c': @@ -279,7 +282,7 @@ psim_options(device *root, else { printf_filtered ("Invalid option for -E (target-endian)\n"); - psim_usage (0); + psim_usage (0, 0); } break; case 'f': @@ -288,10 +291,10 @@ psim_options(device *root, break; case 'h': case '?': - psim_usage(1); + psim_usage(1, 1); break; case 'H': - psim_usage(2); + psim_usage(2, 1); break; case 'i': if (isdigit(p[1])) { @@ -352,6 +355,14 @@ psim_options(device *root, p = argv[argp] + strlen(argv[argp]) - 1; printf_filtered("Warning - architecture parameter ignored\n"); } + else if (strcmp (argv[argp], "--help") == 0) + psim_usage (0, 1); + else if (strcmp (argv[argp], "--version") == 0) + { + extern const char version[]; + printf ("GNU simulator %s%s\n", PKGVERSION, version); + exit (0); + } else error("Unrecognized option"); break; Index: ppc/psim.h =================================================================== RCS file: /cvs/src/src/sim/ppc/psim.h,v retrieving revision 1.2 diff -u -p -r1.2 psim.h --- ppc/psim.h 20 Jun 2003 13:32:34 -0000 1.2 +++ ppc/psim.h 6 Jun 2008 20:24:47 -0000 @@ -61,7 +61,7 @@ extern void psim_merge_device_file const char *file_name); extern void psim_usage -(int verbose); +(int verbose, int help); /* create a new simulator from the device tree */ -- Joseph S. Myers joseph@codesourcery.com