From patchwork Wed May 22 20:53:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32805 Received: (qmail 129233 invoked by alias); 22 May 2019 20:53:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 129167 invoked by uid 89); 22 May 2019 20:53:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 May 2019 20:53:35 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7020B83F3B for ; Wed, 22 May 2019 20:53:34 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id F25021001284 for ; Wed, 22 May 2019 20:53:33 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 06/24] Fix "set enum-command value garbage" Date: Wed, 22 May 2019 21:53:09 +0100 Message-Id: <20190522205327.2568-7-palves@redhat.com> In-Reply-To: <20190522205327.2568-1-palves@redhat.com> References: <20190522205327.2568-1-palves@redhat.com> With enum commands, we currently fail to notice garbage 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 Garbage after item: "foo" gdb/ChangeLog: yyyy-mm-dd Pedro Alves * cli/cli-setshow.c (do_set_command) : Detect garbage after item. --- gdb/cli/cli-setshow.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 96d7bf5c3c0..9d6479ffca2 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); + arg = skip_spaces (arg + len); + if (*arg != '\0') + error (_("Garbage after item: \"%s\""), arg); + if (*(const char **) c->var != match) { *(const char **) c->var = match;