From: David Edelsohn Date: Fri, 18 Apr 1997 21:32:07 +0000 (+0000) Subject: * sim-options.c (standard_options): Add --endian. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e65bd1d84394b9739192470f05f742cc2aa196f7;p=binutils-gdb.git * sim-options.c (standard_options): Add --endian. (standard_option_handler): Likewise. --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 078b3d1edf5..c5bff2495d7 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,8 @@ Fri Apr 18 11:14:43 1997 Doug Evans + * sim-options.c (standard_options): Add --endian. + (standard_option_handler): Likewise. + * nrun.c: #include . (main, cntrl_c): Wrap calls to sim_resume in a SIGINT handler that calls sim_stop (). diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 7daa498e849..b4f7d3040dd 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -70,6 +70,17 @@ static DECLARE_OPTION_HANDLER (standard_option_handler); options to another table or use a HAVE_FOO macro to ifdef out unavailable options. */ +/* ??? One might want to conditionally compile out the entries that + aren't enabled. There's a distinction, however, between options a + simulator can't support and options that haven't been configured in. + Certainly options a simulator can't support shouldn't appear in the + output of --help. Whether the same thing applies to options that haven't + been configured in or not isn't something I can get worked up over. + [Note that conditionally compiling them out might simply involve moving + the option to another table.] + If you decide to conditionally compile them out as well, delete this + comment and add a comment saying that that is the rule. */ + #define OPTION_DEBUG_INSN (OPTION_START + 0) #define OPTION_DEBUG_FILE (OPTION_START + 1) #define OPTION_TRACE_INSN (OPTION_START + 2) @@ -92,6 +103,12 @@ static const OPTION standard_options[] = 'v', NULL, "Verbose output", standard_option_handler }, +#if defined (SIM_HAVE_BIENDIAN) /* ??? && WITH_TARGET_BYTE_ORDER == 0 */ + { {"endian", required_argument, NULL, 'E'}, + 'E', "big|little", "Set endianness", + standard_option_handler }, +#endif + { {"debug", no_argument, NULL, 'D'}, 'D', NULL, "Print debugging messages", standard_option_handler }, @@ -138,7 +155,7 @@ static const OPTION standard_options[] = #ifdef SIM_HAVE_SIMCACHE { {"simcache-size", required_argument, NULL, 'c'}, - 'c', "SIM CACHE SIZE", "Specify size of simulator instruction cache", + 'c', "SIM CACHE SIZE", "Specify size of simulator execution cache", standard_option_handler }, #endif @@ -150,7 +167,7 @@ static const OPTION standard_options[] = #ifdef SIM_HAVE_MAX_INSNS { {"max-insns", required_argument, NULL, 'M'}, - 'M', "MAX INSNS", "Specify maximum instructions to execute", + 'M', "MAX INSNS", "Specify maximum number of instructions to execute", standard_option_handler }, #endif @@ -205,6 +222,34 @@ standard_option_handler (sd, opt, arg) STATE_VERBOSE_P (sd) = 1; break; +#ifdef SIM_HAVE_BIENDIAN + case 'E' : + if (strcmp (arg, "big") == 0) + { + if (WITH_TARGET_BYTE_ORDER == LITTLE_ENDIAN) + { + sim_io_eprintf (sd, "Simulator compiled for little endian only.\n"); + return SIM_RC_FAIL; + } + /* FIXME:wip: Need to set something in STATE_CONFIG. */ + } + else if (strcmp (arg, "little") == 0) + { + if (WITH_TARGET_BYTE_ORDER == BIG_ENDIAN) + { + sim_io_eprintf (sd, "Simulator compiled for big endian only.\n"); + return SIM_RC_FAIL; + } + /* FIXME:wip: Need to set something in STATE_CONFIG. */ + } + else + { + sim_io_eprintf (sd, "Invalid endian specification `%s'\n", arg); + return SIM_RC_FAIL; + } + break; +#endif + case 'D' : if (! WITH_DEBUG) sim_io_eprintf (sd, "Debugging not compiled in, `-D' ignored\n");