From patchwork Wed Jun 13 21:50:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27816 Received: (qmail 41644 invoked by alias); 13 Jun 2018 21:51:12 -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 41484 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.7 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=lp, H*Ad:U*tom, tp, remote.c X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 21:51:09 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway24.websitewelcome.com (Postfix) with ESMTP id A534DD26C for ; Wed, 13 Jun 2018 16:51:07 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id TDfKfaBAuBcCXTDfRfP5ct; 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 1fTDfK-001rOd-Ak; Wed, 13 Jun 2018 16:50:54 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 09/10] Remove ptid_match Date: Wed, 13 Jun 2018 14:50:48 -0700 Message-Id: <20180613215049.9691-10-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: 1fTDfK-001rOd-Ak X-Source-Sender: (localhost.localdomain) [12.176.89.6]:50304 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes ptid_match in favor of the ptid_t::matches method. ChangeLog 2018-06-13 Tom Tromey * common/ptid.c (ptid_match): Remove. * common/ptid.h (ptid_match): Don't declare. * fbsd-nat.c: Update. * infcmd.c: Update. * infrun.c: Update. * linux-nat.c: Update. * record-btrace.c: Update. * regcache.c: Update. * remote.c: Update. gdbserver/ChangeLog 2018-06-13 Tom Tromey * server.c: Update. --- gdb/ChangeLog | 12 ++++++++++++ gdb/common/ptid.c | 8 -------- gdb/common/ptid.h | 4 ---- gdb/fbsd-nat.c | 2 +- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/server.c | 6 +++--- gdb/infcmd.c | 2 +- gdb/infrun.c | 12 ++++++------ gdb/linux-nat.c | 4 ++-- gdb/record-btrace.c | 14 +++++++------- gdb/regcache.c | 6 +++--- gdb/remote.c | 2 +- 12 files changed, 40 insertions(+), 36 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 243d74fd9c..5cbd26d247 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2018-06-13 Tom Tromey + + * common/ptid.c (ptid_match): Remove. + * common/ptid.h (ptid_match): Don't declare. + * fbsd-nat.c: Update. + * infcmd.c: Update. + * infrun.c: Update. + * linux-nat.c: Update. + * record-btrace.c: Update. + * regcache.c: Update. + * remote.c: Update. + 2018-06-13 Tom Tromey * common/ptid.c (ptid_tid_p): Remove. diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index e0f62b10f1..b9a331ad5e 100644 --- a/gdb/common/ptid.c +++ b/gdb/common/ptid.c @@ -32,11 +32,3 @@ ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2) { return ptid1 == ptid2; } - -/* See ptid.h. */ - -int -ptid_match (const ptid_t &ptid, const ptid_t &filter) -{ - return ptid.matches (filter); -} diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h index 86878de905..2fc84b9c85 100644 --- a/gdb/common/ptid.h +++ b/gdb/common/ptid.h @@ -160,8 +160,4 @@ extern ptid_t minus_one_ptid; extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2); -/* See ptid_t::matches. */ - -extern int ptid_match (const ptid_t &ptid, const ptid_t &filter); - #endif diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 88eb80ee25..2f7560b067 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1130,7 +1130,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) ALL_NON_EXITED_THREADS (tp) { - if (!ptid_match (tp->ptid, ptid)) + if (!tp->ptid.matches (ptid)) continue; if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index aa81216ba1..137e1cc4de 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-06-13 Tom Tromey + + * server.c: Update. + 2018-06-13 Tom Tromey * linux-low.c: Update. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 5c24315ecb..3c58c6eb10 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -190,7 +190,7 @@ remove_all_on_match_ptid (QUEUE (notif_event_p) *q, ptid_t filter_ptid = *(ptid_t *) data; struct vstop_notif *vstop_event = (struct vstop_notif *) event; - if (ptid_match (vstop_event->ptid, filter_ptid)) + if (vstop_event->ptid.matches (filter_ptid)) { if (q->free_func != NULL) q->free_func (event); @@ -229,13 +229,13 @@ in_queued_stop_replies_ptid (QUEUE (notif_event_p) *q, ptid_t filter_ptid = *(ptid_t *) data; struct vstop_notif *vstop_event = (struct vstop_notif *) event; - if (ptid_match (vstop_event->ptid, filter_ptid)) + if (vstop_event->ptid.matches (filter_ptid)) return 0; /* Don't resume fork children that GDB does not know about yet. */ if ((vstop_event->status.kind == TARGET_WAITKIND_FORKED || vstop_event->status.kind == TARGET_WAITKIND_VFORKED) - && ptid_match (vstop_event->status.value.related_pid, filter_ptid)) + && vstop_event->status.value.related_pid.matches (filter_ptid)) return 0; return 1; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 3c42a3aef4..32c968c6d9 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1353,7 +1353,7 @@ signal_command (const char *signum_exp, int from_tty) { if (ptid_equal (tp->ptid, inferior_ptid)) continue; - if (!ptid_match (tp->ptid, resume_ptid)) + if (!tp->ptid.matches (resume_ptid)) continue; if (tp->suspend.stop_signal != GDB_SIGNAL_0 diff --git a/gdb/infrun.c b/gdb/infrun.c index b40ff842c6..6e47fbd07e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2886,7 +2886,7 @@ clear_proceed_status (int step) we're about to resume, implicitly and explicitly. */ ALL_NON_EXITED_THREADS (tp) { - if (!ptid_match (tp->ptid, resume_ptid)) + if (!tp->ptid.matches (resume_ptid)) continue; clear_proceed_status_thread (tp); } @@ -3104,7 +3104,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal) continue; /* Ignore threads of processes we're not resuming. */ - if (!ptid_match (tp->ptid, resume_ptid)) + if (!tp->ptid.matches (resume_ptid)) continue; if (!thread_still_needs_step_over (tp)) @@ -3158,7 +3158,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal) ALL_NON_EXITED_THREADS (tp) { /* Ignore threads of processes we're not resuming. */ - if (!ptid_match (tp->ptid, resume_ptid)) + if (!tp->ptid.matches (resume_ptid)) continue; if (tp->resumed) @@ -3300,7 +3300,7 @@ infrun_thread_stop_requested (ptid_t ptid) thread had been temporarily paused for some step-over), set up for reporting the stop now. */ ALL_NON_EXITED_THREADS (tp) - if (ptid_match (tp->ptid, ptid)) + if (tp->ptid.matches (ptid)) { if (tp->state != THREAD_RUNNING) continue; @@ -3462,7 +3462,7 @@ random_pending_event_thread (ptid_t waiton_ptid) /* First see how many events we have. Count only resumed threads that have an event pending. */ ALL_NON_EXITED_THREADS (event_tp) - if (ptid_match (event_tp->ptid, waiton_ptid) + if (event_tp->ptid.matches (waiton_ptid) && event_tp->resumed && event_tp->suspend.waitstatus_pending_p) num_events++; @@ -3481,7 +3481,7 @@ random_pending_event_thread (ptid_t waiton_ptid) /* Select the Nth thread that has had an event. */ ALL_NON_EXITED_THREADS (event_tp) - if (ptid_match (event_tp->ptid, waiton_ptid) + if (event_tp->ptid.matches (waiton_ptid) && event_tp->resumed && event_tp->suspend.waitstatus_pending_p) if (random_selector-- == 0) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index a0ecb654e0..29a8612f12 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -958,7 +958,7 @@ iterate_over_lwps (ptid_t filter, { lpnext = lp->next; - if (ptid_match (lp->ptid, filter)) + if (lp->ptid.matches (filter)) { if ((*callback) (lp, data) != 0) return lp; @@ -3507,7 +3507,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, void *data) /* Don't bother if there's a breakpoint at PC that we'd hit immediately, and we're not waiting for this LWP. */ - if (!ptid_match (lp->ptid, *wait_ptid_p)) + if (!lp->ptid.matches (*wait_ptid_p)) { if (breakpoint_inserted_here_p (regcache->aspace (), pc)) leave_stopped = 1; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index f3bf68c260..95b46ac5cd 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1401,7 +1401,7 @@ record_btrace_target::record_is_replaying (ptid_t ptid) struct thread_info *tp; ALL_NON_EXITED_THREADS (tp) - if (ptid_match (tp->ptid, ptid) && btrace_is_replaying (tp)) + if (tp->ptid.matches (ptid) && btrace_is_replaying (tp)) return true; return false; @@ -2183,12 +2183,12 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal) For all-stop targets, we only step INFERIOR_PTID and continue others. */ if (!target_is_non_stop_p ()) { - gdb_assert (ptid_match (inferior_ptid, ptid)); + gdb_assert (inferior_ptid.matches (ptid)); ALL_NON_EXITED_THREADS (tp) - if (ptid_match (tp->ptid, ptid)) + if (tp->ptid.matches (ptid)) { - if (ptid_match (tp->ptid, inferior_ptid)) + if (tp->ptid.matches (inferior_ptid)) record_btrace_resume_thread (tp, flag); else record_btrace_resume_thread (tp, cflag); @@ -2197,7 +2197,7 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal) else { ALL_NON_EXITED_THREADS (tp) - if (ptid_match (tp->ptid, ptid)) + if (tp->ptid.matches (ptid)) record_btrace_resume_thread (tp, flag); } @@ -2565,7 +2565,7 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status, ALL_NON_EXITED_THREADS (tp) { - if (ptid_match (tp->ptid, ptid) + if (tp->ptid.matches (ptid) && ((tp->btrace.flags & (BTHR_MOVE | BTHR_STOP)) != 0)) moving.push_back (tp); } @@ -2692,7 +2692,7 @@ record_btrace_target::stop (ptid_t ptid) struct thread_info *tp; ALL_NON_EXITED_THREADS (tp) - if (ptid_match (tp->ptid, ptid)) + if (tp->ptid.matches (ptid)) { tp->btrace.flags &= ~BTHR_MOVE; tp->btrace.flags |= BTHR_STOP; diff --git a/gdb/regcache.c b/gdb/regcache.c index 750ea2ad30..f1f2e9e176 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -448,7 +448,7 @@ registers_changed_ptid (ptid_t ptid) it != regcache::current_regcache.end (); ) { - if (ptid_match ((*it)->ptid (), ptid)) + if ((*it)->ptid ().matches (ptid)) { delete *it; it = regcache::current_regcache.erase_after (oit); @@ -457,13 +457,13 @@ registers_changed_ptid (ptid_t ptid) oit = it++; } - if (ptid_match (current_thread_ptid, ptid)) + if (current_thread_ptid.matches (ptid)) { current_thread_ptid = null_ptid; current_thread_arch = NULL; } - if (ptid_match (inferior_ptid, ptid)) + if (inferior_ptid.matches (ptid)) { /* We just deleted the regcache of the current thread. Need to forget about any frames we have cached, too. */ diff --git a/gdb/remote.c b/gdb/remote.c index ecf2136db3..2d748c7268 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6077,7 +6077,7 @@ remote_target::append_pending_thread_resumptions (char *p, char *endp, struct thread_info *thread; ALL_NON_EXITED_THREADS (thread) - if (ptid_match (thread->ptid, ptid) + if (thread->ptid.matches (ptid) && !ptid_equal (inferior_ptid, thread->ptid) && thread->suspend.stop_signal != GDB_SIGNAL_0) {