aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-10-04 02:11:21 -0400
committerMike Frysinger <vapier@gentoo.org>2021-10-04 02:19:58 -0400
commitadc82fdb715184fa8e9acf47179e67acc82b8375 (patch)
tree3a4fdf34afb98725dbd0ccffc0ef5942f26e6497
parent51911bd6e91ca4594424b243bfd1d2b501706abe (diff)
downloadgdb-adc82fdb715184fa8e9acf47179e67acc82b8375.zip
gdb-adc82fdb715184fa8e9acf47179e67acc82b8375.tar.gz
gdb-adc82fdb715184fa8e9acf47179e67acc82b8375.tar.bz2
sim: add --info-target for listing supported BFD targets
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.
-rw-r--r--sim/common/sim-options.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index e6d1107..e82ac33 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;