diff options
author | Joseph Myers <joseph@codesourcery.com> | 2008-06-07 01:31:27 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2008-06-07 01:31:27 +0000 |
commit | 6efef468bed94a730bb0ae60a36ebead70c97f4e (patch) | |
tree | c81eb269a4d526f464e8999e1ae3ca030fce662c /sim/common/run.c | |
parent | bf37b8e8125cd1126cdc52e6bb411d70a6bae82b (diff) | |
download | gdb-6efef468bed94a730bb0ae60a36ebead70c97f4e.zip gdb-6efef468bed94a730bb0ae60a36ebead70c97f4e.tar.gz gdb-6efef468bed94a730bb0ae60a36ebead70c97f4e.tar.bz2 |
sim:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* cris/configure: Regenerate.
sim/common:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* 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 <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
* wrapper.c (sim_target_display_usage): Add help parameter.
sim/cr16:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/d10v:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/erc32:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/frv:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/h8300:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/iq2000:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/m32c:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/m32r:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/m68hc11:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/mcore:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/mips:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/mn10300:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/ppc:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* 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 <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/sh64:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
sim/v850:
2008-06-06 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
Diffstat (limited to 'sim/common/run.c')
-rw-r--r-- | sim/common/run.c | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/sim/common/run.c b/sim/common/run.c index f2b6fb0..233b17a 100644 --- a/sim/common/run.c +++ b/sim/common/run.c @@ -49,8 +49,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "gdb/remote-sim.h" #include "ansidecl.h" #include "run-sim.h" +#include "version.h" -static void usage PARAMS ((void)); +static void usage PARAMS ((int help)); +static void print_version PARAMS ((void)); extern int optind; extern char *optarg; @@ -118,6 +120,19 @@ main (ac, av) ac = sim_target_parse_command_line (ac, av); #endif + for (i = 1; av[i]; ++i) + { + if (strcmp (av[i], "--help") == 0) + { + usage (1); + } + else if (strcmp (av[i], "--version") == 0) + { + print_version (); + return 0; + } + } + /* FIXME: This is currently being rewritten to have each simulator do all argv processing. */ @@ -175,13 +190,13 @@ main (ac, av) break; /* FIXME: Quick hack, to be replaced by more general facility. */ default: - usage (); + usage (0); } ac -= optind; av += optind; if (ac <= 0) - usage (); + usage (0); name = *av; prog_args = av; @@ -301,31 +316,43 @@ main (ac, av) } static void -usage () +usage (int help) { - fprintf (stderr, "Usage: %s [options] program [program args]\n", myname); - fprintf (stderr, "Options:\n"); - fprintf (stderr, "-a args Pass `args' to simulator.\n"); + FILE *stream = help ? stdout : stderr; + + fprintf (stream, "Usage: %s [options] program [program args]\n", myname); + fprintf (stream, "Options:\n"); + fprintf (stream, "-a args Pass `args' to simulator.\n"); #ifdef SIM_HAVE_SIMCACHE - fprintf (stderr, "-c size Set simulator cache size to `size'.\n"); + fprintf (stream, "-c size Set simulator cache size to `size'.\n"); #endif - fprintf (stderr, "-m size Set memory size of simulator, in bytes.\n"); + fprintf (stream, "-m size Set memory size of simulator, in bytes.\n"); #ifdef SIM_HAVE_ENVIRONMENT - fprintf (stderr, "-o Select operating (kernel) environment.\n"); + fprintf (stream, "-o Select operating (kernel) environment.\n"); #endif #ifdef SIM_HAVE_PROFILE - fprintf (stderr, "-p freq Set profiling frequency.\n"); - fprintf (stderr, "-s size Set profiling size.\n"); + fprintf (stream, "-p freq Set profiling frequency.\n"); + fprintf (stream, "-s size Set profiling size.\n"); #endif - fprintf (stderr, "-t Perform instruction tracing.\n"); - fprintf (stderr, " Note: Very few simulators support tracing.\n"); - fprintf (stderr, "-v Verbose output.\n"); - fprintf (stderr, "\n"); - fprintf (stderr, "program args Arguments to pass to simulated program.\n"); - fprintf (stderr, " Note: Very few simulators support this.\n"); + fprintf (stream, "-t Perform instruction tracing.\n"); + fprintf (stream, " Note: Very few simulators support tracing.\n"); + fprintf (stream, "-v Verbose output.\n"); + fprintf (stream, "\n"); + fprintf (stream, "program args Arguments to pass to simulated program.\n"); + fprintf (stream, " Note: Very few simulators support this.\n"); #ifdef SIM_TARGET_SWITCHES - fprintf (stderr, "\nTarget specific options:\n"); - sim_target_display_usage (); + fprintf (stream, "\nTarget specific options:\n"); + sim_target_display_usage (help); #endif - exit (1); + + if (help && REPORT_BUGS_TO[0]) + printf ("Report bugs to %s\n", REPORT_BUGS_TO); + + exit (help ? 0 : 1); +} + +static void +print_version () +{ + printf ("GNU simulator %s%s\n", PKGVERSION, version); } |