From patchwork Tue Mar 12 17:04:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31827 Received: (qmail 23166 invoked by alias); 12 Mar 2019 17:04:20 -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 23153 invoked by uid 89); 12 Mar 2019 17:04:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=fyi, FYI, offer, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Mar 2019 17:04:18 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BC6B7560B0; Tue, 12 Mar 2019 13:04:16 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZLsyuWO6U1Dp; Tue, 12 Mar 2019 13:04:16 -0400 (EDT) Received: from murgatroyd.Home (75-166-85-218.hlrn.qwest.net [75.166.85.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 71BDA5609F; Tue, 12 Mar 2019 13:04:16 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Make remote.c ptid constants "const" Date: Tue, 12 Mar 2019 11:04:14 -0600 Message-Id: <20190312170414.31343-1-tromey@adacore.com> MIME-Version: 1.0 This changes magic_null_ptid, not_sent_ptid, and any_thread_ptid to be "const". This is a minor improvement that makes it so these can't be accidentally modified. Tested by rebuilding. I'm checking this in. gdb/ChangeLog 2019-03-12 Tom Tromey * remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): Now const. Add initializers. (_initialize_remote): Don't initialize ptid globals. --- gdb/ChangeLog | 6 ++++++ gdb/remote.c | 14 +++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index ef12fe9a3b4..d113f99e48c 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2297,9 +2297,11 @@ remote_target::remove_exec_catchpoint (int pid) -static ptid_t magic_null_ptid; -static ptid_t not_sent_ptid; -static ptid_t any_thread_ptid; +/* Take advantage of the fact that the TID field is not used, to tag + special ptids with it set to != 0. */ +static const ptid_t magic_null_ptid (42000, -1, 1); +static const ptid_t not_sent_ptid (42000, -2, 1); +static const ptid_t any_thread_ptid (42000, 0, 1); /* Find out if the stub attached to PID (and hence GDB should offer to detach instead of killing it when bailing out). */ @@ -14754,10 +14756,4 @@ stepping is supported by the target. The default is on."), /* Eventually initialize fileio. See fileio.c */ initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist); - - /* Take advantage of the fact that the TID field is not used, to tag - special ptids with it set to != 0. */ - magic_null_ptid = ptid_t (42000, -1, 1); - not_sent_ptid = ptid_t (42000, -2, 1); - any_thread_ptid = ptid_t (42000, 0, 1); }