summaryrefslogtreecommitdiffstats
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-04-19 18:42:00 +0000
committerMike Frysinger <vapier@gentoo.org>2010-04-19 18:42:00 +0000
commitbd0bd5081ff6b78ec710a6395a1a1292765ca8e5 (patch)
tree0a3550955089f0b0fb937cc0cef861442439f9e1 /sim/common
parent78076abca50654310954a0f83c4d4c743740261b (diff)
downloadppe42-binutils-bd0bd5081ff6b78ec710a6395a1a1292765ca8e5.tar.gz
ppe42-binutils-bd0bd5081ff6b78ec710a6395a1a1292765ca8e5.zip
sim: add --model-info helper option
There is an architecture-info flag for listing possible arch values, but there is on equivalent for listing possible model values. So add the equivalent for models. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/common/sim-model.c29
2 files changed, 35 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index eb585192bf..9e0f6dd40b 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-19 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-model.c (OPTION_MODEL): Convert to enum.
+ (OPTION_MODEL_INFO): New enum.
+ (model_options): Add model-info/info-model entries.
+ (model_option_handler): Handle OPTION_MODEL_INFO.
+
2010-04-13 Mike Frysinger <vapier@gentoo.org>
* dv-sockser.h (DV_SOCKSER_DISCONNECTED): Define.
diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c
index ddcb2de2be..41d81e93c8 100644
--- a/sim/common/sim-model.c
+++ b/sim/common/sim-model.c
@@ -32,12 +32,23 @@ static DECLARE_OPTION_HANDLER (model_option_handler);
static MODULE_INIT_FN sim_model_init;
-#define OPTION_MODEL (OPTION_START + 0)
+enum {
+ OPTION_MODEL = OPTION_START,
+ OPTION_MODEL_INFO,
+};
static const OPTION model_options[] = {
{ {"model", required_argument, NULL, OPTION_MODEL},
'\0', "MODEL", "Specify model to simulate",
model_option_handler, NULL },
+
+ { {"model-info", no_argument, NULL, OPTION_MODEL_INFO},
+ '\0', NULL, "List selectable models",
+ model_option_handler, NULL },
+ { {"info-model", no_argument, NULL, OPTION_MODEL_INFO},
+ '\0', NULL, NULL,
+ model_option_handler, NULL },
+
{ {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL, NULL }
};
@@ -58,6 +69,22 @@ model_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
sim_model_set (sd, cpu, model);
break;
}
+
+ case OPTION_MODEL_INFO :
+ {
+ const MACH **machp;
+ const MODEL *model;
+ for (machp = & sim_machs[0]; *machp != NULL; ++machp)
+ {
+ sim_io_printf (sd, "Models for architecture `%s':\n",
+ MACH_NAME (*machp));
+ for (model = MACH_MODELS (*machp); MODEL_NAME (model) != NULL;
+ ++model)
+ sim_io_printf (sd, " %s", MODEL_NAME (model));
+ sim_io_printf (sd, "\n");
+ }
+ break;
+ }
}
return SIM_RC_OK;
OpenPOWER on IntegriCloud