From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 5CD7C3858C3A for ; Mon, 4 Oct 2021 06:20:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5CD7C3858C3A Received: by smtp.gentoo.org (Postfix, from userid 559) id 372B7342F7A; Mon, 4 Oct 2021 06:20:38 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: add --info-target for listing supported BFD targets Date: Mon, 4 Oct 2021 02:20:39 -0400 Message-Id: <20211004062039.7431-1-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2021 06:20:40 -0000 It can be difficult to guess the exact bfd name, so add an option to list all the targets that the current build supports. This aligns with other simulator options like --info-architecture. --- sim/common/sim-options.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index e6d1107f7c55..e82ac33fe764 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -93,6 +93,7 @@ typedef enum { OPTION_DO_COMMAND, OPTION_ARCHITECTURE, OPTION_TARGET, + OPTION_TARGET_INFO, OPTION_ARCHITECTURE_INFO, OPTION_ENVIRONMENT, OPTION_ALIGNMENT, @@ -161,6 +162,10 @@ static const OPTION standard_options[] = { {"target", required_argument, NULL, OPTION_TARGET}, '\0', "BFDNAME", "Specify the object-code format for the object files", standard_option_handler }, + { {"target-info", no_argument, NULL, OPTION_TARGET_INFO}, + '\0', NULL, "List supported targets", standard_option_handler }, + { {"info-target", no_argument, NULL, OPTION_TARGET_INFO}, + '\0', NULL, NULL, standard_option_handler }, { {"load-lma", no_argument, NULL, OPTION_LOAD_LMA}, '\0', NULL, @@ -365,6 +370,20 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, break; } + case OPTION_TARGET_INFO: + { + const char **list = bfd_target_list (); + const char **lp; + if (list == NULL) + abort (); + sim_io_printf (sd, "Possible targets:"); + for (lp = list; *lp != NULL; lp++) + sim_io_printf (sd, " %s", *lp); + sim_io_printf (sd, "\n"); + free (list); + break; + } + case OPTION_LOAD_LMA: { STATE_LOAD_AT_LMA_P (sd) = 1; -- 2.33.0