From patchwork Tue Jun 4 21:37:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32984 Received: (qmail 64403 invoked by alias); 4 Jun 2019 21:37:29 -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 64227 invoked by uid 89); 4 Jun 2019 21:37:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=unlimitedjunk, H*RU:209.85.128.65, HX-Spam-Relays-External:209.85.128.65, uinteger X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Jun 2019 21:37:28 +0000 Received: by mail-wm1-f65.google.com with SMTP id w9so357584wmd.1 for ; Tue, 04 Jun 2019 14:37:28 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4eeb:42ff:feef:f164? ([2001:8a0:f913:f700:4eeb:42ff:feef:f164]) by smtp.gmail.com with ESMTPSA id n4sm16811018wrp.61.2019.06.04.14.37.25 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 14:37:25 -0700 (PDT) Subject: Re: [PATCH v2 12/24] Introduce generic command options framework To: Tom Tromey References: <20190530195333.20448-1-palves@redhat.com> <20190530195333.20448-13-palves@redhat.com> <874l56mqd3.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <6fea8eb8-ae7d-bbca-d94f-9d82854e9238@redhat.com> Date: Tue, 4 Jun 2019 22:37:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <874l56mqd3.fsf@tromey.com> On 6/3/19 8:16 PM, Tom Tromey wrote: > > Pedro> + if (len > 0 && strncmp ("unlimited", *arg, len) == 0) > > I should have mentioned this in an earlier patch, but won't this also > match things like "unlimitedjunk"? It won't -- the code reads: static int is_unlimited_literal (const char *arg) { arg = skip_spaces (arg); const char *p = skip_to_space (arg); size_t len = p - arg; if (len > 0 && strncmp ("unlimited", arg, len) == 0) return true; return false; } So for "unlimitedjunk", LEN will be 13, which is longer than strlen ("unlimited"), so the strncmp returns != 0. Thanks for bringing this up -- I missed adding a test for that case. I'm adding the below to the new settings.exp testcase. Also, while writing the test I realized that we don't error out with: (gdb) maint test-settings set uinteger unlimited junk I wrote a follow up patch on top of the series to fix that. Thanks, Pedro Alves diff --git c/gdb/testsuite/gdb.base/settings.exp w/gdb/testsuite/gdb.base/settings.exp index 36c80086a3d..c62957181e2 100644 --- c/gdb/testsuite/gdb.base/settings.exp +++ w/gdb/testsuite/gdb.base/settings.exp @@ -141,7 +141,10 @@ proc test-integer {variant} { "$set_cmd unlimited" } + gdb_test "$set_cmd unlimitedu" "No symbol table is loaded.*" + test_gdb_complete_none "$set_cmd unlimited " + test_gdb_complete_none "$set_cmd unlimitedu"