From patchwork Tue Jun 4 22:34:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32990 Received: (qmail 45613 invoked by alias); 4 Jun 2019 22:35:10 -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 45556 invoked by uid 89); 4 Jun 2019 22:35:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 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; Tue, 04 Jun 2019 22:35:08 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72237A0B58 for ; Tue, 4 Jun 2019 22:35:07 +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 895F819C69 for ; Tue, 4 Jun 2019 22:35:06 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 05/24] Allow "unlimited" abbreviations Date: Tue, 4 Jun 2019 23:34:25 +0100 Message-Id: <20190604223444.26472-6-palves@redhat.com> In-Reply-To: <20190604223444.26472-1-palves@redhat.com> References: <20190604223444.26472-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; }