GNU Binutils with patches for OS216
修訂 | d0e8b2cc4a9c174b45871df552632f249227d818 (tree) |
---|---|
時間 | 2019-06-05 07:22:42 |
作者 | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
Fix "set enum-command value junk"
With enum commands, we currently fail to notice junk after the value.
Currently:
After this fix:
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* cli/cli-setshow.c (do_set_command) <var_enum>: Detect junk
after item.
@@ -413,6 +413,10 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c) | ||
413 | 413 | if (nmatches > 1) |
414 | 414 | error (_("Ambiguous item \"%s\"."), arg); |
415 | 415 | |
416 | + const char *after = skip_spaces (arg + len); | |
417 | + if (*after != '\0') | |
418 | + error (_("Junk after item \"%.*s\": %s"), len, arg, after); | |
419 | + | |
416 | 420 | if (*(const char **) c->var != match) |
417 | 421 | { |
418 | 422 | *(const char **) c->var = match; |