From patchwork Wed Jun 13 21:50:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27815 Received: (qmail 41802 invoked by alias); 13 Jun 2018 21:51:13 -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 41572 invoked by uid 89); 13 Jun 2018 21:51:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*tom, remote.c, sk:linux_n, stubs X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 21:51:09 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 25F26113A56 for ; Wed, 13 Jun 2018 16:51:07 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id TDfJfhN5bbXuJTDfRfvGFE; Wed, 13 Jun 2018 16:51:07 -0500 X-Authority-Reason: nr=8 Received: from [12.176.89.6] (port=50304 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fTDfJ-001rOd-Ev; Wed, 13 Jun 2018 16:50:53 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 06/10] Remove ptid_is_pid Date: Wed, 13 Jun 2018 14:50:45 -0700 Message-Id: <20180613215049.9691-7-tom@tromey.com> In-Reply-To: <20180613215049.9691-1-tom@tromey.com> References: <20180613215049.9691-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fTDfJ-001rOd-Ev X-Source-Sender: (localhost.localdomain) [12.176.89.6]:50304 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes ptid_is_pid in favor of the ptid_t::is_pid method. ChangeLog 2018-06-13 Tom Tromey * common/ptid.c (ptid_is_pid): Remove. * common/ptid.h (ptid_is_pid): Don't declare. * infrun.c: Update. * linux-nat.c: Update. * mi/mi-interp.c: Update. * remote.c: Update. * thread.c: Update. gdbserver/ChangeLog 2018-06-13 Tom Tromey * linux-low.c: Update. --- gdb/ChangeLog | 10 ++++++++++ gdb/common/ptid.c | 8 -------- gdb/common/ptid.h | 4 ---- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/linux-low.c | 4 ++-- gdb/infrun.c | 2 +- gdb/linux-nat.c | 6 +++--- gdb/mi/mi-interp.c | 4 ++-- gdb/remote.c | 16 ++++++++-------- gdb/thread.c | 10 +++++----- 10 files changed, 35 insertions(+), 33 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 022ff24664..cc2eb23db6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2018-06-13 Tom Tromey + + * common/ptid.c (ptid_is_pid): Remove. + * common/ptid.h (ptid_is_pid): Don't declare. + * infrun.c: Update. + * linux-nat.c: Update. + * mi/mi-interp.c: Update. + * remote.c: Update. + * thread.c: Update. + 2018-06-13 Tom Tromey * common/ptid.c (ptid_get_tid): Remove. diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index 11ef61cf58..1e71104cdb 100644 --- a/gdb/common/ptid.c +++ b/gdb/common/ptid.c @@ -35,14 +35,6 @@ ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2) /* See ptid.h. */ -int -ptid_is_pid (const ptid_t &ptid) -{ - return ptid.is_pid (); -} - -/* See ptid.h. */ - int ptid_lwp_p (const ptid_t &ptid) { diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h index e5cc726293..61a8d5f710 100644 --- a/gdb/common/ptid.h +++ b/gdb/common/ptid.h @@ -160,10 +160,6 @@ extern ptid_t minus_one_ptid; extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2); -/* See ptid_t::is_pid. */ - -extern int ptid_is_pid (const ptid_t &ptid); - /* See ptid_t::lwp_p. */ extern int ptid_lwp_p (const ptid_t &ptid); diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index a2da59f858..aa81216ba1 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-06-13 Tom Tromey + + * linux-low.c: Update. + 2018-06-13 Tom Tromey * target.c: Update. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index a290b5b8b7..cef528bbb2 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -2635,7 +2635,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, /* Check for a lwp with a pending status. */ - if (ptid_equal (filter_ptid, minus_one_ptid) || ptid_is_pid (filter_ptid)) + if (ptid_equal (filter_ptid, minus_one_ptid) || filter_ptid.is_pid ()) { event_thread = find_thread_in_random ([&] (thread_info *thread) { @@ -4547,7 +4547,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n) /* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads of PID'. */ || (ptid.pid () == pid_of (thread) - && (ptid_is_pid (ptid) + && (ptid.is_pid () || ptid.lwp () == -1))) { if (resume[ndx].kind == resume_stop diff --git a/gdb/infrun.c b/gdb/infrun.c index b53d1dcb62..b40ff842c6 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3502,7 +3502,7 @@ do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options) /* First check if there is a resumed thread with a wait status pending. */ - if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid)) + if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) { tp = random_pending_event_thread (ptid); } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index bffbc74c74..6512fb7b93 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1692,7 +1692,7 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) /* A specific PTID means `step only this process id'. */ resume_many = (ptid_equal (minus_one_ptid, ptid) - || ptid_is_pid (ptid)); + || ptid.is_pid ()); /* Mark the lwps we're resuming as resumed. */ iterate_over_lwps (ptid, resume_set_callback, NULL); @@ -3249,7 +3249,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, /* The first time we get here after starting a new inferior, we may not have added it to the LWP list yet - this is the earliest moment at which we know its PID. */ - if (ptid_is_pid (inferior_ptid)) + if (inferior_ptid.is_pid ()) { /* Upgrade the main thread's ptid. */ thread_change_ptid (inferior_ptid, @@ -3383,7 +3383,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, /* If we're not waiting for a specific LWP, choose an event LWP from among those that have had events. Giving equal priority to all LWPs that have had events helps prevent starvation. */ - if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid)) + if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) select_event_lwp (ptid, &lp, &status); gdb_assert (lp != NULL); diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 0e10d89019..dcfee30907 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -991,7 +991,7 @@ mi_on_resume_1 (struct mi_interp *mi, ptid_t ptid) if (ptid.pid () == -1) fprintf_unfiltered (mi->raw_stdout, "*running,thread-id=\"all\"\n"); - else if (ptid_is_pid (ptid)) + else if (ptid.is_pid ()) { int count = 0; @@ -1031,7 +1031,7 @@ mi_on_resume (ptid_t ptid) { struct thread_info *tp = NULL; - if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid)) + if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) tp = inferior_thread (); else tp = find_thread_ptid (ptid); diff --git a/gdb/remote.c b/gdb/remote.c index 53359ca44a..ecf2136db3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2431,7 +2431,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing) struct inferior *inf = NULL; int pid = currthread.pid (); - if (ptid_is_pid (inferior_ptid) + if (inferior_ptid.is_pid () && pid == inferior_ptid.pid ()) { /* inferior_ptid has no thread member yet. This can happen @@ -6000,7 +6000,7 @@ remote_target::append_resumption (char *p, char *endp, threads with a wildcard (though the protocol allows it, so stubs shouldn't make an active effort to forbid it). */ - && !(remote_multi_process_p (rs) && ptid_is_pid (ptid))) + && !(remote_multi_process_p (rs) && ptid.is_pid ())) { struct thread_info *tp; @@ -6034,7 +6034,7 @@ remote_target::append_resumption (char *p, char *endp, else p += xsnprintf (p, endp - p, ";c"); - if (remote_multi_process_p (rs) && ptid_is_pid (ptid)) + if (remote_multi_process_p (rs) && ptid.is_pid ()) { ptid_t nptid; @@ -6187,7 +6187,7 @@ remote_target::remote_resume_with_vcont (ptid_t ptid, int step, a TID. */ append_resumption (p, endp, minus_one_ptid, step, siggnal); } - else if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid)) + else if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) { /* Resume all threads (of all processes, or of a single process), with preference for INFERIOR_PTID. This assumes @@ -6246,7 +6246,7 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal) { remote_thread_info *remote_thr; - if (ptid_equal (minus_one_ptid, ptid) || ptid_is_pid (ptid)) + if (ptid_equal (minus_one_ptid, ptid) || ptid.is_pid ()) remote_thr = get_remote_thread_info (inferior_ptid); else remote_thr = get_remote_thread_info (ptid); @@ -6607,7 +6607,7 @@ remote_target::remote_stop_ns (ptid_t ptid) error (_("Remote server does not support stopping threads")); if (ptid_equal (ptid, minus_one_ptid) - || (!remote_multi_process_p (rs) && ptid_is_pid (ptid))) + || (!remote_multi_process_p (rs) && ptid.is_pid ())) p += xsnprintf (p, endp - p, "vCont;t"); else { @@ -6615,7 +6615,7 @@ remote_target::remote_stop_ns (ptid_t ptid) p += xsnprintf (p, endp - p, "vCont;t:"); - if (ptid_is_pid (ptid)) + if (ptid.is_pid ()) /* All (-1) threads of process. */ nptid = ptid_t (ptid.pid (), -1, 0); else @@ -11444,7 +11444,7 @@ remote_target::pid_to_str (ptid_t ptid) if (ptid_equal (ptid, null_ptid)) return normal_pid_to_str (ptid); - else if (ptid_is_pid (ptid)) + else if (ptid.is_pid ()) { /* Printing an inferior target id. */ diff --git a/gdb/thread.c b/gdb/thread.c index 9b7ca847e9..8aeab01160 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -832,7 +832,7 @@ set_resumed (ptid_t ptid, int resumed) struct thread_info *tp; int all = ptid == minus_one_ptid; - if (all || ptid_is_pid (ptid)) + if (all || ptid.is_pid ()) { for (tp = thread_list; tp; tp = tp->next) if (all || tp->ptid.pid () == ptid.pid ()) @@ -880,7 +880,7 @@ set_running (ptid_t ptid, int running) /* We try not to notify the observer if no thread has actually changed the running state -- merely to reduce the number of messages to frontend. Frontend is supposed to handle multiple *running just fine. */ - if (all || ptid_is_pid (ptid)) + if (all || ptid.is_pid ()) { for (tp = thread_list; tp; tp = tp->next) if (all || tp->ptid.pid () == ptid.pid ()) @@ -948,7 +948,7 @@ set_executing (ptid_t ptid, int executing) struct thread_info *tp; int all = ptid == minus_one_ptid; - if (all || ptid_is_pid (ptid)) + if (all || ptid.is_pid ()) { for (tp = thread_list; tp; tp = tp->next) if (all || tp->ptid.pid () == ptid.pid ()) @@ -984,7 +984,7 @@ set_stop_requested (ptid_t ptid, int stop) struct thread_info *tp; int all = ptid == minus_one_ptid; - if (all || ptid_is_pid (ptid)) + if (all || ptid.is_pid ()) { for (tp = thread_list; tp; tp = tp->next) if (all || tp->ptid.pid () == ptid.pid ()) @@ -1012,7 +1012,7 @@ finish_thread_state (ptid_t ptid) all = ptid == minus_one_ptid; - if (all || ptid_is_pid (ptid)) + if (all || ptid.is_pid ()) { for (tp = thread_list; tp; tp = tp->next) {