From patchwork Fri Nov 23 14:02:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 30268 Received: (qmail 101277 invoked by alias); 23 Nov 2018 14:03:08 -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 101261 invoked by uid 89); 23 Nov 2018 14:03:07 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2983 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; Fri, 23 Nov 2018 14:03:01 +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 46BEF3084243 for ; Fri, 23 Nov 2018 14:03:00 +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 D40F32E053 for ; Fri, 23 Nov 2018 14:02:59 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Remove declarations of is_running/is_stopped/is_exited Date: Fri, 23 Nov 2018 14:02:47 +0000 Message-Id: <20181123140247.28701-1-palves@redhat.com> The recent commit 080363310650 ("Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.") removed the definitions of is_running/is_stopped/is_exited but missed removing the declarations. gdb/ChangeLog: 2018-11-23 Pedro Alves * gdbthread.h (enum thread_state): Move comments here. (is_running, is_stopped, is_exited): Remove declarations. --- gdb/ChangeLog | 5 +++++ gdb/gdbthread.h | 48 ++++++++++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0b8651ccef..90e8d7a5c6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-11-23 Pedro Alves + + * gdbthread.h (enum thread_state): Move comments here. + (is_running, is_stopped, is_exited): Remove declarations. + 2018-11-22 Pedro Alves * Makefile.in (COMMON_SFILES): Add thread-iter.c. diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 94fc1b7472..2e8f4f195e 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -36,11 +36,32 @@ struct symtab; struct inferior; /* Frontend view of the thread state. Possible extensions: stepping, - finishing, until(ling),... */ + finishing, until(ling),... + + NOTE: Since the thread state is not a boolean, most times, you do + not want to check it with negation. If you really want to check if + the thread is stopped, + + use (good): + + if (tp->state == THREAD_STOPPED) + + instead of (bad): + + if (tp->state != THREAD_RUNNING) + + The latter is also true for exited threads, most likely not what + you want. */ enum thread_state { + /* In the frontend's perpective, the thread is stopped. */ THREAD_STOPPED, + + /* In the frontend's perpective, the thread is running. */ THREAD_RUNNING, + + /* The thread is listed, but known to have exited. We keep it + listed (but not visible) until it's safe to delete it. */ THREAD_EXITED, }; @@ -566,31 +587,6 @@ extern void set_running (ptid_t ptid, int running); observer is called with PTID as argument. */ extern void set_stop_requested (ptid_t ptid, int stop); -/* NOTE: Since the thread state is not a boolean, most times, you do - not want to check it with negation. If you really want to check if - the thread is stopped, - - use (good): - - if (is_stopped (ptid)) - - instead of (bad): - - if (!is_running (ptid)) - - The latter also returns true on exited threads, most likelly not - what you want. */ - -/* Reports if in the frontend's perpective, thread PTID is running. */ -extern int is_running (ptid_t ptid); - -/* Is this thread listed, but known to have exited? We keep it listed - (but not visible) until it's safe to delete. */ -extern int is_exited (ptid_t ptid); - -/* In the frontend's perpective, is this thread stopped? */ -extern int is_stopped (ptid_t ptid); - /* Marks thread PTID as executing, or not. If PTID is minus_one_ptid, marks all threads.