From 0e998d966be13e548721109a4e44b2887fc5cb24 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 11 Jun 2018 12:18:15 -0600 Subject: [PATCH] Remove ptid_is_pid This removes ptid_is_pid in favor of the ptid_t::is_pid method. gdb/ChangeLog 2018-07-03 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. gdb/gdbserver/ChangeLog 2018-07-03 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 e0a3322e257..5cbe1ae4839 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2018-07-03 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-07-03 Tom Tromey * common/ptid.c (ptid_get_tid): Remove. diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index 11ef61cf582..1e71104cdb7 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 e5cc7262931..61a8d5f7104 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 5ecaf48a202..52335cfa8e1 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-07-03 Tom Tromey + + * linux-low.c: Update. + 2018-07-03 Tom Tromey * target.c: Update. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index a290b5b8b73..cef528bbb20 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 91c7d1e61da..c1a0cad17a8 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3493,7 +3493,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 d06bf7752b3..5d693659f0f 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1691,7 +1691,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); @@ -3255,7 +3255,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, @@ -3389,7 +3389,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 1f368190f85..9a48ee0c8fe 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -970,7 +970,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; inferior *inf; @@ -1023,7 +1023,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 0d64458cb17..834305831c5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2435,7 +2435,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 @@ -5998,7 +5998,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; @@ -6032,7 +6032,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; @@ -6185,7 +6185,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 @@ -6244,7 +6244,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); @@ -6605,7 +6605,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 { @@ -6613,7 +6613,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 @@ -11442,7 +11442,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 3f3d6f2cc45..517a80715ea 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -799,7 +799,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 ()) @@ -856,7 +856,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 ()) @@ -936,7 +936,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 ()) @@ -972,7 +972,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 ()) @@ -1000,7 +1000,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) { -- 2.39.2