diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-04-13 02:33:26 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-04-13 02:35:26 -0400 |
commit | a542beff945c1a416f85309d57b21d4a18422883 (patch) | |
tree | c63cfeb577b2f1337b230e962cc9632061061368 /sim/common | |
parent | 8c32ba22334b8be1c2cf412a789deeded786e1f5 (diff) | |
download | binutils-a542beff945c1a416f85309d57b21d4a18422883.zip binutils-a542beff945c1a416f85309d57b21d4a18422883.tar.gz binutils-a542beff945c1a416f85309d57b21d4a18422883.tar.bz2 |
sim: options: add --version support
The old run frontend had a --version option, but the new common
sim-options file does not. Restore support for that so we can
get version info out of `run` when using the new frontend.
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 7 | ||||
-rw-r--r-- | sim/common/sim-options.c | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 00a952e..a7341f5 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,12 @@ 2015-04-13 Mike Frysinger <vapier@gentoo.org> + * sim-options.c: Include version.h. + (OPTIONS_VERSION): New enum. + (standard_options): Add "version". + (standard_option_handler): Handle OPTIONS_VERSION. + +2015-04-13 Mike Frysinger <vapier@gentoo.org> + * Makefile.in (version.o): Change to using create-version.sh from gdb. (create-version.sh): Delete. diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 814edcf..f823143 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sim-options.h" #include "sim-io.h" #include "sim-assert.h" +#include "version.h" #include "bfd.h" @@ -105,6 +106,7 @@ typedef enum { OPTION_MEM_SIZE, #endif OPTION_HELP, + OPTION_VERSION, #ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ OPTION_H8300H, OPTION_H8300S, @@ -173,6 +175,9 @@ static const OPTION standard_options[] = { {"help", no_argument, NULL, OPTION_HELP}, 'H', NULL, "Print help information", standard_option_handler }, + { {"version", no_argument, NULL, OPTION_VERSION}, + '\0', NULL, "Print version information", + standard_option_handler }, { {"architecture", required_argument, NULL, OPTION_ARCHITECTURE}, '\0', "MACHINE", "Specify the architecture to use", @@ -455,6 +460,12 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, /* FIXME: 'twould be nice to do something similar if gdb. */ break; + case OPTION_VERSION: + sim_io_printf (sd, "GNU simulator %s%s\n", PKGVERSION, version); + if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) + exit (0); + break; + case OPTION_SYSROOT: /* Don't leak memory in the odd event that there's lots of --sysroot=... options. We treat "" specially since this |