From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28020 invoked by alias); 16 Apr 2010 07:32:59 -0000 Received: (qmail 27981 invoked by uid 22791); 16 Apr 2010 07:32:57 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Apr 2010 07:32:47 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 3797E1B401A for ; Fri, 16 Apr 2010 07:32:45 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: add --model-info helper option Date: Fri, 16 Apr 2010 07:32:00 -0000 Message-Id: <1271403092-21679-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes 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: 2010-04/txt/msg00502.txt.bz2 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 2010-04-16 Mike Frysinger * 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. --- sim/common/sim-model.c | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c index ddcb2de..5e7284c 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, "List selectable models", + 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; -- 1.7.0.2