From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28815 invoked by alias); 12 Jun 2019 23:28:19 -0000 Mailing-List: contact gdb-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: gdb-cvs-owner@sourceware.org List-Subscribe: Sender: gdb-cvs-owner@sourceware.org Received: (qmail 28791 invoked by uid 9683); 12 Jun 2019 23:28:19 -0000 Date: Wed, 12 Jun 2019 23:28:00 -0000 Message-ID: <20190612232819.28789.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Allow "unlimited" abbreviations X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: cbba3ecd36f0f861e4e810fbd5415c9759080cdc X-Git-Newrev: 93bcb04349eb500781747a542ececc7a8ba3bd95 X-SW-Source: 2019-06/txt/msg00044.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=93bcb04349eb500781747a542ececc7a8ba3bd95 commit 93bcb04349eb500781747a542ececc7a8ba3bd95 Author: Pedro Alves Date: Thu Jun 13 00:06:52 2019 +0100 Allow "unlimited" abbreviations 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: 2019-06-13 Pedro Alves * cli/cli-setshow.c (is_unlimited_literal): Allow abbreviations. Diff: --- gdb/ChangeLog | 4 ++++ gdb/cli/cli-setshow.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 538db3a..38e34b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2019-06-13 Pedro Alves + + * cli/cli-setshow.c (is_unlimited_literal): Allow abbreviations. + 2019-06-13 Pedro Alves * ax-gdb.c (agent_command_1): Remove skip_spaces call. diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 5b87f90..96d7bf5 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; }