diff options
author | Pedro Alves <palves@redhat.com> | 2019-05-30 20:40:15 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-06-04 23:22:42 +0100 |
commit | d0e8b2cc4a9c174b45871df552632f249227d818 (patch) | |
tree | be59bca4b03132660bca8bb1ab4f82d4efc11b47 | |
parent | bd30787526220460dc5ebbf9a6a1ed546da33137 (diff) | |
download | binutils-gdb-d0e8b2cc4a9c174b45871df552632f249227d818.tar.gz |
Fix "set enum-command value junk"
With enum commands, we currently fail to notice junk after the value.
Currently:
(gdb) set print entry-values compact foo
(gdb) show print entry-values foo
Printing of function arguments at function entry is "compact".
After this fix:
(gdb) set print entry-values compact foo
Junk after item "compact": foo
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* cli/cli-setshow.c (do_set_command) <var_enum>: Detect junk
after item.
-rw-r--r-- | gdb/cli/cli-setshow.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 96d7bf5c3c0..86ebed45a4a 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -413,6 +413,10 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c) if (nmatches > 1) error (_("Ambiguous item \"%s\"."), arg); + const char *after = skip_spaces (arg + len); + if (*after != '\0') + error (_("Junk after item \"%.*s\": %s"), len, arg, after); + if (*(const char **) c->var != match) { *(const char **) c->var = match; |