aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2019-06-13 00:06:52 +0100
committerPedro Alves <palves@redhat.com>2019-06-13 00:09:37 +0100
commit48c410fb70fe09c036e27092880db687e5c2fb0b (patch)
tree443b8726ad4152a7427ee422267ba29bc7f91354 /gdb/cli
parent93bcb04349eb500781747a542ececc7a8ba3bd95 (diff)
downloadgdb-48c410fb70fe09c036e27092880db687e5c2fb0b.zip
gdb-48c410fb70fe09c036e27092880db687e5c2fb0b.tar.gz
gdb-48c410fb70fe09c036e27092880db687e5c2fb0b.tar.bz2
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: 2019-06-13 Pedro Alves <palves@redhat.com> * cli/cli-setshow.c (do_set_command) <var_enum>: Detect junk after item.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-setshow.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 96d7bf5..86ebed4 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;