From 11eef9ed35b52f3e2647551120d8a0d16a5fbf15 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 8 Jun 2011 16:44:28 +0000 Subject: [PATCH] ppc sim: Improve invalid option error message This patch improves the error message when an invalid option is detected, by also printing the option that actually caused the error. For instance, from GDB: (gdb) target sim --hello Invalid option: --hello Usage: [...] We also added the usage after an invalid long-name option (Eg: --hello) to be in line with what's being done for all other invalid options being detected. sim/ppc/ChangeLog: * psim.c (psim_options): Add option that cause the error in invalid-option error messages. Print the usage when detecting an invalid long-name option. --- sim/ppc/ChangeLog | 8 +++++++- sim/ppc/psim.c | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 2536fa4272c..047126aacf7 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,4 +1,10 @@ -2011-06-08 Joel Brobecker +2011-06-08 joel brobecker + + * psim.c (psim_options): Add option that cause the error + in invalid-option error messages. Print the usage when + detecting an invalid long-name option. + +2011-06-08 joel brobecker * psim.c (psim_options): Accept and ignore `--sysroot=...'. diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c index 076a50c8d2e..d814486be33 100644 --- a/sim/ppc/psim.c +++ b/sim/ppc/psim.c @@ -261,6 +261,7 @@ psim_options(device *root, while (*p != '\0') { switch (*p) { default: + printf_filtered ("Invalid Option: %s\n", argv[argp]); psim_usage(0, 0); error (""); break; @@ -368,7 +369,11 @@ psim_options(device *root, exit (0); } else - error("Unrecognized option"); + { + printf_filtered ("Invalid option: %s\n", argv[argp]); + psim_usage (0, 0); + error (""); + } break; } p += 1; -- 2.30.2