From patchwork Tue Jun 4 22:34:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 33005 Received: (qmail 63407 invoked by alias); 4 Jun 2019 22:42:17 -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 63398 invoked by uid 89); 4 Jun 2019 22:42:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.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= 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:42:16 +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 BBA9B120D7 for ; Tue, 4 Jun 2019 22:35:21 +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 4DB6119C69 for ; Tue, 4 Jun 2019 22:35:21 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 21/24] "thread apply 1 -- -" vs "frame apply level 0 -- -" Date: Tue, 4 Jun 2019 23:34:41 +0100 Message-Id: <20190604223444.26472-22-palves@redhat.com> In-Reply-To: <20190604223444.26472-1-palves@redhat.com> References: <20190604223444.26472-1-palves@redhat.com> With the following patch, we'll be able to explicitly tell "thread apply" where options end, using the "--" delimiter. A test added by that patch caught a pre-existing inconsistency: (gdb) thread apply 1 -- - Invalid thread ID: - (gdb) frame apply level 0 -- - #0 main () at threads.c:55 Cannot enable the TUI when output is not a terminal Above, "thread apply" did not try to run the command, while "frame apply level" did. ("-" is a valid TUI command.) That "-" is past "--", so it should have not been confused with an invalid TID, in the "thread apply" case. That error actually doesn't come from the TID parser, but instead from thread_apply_command directly. So that error/check needs tweaking. The next question is what to tweak it to. "-" is actually a valid TUI command: (gdb) help - Scroll window backward. Usage: - [WIN] [N] (gdb) frame apply level 0 -- - #0 main () at threads.c:55 Cannot enable the TUI when output is not a terminal While I don't imagine it being useful to use that "-" command with "thread apply" or "frame apply level", the fact is that you can use it with "frame apply level", but not with "thread apply". And since it's an actual command, pedantically it seems right to allow it. That's what this commit does. Note: simply removing the "isalpha" check regresses gdb.multi/tids.exp -- see related commit 3f5b7598805c. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * thread.c (thread_apply_command): Check for invalid TID with isdigit instead of !isalpha. --- gdb/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/thread.c b/gdb/thread.c index 24906fa7d60..ea87f51c6e6 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1583,7 +1583,7 @@ thread_apply_command (const char *tidlist, int from_tty) if (*cmd == '\0') error (_("Please specify a command following the thread ID list")); - if (tidlist == cmd || !isalpha (cmd[0])) + if (tidlist == cmd || isdigit (cmd[0])) invalid_thread_id_error (cmd); scoped_restore_current_thread restore_thread;