From patchwork Wed May 22 20:53:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32804 Received: (qmail 129069 invoked by alias); 22 May 2019 20:53:36 -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 129029 invoked by uid 89); 22 May 2019 20:53:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 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=sk:depreca 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:34 +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 90201308FBB4 for ; Wed, 22 May 2019 20:53:33 +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 211581001284 for ; Wed, 22 May 2019 20:53:32 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 05/24] Allow "unlimited" abbreviations Date: Wed, 22 May 2019 21:53:08 +0100 Message-Id: <20190522205327.2568-6-palves@redhat.com> In-Reply-To: <20190522205327.2568-1-palves@redhat.com> References: <20190522205327.2568-1-palves@redhat.com> Currently we can abbreviate "on/off/enable/disable/yes/no" in boolean settings, (gdb) set non-stop of (gdb) set non-stop en we can abbreviate the items of enumeration commands, (gdb) set print frame-arguments scal (gdb) set scheduler-locking rep but we cannot abbreviate "unlimited" in integer commands. (gdb) set print elements u No symbol "u" in current context. This commit fixes that. Testcases will be in gdb.base/settings.exp and gdb.base/options.exp, in following patches. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * cli/cli-setshow.c (is_unlimited_literal): Allow abbreviations. --- gdb/cli/cli-setshow.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 5b87f905d0d..96d7bf5c3c0 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -132,12 +132,16 @@ deprecated_show_value_hack (struct ui_file *ignore_file, static int is_unlimited_literal (const char *arg) { - size_t len = sizeof ("unlimited") - 1; - arg = skip_spaces (arg); - return (strncmp (arg, "unlimited", len) == 0 - && (isspace (arg[len]) || arg[len] == '\0')); + const char *p = skip_to_space (arg); + + size_t len = p - arg; + + if (len > 0 && strncmp ("unlimited", arg, len) == 0) + return true; + + return false; }