public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pedro Alves <palves@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix "set enum-command value junk"
Date: Wed, 12 Jun 2019 23:28:00 -0000	[thread overview]
Message-ID: <20190612232824.29090.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=48c410fb70fe09c036e27092880db687e5c2fb0b

commit 48c410fb70fe09c036e27092880db687e5c2fb0b
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Jun 13 00:06:52 2019 +0100

    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.

Diff:
---
 gdb/ChangeLog         | 5 +++++
 gdb/cli/cli-setshow.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 38e34b5..c254e36 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-06-13  Pedro Alves  <palves@redhat.com>
 
+	* cli/cli-setshow.c (do_set_command) <var_enum>: Detect junk
+	after item.
+
+2019-06-13  Pedro Alves  <palves@redhat.com>
+
 	* cli/cli-setshow.c (is_unlimited_literal): Allow abbreviations.
 
 2019-06-13  Pedro Alves <palves@redhat.com>
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;


                 reply	other threads:[~2019-06-12 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190612232824.29090.qmail@sourceware.org \
    --to=palves@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).