public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 05/10] Remove ptid_get_tid
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (5 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 03/10] Remove ptid_get_pid Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 02/10] Remove pid_to_ptid Tom Tromey
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_get_tid in favor of calling the ptid_t::tid method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_get_tid): Remove.
	* common/ptid.h (ptid_get_tid): Don't declare.
	* ada-tasks.c: Update.
	* aix-thread.c: Update.
	* bsd-uthread.c: Update.
	* darwin-nat.c: Update.
	* fbsd-nat.c: Update.
	* i386-darwin-nat.c: Update.
	* infrun.c: Update.
	* linux-tdep.c: Update.
	* nto-procfs.c: Update.
	* ppc-ravenscar-thread.c: Update.
	* python/py-infthread.c: Update.
	* ravenscar-thread.c: Update.
	* sol-thread.c: Update.
	* sparc-ravenscar-thread.c: Update.
	* windows-nat.c: Update.

gdbserver/ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* target.c: Update.
---
 gdb/ChangeLog                | 20 ++++++++++++++++++++
 gdb/ada-tasks.c              |  2 +-
 gdb/aix-thread.c             |  8 ++++----
 gdb/bsd-uthread.c            | 18 +++++++++---------
 gdb/common/ptid.c            |  8 --------
 gdb/common/ptid.h            |  4 ----
 gdb/darwin-nat.c             | 12 ++++++------
 gdb/fbsd-nat.c               |  2 +-
 gdb/gdbserver/ChangeLog      |  4 ++++
 gdb/gdbserver/target.c       |  4 ++--
 gdb/i386-darwin-nat.c        |  8 ++++----
 gdb/infrun.c                 |  8 ++++----
 gdb/linux-tdep.c             |  2 +-
 gdb/nto-procfs.c             |  6 +++---
 gdb/ppc-ravenscar-thread.c   |  4 ++--
 gdb/python/py-infthread.c    |  2 +-
 gdb/ravenscar-thread.c       |  4 ++--
 gdb/sol-thread.c             | 20 ++++++++++----------
 gdb/sparc-ravenscar-thread.c |  4 ++--
 gdb/windows-nat.c            | 30 +++++++++++++++---------------
 20 files changed, 91 insertions(+), 79 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6d5e42d1b1..022ff24664 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,23 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (ptid_get_tid): Remove.
+	* common/ptid.h (ptid_get_tid): Don't declare.
+	* ada-tasks.c: Update.
+	* aix-thread.c: Update.
+	* bsd-uthread.c: Update.
+	* darwin-nat.c: Update.
+	* fbsd-nat.c: Update.
+	* i386-darwin-nat.c: Update.
+	* infrun.c: Update.
+	* linux-tdep.c: Update.
+	* nto-procfs.c: Update.
+	* ppc-ravenscar-thread.c: Update.
+	* python/py-infthread.c: Update.
+	* ravenscar-thread.c: Update.
+	* sol-thread.c: Update.
+	* sparc-ravenscar-thread.c: Update.
+	* windows-nat.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.c (ptid_get_lwp): Remove.
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index ff98eeffab..a75aa0f9f1 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1203,7 +1203,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
     printf_filtered (_("<no name>\n"));
 
   /* Print the TID and LWP.  */
-  printf_filtered (_("Thread: %#lx\n"), ptid_get_tid (task_info->ptid));
+  printf_filtered (_("Thread: %#lx\n"), task_info->ptid.tid ());
   printf_filtered (_("LWP: %#lx\n"), task_info->ptid.lwp ());
 
   /* If set, print the base CPU.  */
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 26db82b179..31ba760912 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -70,7 +70,7 @@ static int debug_aix_thread;
 
 /* Return whether to treat PID as a debuggable thread id.  */
 
-#define PD_TID(ptid)	(pd_active && ptid_get_tid (ptid) != 0)
+#define PD_TID(ptid)	(pd_active && ptid.tid () != 0)
 
 /* pthdb_user_t value that we pass to pthdb functions.  0 causes
    PTHDB_BAD_USER errors, so use 1.  */
@@ -677,9 +677,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2)
     return -1;
   else if (ptid1.pid () > ptid2.pid ())
     return 1;
-  else if (ptid_get_tid (ptid1) < ptid_get_tid (ptid2))
+  else if (ptid1.tid () < ptid2.tid ())
     return -1;
-  else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2))
+  else if (ptid1.tid () > ptid2.tid ())
     return 1;
   else if (ptid1.lwp () < ptid2.lwp ())
     return -1;
@@ -1766,7 +1766,7 @@ aix_thread_target::pid_to_str (ptid_t ptid)
      xstrprintf().  */
   xfree (ret);
 
-  ret = xstrprintf (_("Thread %ld"), ptid_get_tid (ptid));
+  ret = xstrprintf (_("Thread %ld"), ptid.tid ());
   return ret;
 }
 
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index c7fb671ec6..94d8a2ded1 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -321,7 +321,7 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum)
   struct bsd_uthread_ops *uthread_ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
   ptid_t ptid = regcache->ptid ();
-  CORE_ADDR addr = ptid_get_tid (ptid);
+  CORE_ADDR addr = ptid.tid ();
   CORE_ADDR active_addr;
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
@@ -353,7 +353,7 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
   struct bsd_uthread_ops *uthread_ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
   ptid_t ptid = regcache->ptid ();
-  CORE_ADDR addr = ptid_get_tid (ptid);
+  CORE_ADDR addr = ptid.tid ();
   CORE_ADDR active_addr;
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
@@ -414,8 +414,8 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
   /* If INFERIOR_PTID doesn't have a tid member yet, and we now have a
      ptid with tid set, then ptid is still the initial thread of
      the process.  Notify GDB core about it.  */
-  if (ptid_get_tid (inferior_ptid) == 0
-      && ptid_get_tid (ptid) != 0 && !in_thread_list (ptid))
+  if (inferior_ptid.tid () == 0
+      && ptid.tid () != 0 && !in_thread_list (ptid))
     thread_change_ptid (inferior_ptid, ptid);
 
   /* Don't let the core see a ptid without a corresponding thread.  */
@@ -436,7 +436,7 @@ bool
 bsd_uthread_target::thread_alive (ptid_t ptid)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
-  CORE_ADDR addr = ptid_get_tid (ptid);
+  CORE_ADDR addr = ptid.tid ();
 
   if (addr != 0)
     {
@@ -472,7 +472,7 @@ bsd_uthread_target::update_thread_list ()
 	  /* If INFERIOR_PTID doesn't have a tid member yet, then ptid
 	     is still the initial thread of the process.  Notify GDB
 	     core about it.  */
-	  if (ptid_get_tid (inferior_ptid) == 0)
+	  if (inferior_ptid.tid () == 0)
 	    thread_change_ptid (inferior_ptid, ptid);
 	  else
 	    add_thread (ptid);
@@ -514,7 +514,7 @@ const char *
 bsd_uthread_target::extra_thread_info (thread_info *info)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
-  CORE_ADDR addr = ptid_get_tid (info->ptid);
+  CORE_ADDR addr = info->ptid.tid ();
 
   if (addr != 0)
     {
@@ -532,12 +532,12 @@ bsd_uthread_target::extra_thread_info (thread_info *info)
 const char *
 bsd_uthread_target::pid_to_str (ptid_t ptid)
 {
-  if (ptid_get_tid (ptid) != 0)
+  if (ptid.tid () != 0)
     {
       static char buf[64];
 
       xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx",
-		 ptid.pid (), ptid_get_tid (ptid));
+		 ptid.pid (), ptid.tid ());
       return buf;
     }
 
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 85cb4ca81c..11ef61cf58 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
 
 /* See ptid.h.  */
 
-long
-ptid_get_tid (const ptid_t &ptid)
-{
-  return ptid.tid ();
-}
-
-/* See ptid.h.  */
-
 int
 ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 5eeecdd9f9..e5cc726293 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
 /* The following functions are kept for backwards compatibility.  The use of
    the ptid_t methods is preferred.  */
 
-/* See ptid_t::tid.  */
-
-extern long ptid_get_tid (const ptid_t &ptid);
-
 /* See ptid_t::operator== and ptid_t::operator!=.  */
 
 extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2);
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 4337b51a02..7f6441d273 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -928,7 +928,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
 
   inferior_debug
     (2, _("darwin_resume: pid=%d, tid=0x%lx, step=%d, signal=%d\n"),
-     ptid.pid (), ptid_get_tid (ptid), step, signal);
+     ptid.pid (), ptid.tid (), step, signal);
 
   if (signal == GDB_SIGNAL_0)
     nsignal = 0;
@@ -955,7 +955,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
   else
     {
       struct inferior *inf = find_inferior_ptid (ptid);
-      long tid = ptid_get_tid (ptid);
+      long tid = ptid.tid ();
 
       /* Stop the inferior (should be useless).  */
       darwin_suspend_inferior (inf);
@@ -1170,7 +1170,7 @@ cancel_breakpoint (ptid_t ptid)
   if (breakpoint_inserted_here_p (regcache->aspace (), pc))
     {
       inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n",
-		      (unsigned long) ptid_get_tid (ptid));
+		      (unsigned long) ptid.tid ());
 
       /* Back up the PC if necessary.  */
       if (gdbarch_decr_pc_after_break (gdbarch))
@@ -1197,7 +1197,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 
   inferior_debug
     (2, _("darwin_wait: waiting for a message pid=%d thread=%lx\n"),
-     ptid.pid (), ptid_get_tid (ptid));
+     ptid.pid (), ptid.tid ());
 
   /* Handle fake stop events at first.  */
   if (darwin_inf_fake_stop != NULL)
@@ -1889,7 +1889,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
 
   darwin_inferior *priv = get_darwin_inferior (inf);
 
-  darwin_check_osabi (priv, ptid_get_tid (inferior_ptid));
+  darwin_check_osabi (priv, inferior_ptid.tid ());
 
   darwin_setup_fake_stop_event (inf);
 
@@ -1945,7 +1945,7 @@ const char *
 darwin_nat_target::pid_to_str (ptid_t ptid)
 {
   static char buf[80];
-  long tid = ptid_get_tid (ptid);
+  long tid = ptid.tid ();
 
   if (tid != 0)
     {
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index ab16d1cbec..2adb7a437f 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1101,7 +1101,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
     fprintf_unfiltered (gdb_stdlog,
 			"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
 			ptid.pid (), ptid.lwp (),
-			ptid_get_tid (ptid));
+			ptid.tid ());
   if (ptid_lwp_p (ptid))
     {
       /* If ptid is a specific LWP, suspend all other LWPs in the process.  */
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 938b76a2d6..a2da59f858 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* target.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* linux-low.c: Update.
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index aff316da22..81d7cc471a 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -318,9 +318,9 @@ target_pid_to_str (ptid_t ptid)
     xsnprintf (buf, sizeof (buf), "<all threads>");
   else if (ptid_equal (ptid, null_ptid))
     xsnprintf (buf, sizeof (buf), "<null thread>");
-  else if (ptid_get_tid (ptid) != 0)
+  else if (ptid.tid () != 0)
     xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
-	       ptid.pid (), ptid_get_tid (ptid));
+	       ptid.pid (), ptid.tid ());
   else if (ptid.lwp () != 0)
     xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
 	       ptid.pid (), ptid.lwp ());
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index fbe6668bff..2304f4a6d3 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -59,7 +59,7 @@ static struct i386_darwin_nat_target darwin_target;
 void
 i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
 {
-  thread_t current_thread = ptid_get_tid (regcache->ptid ());
+  thread_t current_thread = regcache->ptid ().tid ();
   int fetched = 0;
   struct gdbarch *gdbarch = regcache->arch ();
 
@@ -175,7 +175,7 @@ void
 i386_darwin_nat_target::store_registers (struct regcache *regcache,
 					 int regno)
 {
-  thread_t current_thread = ptid_get_tid (regcache->ptid ());
+  thread_t current_thread = regcache->ptid ().tid ();
   struct gdbarch *gdbarch = regcache->arch ();
 
 #ifdef BFD64
@@ -288,7 +288,7 @@ i386_darwin_dr_set (int regnum, CORE_ADDR value)
 
   gdb_assert (regnum >= 0 && regnum <= DR_CONTROL);
 
-  current_thread = ptid_get_tid (inferior_ptid);
+  current_thread = inferior_ptid.tid ();
 
   dr_regs.dsh.flavor = x86_DEBUG_STATE;
   dr_regs.dsh.count = x86_DEBUG_STATE_COUNT;
@@ -377,7 +377,7 @@ i386_darwin_dr_get (int regnum)
 
   gdb_assert (regnum >= 0 && regnum <= DR_CONTROL);
 
-  current_thread = ptid_get_tid (inferior_ptid);
+  current_thread = inferior_ptid.tid ();
 
   dr_regs.dsh.flavor = x86_DEBUG_STATE;
   dr_regs.dsh.count = x86_DEBUG_STATE_COUNT;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 18bdd39bfd..b53d1dcb62 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3433,14 +3433,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
   stb.printf ("infrun: target_wait (%d.%ld.%ld",
 	      waiton_ptid.pid (),
 	      waiton_ptid.lwp (),
-	      ptid_get_tid (waiton_ptid));
+	      waiton_ptid.tid ());
   if (waiton_ptid.pid () != -1)
     stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
   stb.printf (", status) =\n");
   stb.printf ("infrun:   %d.%ld.%ld [%s],\n",
 	      result_ptid.pid (),
 	      result_ptid.lwp (),
-	      ptid_get_tid (result_ptid),
+	      result_ptid.tid (),
 	      target_pid_to_str (result_ptid));
   stb.printf ("infrun:   %s\n", status_string.c_str ());
 
@@ -4397,7 +4397,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
 			  statstr.c_str (),
 			  tp->ptid.pid (),
 			  tp->ptid.lwp (),
-			  ptid_get_tid (tp->ptid));
+			  tp->ptid.tid ());
     }
 
   /* Record for later.  */
@@ -4635,7 +4635,7 @@ stop_all_threads (void)
 					  statstr.c_str (),
 					  t->ptid.pid (),
 					  t->ptid.lwp (),
-					  ptid_get_tid (t->ptid));
+					  t->ptid.tid ());
 		    }
 
 		  /* Record for later.  */
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 12455a79f6..5edf2ef200 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1634,7 +1634,7 @@ linux_collect_thread_registers (const struct regcache *regcache,
   /* For remote targets the LWP may not be available, so use the TID.  */
   data.lwp = ptid.lwp ();
   if (!data.lwp)
-    data.lwp = ptid_get_tid (ptid);
+    data.lwp = ptid.tid ();
 
   gdbarch_iterate_over_regset_sections (gdbarch,
 					linux_collect_regset_section_cb,
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 53797c8981..d140068c05 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -296,7 +296,7 @@ procfs_set_thread (ptid_t ptid)
 {
   pid_t tid;
 
-  tid = ptid_get_tid (ptid);
+  tid = ptid.tid ();
   devctl (ctl_fd, DCMD_PROC_CURTHREAD, &tid, sizeof (tid), 0);
 }
 
@@ -310,7 +310,7 @@ nto_procfs_target::thread_alive (ptid_t ptid)
   procfs_status status;
   int err;
 
-  tid = ptid_get_tid (ptid);
+  tid = ptid.tid ();
   pid = ptid.pid ();
 
   if (kill (pid, 0) == -1)
@@ -1469,7 +1469,7 @@ nto_procfs_target::pid_to_str (ptid_t ptid)
   struct tidinfo *tip;
 
   pid = ptid.pid ();
-  tid = ptid_get_tid (ptid);
+  tid = ptid.tid ();
 
   n = snprintf (buf, 1023, "process %d", pid);
 
diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c
index 7b83e451ff..1b2e3925c2 100644
--- a/gdb/ppc-ravenscar-thread.c
+++ b/gdb/ppc-ravenscar-thread.c
@@ -154,7 +154,7 @@ ppc_ravenscar_generic_fetch_registers
   CORE_ADDR thread_descriptor_address;
 
   /* The tid is the thread_id field, which is a pointer to the thread.  */
-  thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid);
+  thread_descriptor_address = (CORE_ADDR) inferior_ptid.tid ();
 
   /* Read registers.  */
   for (current_regnum = 0; current_regnum < num_regs; current_regnum++)
@@ -193,7 +193,7 @@ ppc_ravenscar_generic_store_registers
 
   if (register_in_thread_descriptor_p (reg_info, regnum))
     register_address
-      = ptid_get_tid (inferior_ptid) + reg_info->context_offsets [regnum];
+      = inferior_ptid.tid () + reg_info->context_offsets [regnum];
   else
     return;
 
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index a24d1f4a3a..9d006006b4 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -268,7 +268,7 @@ gdbpy_create_ptid_object (ptid_t ptid)
 
   pid = ptid.pid ();
   lwp = ptid.lwp ();
-  tid = ptid_get_tid (ptid);
+  tid = ptid.tid ();
 
   PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));
   PyTuple_SET_ITEM (ret, 1, PyInt_FromLong (lwp));
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index fccb37ebda..0e6b9eb88c 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid)
      2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
      query, which the remote protocol layer then treats as a thread
      whose TID is 0.  This is obviously not a ravenscar task.  */
-  return ptid.lwp () == 0 && ptid_get_tid (ptid) != 0;
+  return ptid.lwp () == 0 && ptid.tid () != 0;
 }
 
 /* Given PTID, which can be either a ravenscar task or a CPU thread,
@@ -405,7 +405,7 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid)
 {
   static char buf[30];
 
-  snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid_get_tid (ptid));
+  snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid.tid ());
   return buf;
 }
 
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index c5540577f0..95248f2c17 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -305,7 +305,7 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
 
   /* It's a thread.  Convert to LWP.  */
 
-  val = p_td_ta_map_id2thr (main_ta, ptid_get_tid (thread_id), &th);
+  val = p_td_ta_map_id2thr (main_ta, thread_id.tid (), &th);
   if (val == TD_NOTHR)
     return ptid_t (-1);	/* Thread must have terminated.  */
   else if (val != TD_OK)
@@ -415,7 +415,7 @@ sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 	error (_("This version of Solaris can't start inactive threads."));
       if (info_verbose && ptid.pid () == -1)
 	warning (_("Specified thread %ld seems to have terminated"),
-		 ptid_get_tid (save_ptid));
+		 save_ptid.tid ());
     }
 
   beneath ()->resume (ptid, step, signo);
@@ -447,7 +447,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	error (_("This version of Solaris can't start inactive threads."));
       if (info_verbose && ptid.pid () == -1)
 	warning (_("Specified thread %ld seems to have terminated"),
-		 ptid_get_tid (save_ptid));
+		 save_ptid.tid ());
     }
 
   rtnval = beneath ()->wait (ptid, ourstatus, options);
@@ -494,7 +494,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
     }
 
   /* Solaris thread: convert PTID into a td_thrhandle_t.  */
-  thread = ptid_get_tid (ptid);
+  thread = ptid.tid ();
   if (thread == 0)
     error (_("sol_thread_fetch_registers: thread == 0"));
 
@@ -546,7 +546,7 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
     }
 
   /* Solaris thread: convert PTID into a td_thrhandle_t.  */
-  thread = ptid_get_tid (ptid);
+  thread = ptid.tid ();
 
   val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
   if (val != TD_OK)
@@ -704,7 +704,7 @@ sol_thread_target::thread_alive (ptid_t ptid)
       td_thrhandle_t th;
       int pid;
 
-      pid = ptid_get_tid (ptid);
+      pid = ptid.tid ();
       if ((val = p_td_ta_map_id2thr (main_ta, pid, &th)) != TD_OK)
 	return false;		/* Thread not found.  */
       if ((val = p_td_thr_validate (&th)) != TD_OK)
@@ -1011,13 +1011,13 @@ sol_thread_target::pid_to_str (ptid_t ptid)
 
       if (lwp.pid () == -1)
 	xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)",
-		   ptid_get_tid (ptid));
+		   ptid.tid ());
       else if (lwp.pid () != -2)
 	xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
-		 ptid_get_tid (ptid), lwp.lwp ());
+		 ptid.tid (), lwp.lwp ());
       else
 	xsnprintf (buf, sizeof (buf), "Thread %ld        ",
-		   ptid_get_tid (ptid));
+		   ptid.tid ());
     }
   else if (ptid.lwp () != 0)
     xsnprintf (buf, sizeof (buf), "LWP    %ld        ", ptid.lwp ());
@@ -1157,7 +1157,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
 {
   long *tid = (long *) data;
 
-  if (ptid_get_tid (thread->ptid) == *tid)
+  if (thread->ptid.tid () == *tid)
     return 1;
 
   return 0;
diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c
index 0b4d68a4a4..b076232e04 100644
--- a/gdb/sparc-ravenscar-thread.c
+++ b/gdb/sparc-ravenscar-thread.c
@@ -112,7 +112,7 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum)
   ULONGEST stack_address;
 
   /* The tid is the thread_id field, which is a pointer to the thread.  */
-  thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid);
+  thread_descriptor_address = (CORE_ADDR) inferior_ptid.tid ();
 
   /* Read the saved SP in the context buffer.  */
   current_address = thread_descriptor_address
@@ -162,7 +162,7 @@ sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
 
   if (register_in_thread_descriptor_p (regnum))
     register_address =
-      ptid_get_tid (inferior_ptid) + sparc_register_offsets [regnum];
+      inferior_ptid.tid () + sparc_register_offsets [regnum];
   else if (register_on_stack_p (regnum))
     {
       regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM,
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 440211a1db..08652a6754 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -427,9 +427,9 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
   windows_thread_info *th;
   DWORD id;
 
-  gdb_assert (ptid_get_tid (ptid) != 0);
+  gdb_assert (ptid.tid () != 0);
 
-  id = ptid_get_tid (ptid);
+  id = ptid.tid ();
 
   if ((th = thread_rec (id, FALSE)))
     return th;
@@ -484,9 +484,9 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
   windows_thread_info *th;
   DWORD id;
 
-  gdb_assert (ptid_get_tid (ptid) != 0);
+  gdb_assert (ptid.tid () != 0);
 
-  id = ptid_get_tid (ptid);
+  id = ptid.tid ();
 
   if (info_verbose)
     printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (ptid));
@@ -582,7 +582,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache,
 void
 windows_nat_target::fetch_registers (struct regcache *regcache, int r)
 {
-  DWORD pid = ptid_get_tid (regcache->ptid ());
+  DWORD pid = regcache->ptid ().tid ();
   windows_thread_info *th = thread_rec (pid, TRUE);
 
   /* Check if TH exists.  Windows sometimes uses a non-existent
@@ -610,7 +610,7 @@ do_windows_store_inferior_registers (const struct regcache *regcache,
 void
 windows_nat_target::store_registers (struct regcache *regcache, int r)
 {
-  DWORD pid = ptid_get_tid (regcache->ptid ());
+  DWORD pid = regcache->ptid ().tid ();
   windows_thread_info *th = thread_rec (pid, TRUE);
 
   /* Check if TH exists.  Windows sometimes uses a non-existent
@@ -1408,10 +1408,10 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
   last_sig = GDB_SIGNAL_0;
 
   DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
-	       ptid.pid (), ptid_get_tid (ptid), step, sig));
+	       ptid.pid (), ptid.tid (), step, sig));
 
   /* Get context for currently selected thread.  */
-  th = thread_rec (ptid_get_tid (inferior_ptid), FALSE);
+  th = thread_rec (inferior_ptid.tid (), FALSE);
   if (th)
     {
       if (step)
@@ -1445,7 +1445,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
   if (resume_all)
     windows_continue (continue_status, -1, 0);
   else
-    windows_continue (continue_status, ptid_get_tid (ptid), 0);
+    windows_continue (continue_status, ptid.tid (), 0);
 }
 
 /* Ctrl-C handler used when the inferior is not run in the same console.  The
@@ -2896,10 +2896,10 @@ windows_nat_target::pid_to_str (ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_get_tid (ptid) != 0)
+  if (ptid.tid () != 0)
     {
       snprintf (buf, sizeof (buf), "Thread %d.0x%lx",
-		ptid.pid (), ptid_get_tid (ptid));
+		ptid.pid (), ptid.tid ());
       return buf;
     }
 
@@ -2986,7 +2986,7 @@ windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
 {
   windows_thread_info *th;
 
-  th = thread_rec (ptid_get_tid (ptid), 0);
+  th = thread_rec (ptid.tid (), 0);
   if (th == NULL)
     return false;
 
@@ -3007,7 +3007,7 @@ windows_nat_target::get_ada_task_ptid (long lwp, long thread)
 const char *
 windows_nat_target::thread_name (struct thread_info *thr)
 {
-  return thread_rec (ptid_get_tid (thr->ptid), 0)->name;
+  return thread_rec (thr->ptid.tid (), 0)->name;
 }
 
 
@@ -3167,8 +3167,8 @@ windows_nat_target::thread_alive (ptid_t ptid)
 {
   int tid;
 
-  gdb_assert (ptid_get_tid (ptid) != 0);
-  tid = ptid_get_tid (ptid);
+  gdb_assert (ptid.tid () != 0);
+  tid = ptid.tid ();
 
   return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) != WAIT_OBJECT_0;
 }
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 09/10] Remove ptid_match
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (2 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 08/10] Remove ptid_tid_p Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 06/10] Remove ptid_is_pid Tom Tromey
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_match in favor of the ptid_t::matches method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* 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  <tom@tromey.com>

	* 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  <tom@tromey.com>
+
+	* 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  <tom@tromey.com>
 
 	* 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  <tom@tromey.com>
+
+	* server.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* 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)
       {
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 00/10] Remove standalone ptid functions
@ 2018-06-13 21:51 Tom Tromey
  2018-06-13 21:51 ` [RFA 07/10] Remove ptid_lwp_p Tom Tromey
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches

This series removes the remaining standalone ptid functions in favor
of using methods on ptid_t.

These patches were largely created by running a script.

Tested by the buildbot.

Tom

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 04/10] Remove ptid_get_lwp
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (7 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 02/10] Remove pid_to_ptid Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 01/10] Remove ptid_build Tom Tromey
  2018-06-13 23:22 ` [RFA 00/10] Remove standalone ptid functions Joel Brobecker
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_get_lwp in favor of calling the ptid_t::lwp method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_get_lwp): Remove.
	* common/ptid.h (ptid_get_lwp): Don't declare.
	* aarch64-linux-nat.c: Update.
	* ada-tasks.c: Update.
	* aix-thread.c: Update.
	* amd64-linux-nat.c: Update.
	* arm-linux-nat.c: Update.
	* corelow.c: Update.
	* fbsd-nat.c: Update.
	* fbsd-tdep.c: Update.
	* gnu-nat.c: Update.
	* i386-cygwin-tdep.c: Update.
	* i386-gnu-nat.c: Update.
	* i386-linux-nat.c: Update.
	* ia64-linux-nat.c: Update.
	* inf-ptrace.c: Update.
	* infrun.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-tdep.c: Update.
	* linux-thread-db.c: Update.
	* mips-linux-nat.c: Update.
	* nat/aarch64-linux-hw-point.c: Update.
	* nat/aarch64-linux.c: Update.
	* nat/linux-btrace.c: Update.
	* nat/linux-osdata.c: Update.
	* nat/linux-procfs.c: Update.
	* nat/x86-linux-dregs.c: Update.
	* obsd-nat.c: Update.
	* ppc-fbsd-nat.c: Update.
	* ppc-linux-nat.c: Update.
	* procfs.c: Update.
	* python/py-infthread.c: Update.
	* ravenscar-thread.c: Update.
	* remote.c: Update.
	* s390-linux-nat.c: Update.
	* sol-thread.c: Update.
	* sol2-tdep.c: Update.
	* spu-linux-nat.c: Update.
	* x86-linux-nat.c: Update.
	* xtensa-linux-nat.c: Update.

gdbserver/ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* linux-low.c: Update.
	* linux-mips-low.c: Update.
	* lynx-low.c: Update.
	* nto-low.c: Update.
	* remote-utils.c: Update.
	* server.c: Update.
	* spu-low.c: Update.
	* target.c: Update.
	* thread-db.c: Update.
---
 gdb/ChangeLog                    | 44 ++++++++++++++++++++
 gdb/aarch64-linux-nat.c          | 10 ++---
 gdb/ada-tasks.c                  |  2 +-
 gdb/aix-thread.c                 |  8 ++--
 gdb/amd64-linux-nat.c            |  4 +-
 gdb/arm-linux-nat.c              | 24 +++++------
 gdb/common/ptid.c                |  8 ----
 gdb/common/ptid.h                |  4 --
 gdb/corelow.c                    |  2 +-
 gdb/fbsd-nat.c                   | 14 +++----
 gdb/fbsd-tdep.c                  |  8 ++--
 gdb/gdbserver/ChangeLog          | 12 ++++++
 gdb/gdbserver/linux-low.c        | 10 ++---
 gdb/gdbserver/linux-mips-low.c   |  2 +-
 gdb/gdbserver/lynx-low.c         |  2 +-
 gdb/gdbserver/nto-low.c          | 10 ++---
 gdb/gdbserver/remote-utils.c     |  2 +-
 gdb/gdbserver/server.c           |  2 +-
 gdb/gdbserver/spu-low.c          | 10 ++---
 gdb/gdbserver/target.c           |  4 +-
 gdb/gdbserver/thread-db.c        |  2 +-
 gdb/gnu-nat.c                    | 14 +++----
 gdb/i386-cygwin-tdep.c           |  4 +-
 gdb/i386-gnu-nat.c               |  6 +--
 gdb/i386-linux-nat.c             |  2 +-
 gdb/ia64-linux-nat.c             |  2 +-
 gdb/inf-ptrace.c                 |  2 +-
 gdb/infrun.c                     |  8 ++--
 gdb/linux-fork.c                 |  2 +-
 gdb/linux-nat.c                  | 90 ++++++++++++++++++++--------------------
 gdb/linux-tdep.c                 |  6 +--
 gdb/linux-thread-db.c            |  8 ++--
 gdb/mips-linux-nat.c             | 12 +++---
 gdb/nat/aarch64-linux-hw-point.c |  2 +-
 gdb/nat/aarch64-linux.c          |  2 +-
 gdb/nat/linux-btrace.c           |  4 +-
 gdb/nat/linux-osdata.c           |  2 +-
 gdb/nat/linux-procfs.c           |  2 +-
 gdb/nat/x86-linux-dregs.c        |  4 +-
 gdb/obsd-nat.c                   |  8 ++--
 gdb/ppc-fbsd-nat.c               |  4 +-
 gdb/ppc-linux-nat.c              | 32 +++++++-------
 gdb/procfs.c                     | 24 +++++------
 gdb/python/py-infthread.c        |  2 +-
 gdb/ravenscar-thread.c           |  4 +-
 gdb/remote.c                     | 14 +++----
 gdb/s390-linux-nat.c             |  4 +-
 gdb/sol-thread.c                 |  8 ++--
 gdb/sol2-tdep.c                  |  4 +-
 gdb/spu-linux-nat.c              |  8 ++--
 gdb/x86-linux-nat.c              |  2 +-
 gdb/xtensa-linux-nat.c           |  8 ++--
 52 files changed, 261 insertions(+), 217 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5b51879476..6d5e42d1b1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,47 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (ptid_get_lwp): Remove.
+	* common/ptid.h (ptid_get_lwp): Don't declare.
+	* aarch64-linux-nat.c: Update.
+	* ada-tasks.c: Update.
+	* aix-thread.c: Update.
+	* amd64-linux-nat.c: Update.
+	* arm-linux-nat.c: Update.
+	* corelow.c: Update.
+	* fbsd-nat.c: Update.
+	* fbsd-tdep.c: Update.
+	* gnu-nat.c: Update.
+	* i386-cygwin-tdep.c: Update.
+	* i386-gnu-nat.c: Update.
+	* i386-linux-nat.c: Update.
+	* ia64-linux-nat.c: Update.
+	* inf-ptrace.c: Update.
+	* infrun.c: Update.
+	* linux-fork.c: Update.
+	* linux-nat.c: Update.
+	* linux-tdep.c: Update.
+	* linux-thread-db.c: Update.
+	* mips-linux-nat.c: Update.
+	* nat/aarch64-linux-hw-point.c: Update.
+	* nat/aarch64-linux.c: Update.
+	* nat/linux-btrace.c: Update.
+	* nat/linux-osdata.c: Update.
+	* nat/linux-procfs.c: Update.
+	* nat/x86-linux-dregs.c: Update.
+	* obsd-nat.c: Update.
+	* ppc-fbsd-nat.c: Update.
+	* ppc-linux-nat.c: Update.
+	* procfs.c: Update.
+	* python/py-infthread.c: Update.
+	* ravenscar-thread.c: Update.
+	* remote.c: Update.
+	* s390-linux-nat.c: Update.
+	* sol-thread.c: Update.
+	* sol2-tdep.c: Update.
+	* spu-linux-nat.c: Update.
+	* x86-linux-nat.c: Update.
+	* xtensa-linux-nat.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.c (ptid_get_pid): Remove.
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index ab3e19a1c5..615a594c93 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -209,7 +209,7 @@ fetch_gregs_from_thread (struct regcache *regcache)
      and arm.  */
   gdb_static_assert (sizeof (regs) >= 18 * 4);
 
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   iovec.iov_base = &regs;
   if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
@@ -246,7 +246,7 @@ store_gregs_to_thread (const struct regcache *regcache)
   /* Make sure REGS can hold all registers contents on both aarch64
      and arm.  */
   gdb_static_assert (sizeof (regs) >= 18 * 4);
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   iovec.iov_base = &regs;
   if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
@@ -289,7 +289,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
      and arm.  */
   gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
 
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   iovec.iov_base = &regs;
 
@@ -335,7 +335,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
   /* Make sure REGS can hold all VFP registers contents on both aarch64
      and arm.  */
   gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   iovec.iov_base = &regs;
 
@@ -529,7 +529,7 @@ aarch64_linux_nat_target::read_description ()
   gdb_byte regbuf[VFP_REGS_SIZE];
   struct iovec iovec;
 
-  tid = ptid_get_lwp (inferior_ptid);
+  tid = inferior_ptid.lwp ();
 
   iovec.iov_base = regbuf;
   iovec.iov_len = VFP_REGS_SIZE;
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index bbc0375571..ff98eeffab 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1204,7 +1204,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
 
   /* Print the TID and LWP.  */
   printf_filtered (_("Thread: %#lx\n"), ptid_get_tid (task_info->ptid));
-  printf_filtered (_("LWP: %#lx\n"), ptid_get_lwp (task_info->ptid));
+  printf_filtered (_("LWP: %#lx\n"), task_info->ptid.lwp ());
 
   /* If set, print the base CPU.  */
   if (task_info->base_cpu != 0)
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c5bb839fb8..26db82b179 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -681,9 +681,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2)
     return -1;
   else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2))
     return 1;
-  else if (ptid_get_lwp (ptid1) < ptid_get_lwp (ptid2))
+  else if (ptid1.lwp () < ptid2.lwp ())
     return -1;
-  else if (ptid_get_lwp (ptid1) > ptid_get_lwp (ptid2))
+  else if (ptid1.lwp () > ptid2.lwp ())
     return 1;
   else
     return 0;
@@ -1050,14 +1050,14 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
       thread = find_thread_ptid (ptid);
       if (!thread)
 	error (_("aix-thread resume: unknown pthread %ld"),
-	       ptid_get_lwp (ptid));
+	       ptid.lwp ());
 
       aix_thread_info *priv = get_aix_thread_info (thread);
 
       tid[0] = priv->tid;
       if (tid[0] == PTHDB_INVALID_TID)
 	error (_("aix-thread resume: no tid for pthread %ld"),
-	       ptid_get_lwp (ptid));
+	       ptid.lwp ());
       tid[1] = 0;
 
       if (arch64)
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 588c9b50eb..bc2412b238 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -148,7 +148,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
   int tid;
 
   /* GNU/Linux LWP ID's are process ID's.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
   if (tid == 0)
     tid = regcache->ptid ().pid (); /* Not a threaded program.  */
 
@@ -226,7 +226,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
   int tid;
 
   /* GNU/Linux LWP ID's are process ID's.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
   if (tid == 0)
     tid = regcache->ptid ().pid (); /* Not a threaded program.  */
 
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 8f9416e668..3c552ecde2 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -119,7 +119,7 @@ fetch_fpregs (struct regcache *regcache)
   gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   /* Read the floating point state.  */
   if (have_ptrace_getregset == TRIBOOL_TRUE)
@@ -155,7 +155,7 @@ store_fpregs (const struct regcache *regcache)
   gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   /* Read the floating point state.  */
   if (have_ptrace_getregset == TRIBOOL_TRUE)
@@ -209,7 +209,7 @@ fetch_regs (struct regcache *regcache)
   elf_gregset_t regs;
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
@@ -236,7 +236,7 @@ store_regs (const struct regcache *regcache)
   elf_gregset_t regs;
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   /* Fetch the general registers.  */
   if (have_ptrace_getregset == TRIBOOL_TRUE)
@@ -284,7 +284,7 @@ fetch_wmmx_regs (struct regcache *regcache)
   int ret, regno, tid;
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
   if (ret < 0)
@@ -309,7 +309,7 @@ store_wmmx_regs (const struct regcache *regcache)
   int ret, regno, tid;
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
   if (ret < 0)
@@ -344,7 +344,7 @@ fetch_vfp_regs (struct regcache *regcache)
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
@@ -373,7 +373,7 @@ store_vfp_regs (const struct regcache *regcache)
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* Get the thread id for the ptrace call.  */
-  tid = ptid_get_lwp (regcache->ptid ());
+  tid = regcache->ptid ().lwp ();
 
   if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
@@ -539,7 +539,7 @@ arm_linux_nat_target::read_description ()
     {
       elf_gregset_t gpregs;
       struct iovec iov;
-      int tid = ptid_get_lwp (inferior_ptid);
+      int tid = inferior_ptid.lwp ();
 
       iov.iov_base = &gpregs;
       iov.iov_len = sizeof (gpregs);
@@ -576,7 +576,7 @@ arm_linux_nat_target::read_description ()
 
       /* Now make sure that the kernel supports reading these
 	 registers.  Support was added in 2.6.30.  */
-      pid = ptid_get_lwp (inferior_ptid);
+      pid = inferior_ptid.lwp ();
       errno = 0;
       buf = (char *) alloca (VFP_REGS_SIZE);
       if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0
@@ -622,7 +622,7 @@ arm_linux_get_hwbp_cap (void)
       int tid;
       unsigned int val;
 
-      tid = ptid_get_lwp (inferior_ptid);
+      tid = inferior_ptid.lwp ();
       if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0)
 	available = 0;
       else
@@ -1250,7 +1250,7 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
   struct arm_linux_hw_breakpoint *bpts, *wpts;
   struct arch_lwp_info *arm_lwp_info = lwp->arch_private;
 
-  pid = ptid_get_lwp (lwp->ptid);
+  pid = lwp->ptid.lwp ();
   bpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->bpts;
   wpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->wpts;
 
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 0b0a703f08..85cb4ca81c 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
 
 /* See ptid.h.  */
 
-long
-ptid_get_lwp (const ptid_t &ptid)
-{
-  return ptid.lwp ();
-}
-
-/* See ptid.h.  */
-
 long
 ptid_get_tid (const ptid_t &ptid)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 6747e7ac38..5eeecdd9f9 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
 /* The following functions are kept for backwards compatibility.  The use of
    the ptid_t methods is preferred.  */
 
-/* See ptid_t::lwp.  */
-
-extern long ptid_get_lwp (const ptid_t &ptid);
-
 /* See ptid_t::tid.  */
 
 extern long ptid_get_tid (const ptid_t &ptid);
diff --git a/gdb/corelow.c b/gdb/corelow.c
index b326278ec5..51330bb7ff 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -1007,7 +1007,7 @@ core_target::pid_to_str (ptid_t ptid)
      "process", with normal_pid_to_str.  */
 
   /* Try the LWPID field first.  */
-  pid = ptid_get_lwp (ptid);
+  pid = ptid.lwp ();
   if (pid != 0)
     return normal_pid_to_str (ptid_t (pid));
 
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 0ceb8d876f..ab16d1cbec 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -814,7 +814,7 @@ fbsd_nat_target::thread_alive (ptid_t ptid)
     {
       struct ptrace_lwpinfo pl;
 
-      if (ptrace (PT_LWPINFO, ptid_get_lwp (ptid), (caddr_t) &pl, sizeof pl)
+      if (ptrace (PT_LWPINFO, ptid.lwp (), (caddr_t) &pl, sizeof pl)
 	  == -1)
 	return false;
 #ifdef PL_FLAG_EXITED
@@ -834,7 +834,7 @@ fbsd_nat_target::pid_to_str (ptid_t ptid)
 {
   lwpid_t lwp;
 
-  lwp = ptid_get_lwp (ptid);
+  lwp = ptid.lwp ();
   if (lwp != 0)
     {
       static char buf[64];
@@ -857,7 +857,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
   struct ptrace_lwpinfo pl;
   struct kinfo_proc kp;
   int pid = thr->ptid.pid ();
-  long lwp = ptid_get_lwp (thr->ptid);
+  long lwp = thr->ptid.lwp ();
   static char buf[sizeof pl.pl_tdname + 1];
 
   /* Note that ptrace_lwpinfo returns the process command in pl_tdname
@@ -1100,7 +1100,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
   if (debug_fbsd_lwp)
     fprintf_unfiltered (gdb_stdlog,
 			"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
-			ptid.pid (), ptid_get_lwp (ptid),
+			ptid.pid (), ptid.lwp (),
 			ptid_get_tid (ptid));
   if (ptid_lwp_p (ptid))
     {
@@ -1113,12 +1113,12 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 	  if (tp->ptid.pid () != ptid.pid ())
 	    continue;
 
-	  if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid))
+	  if (tp->ptid.lwp () == ptid.lwp ())
 	    request = PT_RESUME;
 	  else
 	    request = PT_SUSPEND;
 
-	  if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
+	  if (ptrace (request, tp->ptid.lwp (), NULL, 0) == -1)
 	    perror_with_name (("ptrace"));
 	}
     }
@@ -1133,7 +1133,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 	  if (!ptid_match (tp->ptid, ptid))
 	    continue;
 
-	  if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
+	  if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1)
 	    perror_with_name (("ptrace"));
 	}
       ptid = inferior_ptid;
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index a3f8a070a2..f3dad73994 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -301,9 +301,9 @@ fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_get_lwp (ptid) != 0)
+  if (ptid.lwp () != 0)
     {
-      xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
+      xsnprintf (buf, sizeof buf, "LWP %ld", ptid.lwp ());
       return buf;
     }
 
@@ -320,7 +320,7 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
   struct bfd_section *section;
   bfd_size_type size;
 
-  if (ptid_get_lwp (thr->ptid) != 0)
+  if (thr->ptid.lwp () != 0)
     {
       /* FreeBSD includes a NT_FREEBSD_THRMISC note for each thread
 	 whose contents are defined by a "struct thrmisc" declared in
@@ -477,7 +477,7 @@ fbsd_collect_thread_registers (const struct regcache *regcache,
   data.note_size = note_size;
   data.stop_signal = stop_signal;
   data.abort_iteration = 0;
-  data.lwp = ptid_get_lwp (ptid);
+  data.lwp = ptid.lwp ();
 
   gdbarch_iterate_over_regset_sections (gdbarch,
 					fbsd_collect_regset_section_cb,
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 14b1c6629a..938b76a2d6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,15 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* linux-low.c: Update.
+	* linux-mips-low.c: Update.
+	* lynx-low.c: Update.
+	* nto-low.c: Update.
+	* remote-utils.c: Update.
+	* server.c: Update.
+	* spu-low.c: Update.
+	* target.c: Update.
+	* thread-db.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* linux-low.c: Update.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 99a7e162d2..a290b5b8b7 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -529,7 +529,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 	    {
 	      debug_printf ("HEW: Got fork event from LWP %ld, "
 			    "new child is %d\n",
-			    ptid_get_lwp (ptid_of (event_thr)),
+			    ptid_of (event_thr).lwp (),
 			    ptid.pid ());
 	    }
 
@@ -1052,7 +1052,7 @@ int
 linux_attach_lwp (ptid_t ptid)
 {
   struct lwp_info *new_lwp;
-  int lwpid = ptid_get_lwp (ptid);
+  int lwpid = ptid.lwp ();
 
   if (ptrace (PTRACE_ATTACH, lwpid, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0)
       != 0)
@@ -1140,7 +1140,7 @@ attach_proc_task_lwp_callback (ptid_t ptid)
   /* Is this a new thread?  */
   if (find_thread_ptid (ptid) == NULL)
     {
-      int lwpid = ptid_get_lwp (ptid);
+      int lwpid = ptid.lwp ();
       int err;
 
       if (debug_threads)
@@ -1324,7 +1324,7 @@ kill_wait_lwp (struct lwp_info *lwp)
 {
   struct thread_info *thr = get_lwp_thread (lwp);
   int pid = ptid_of (thr).pid ();
-  int lwpid = ptid_get_lwp (ptid_of (thr));
+  int lwpid = ptid_of (thr).lwp ();
   int wstat;
   int res;
 
@@ -4548,7 +4548,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
 	     of PID'.  */
 	  || (ptid.pid () == pid_of (thread)
 	      && (ptid_is_pid (ptid)
-		  || ptid_get_lwp (ptid) == -1)))
+		  || ptid.lwp () == -1)))
 	{
 	  if (resume[ndx].kind == resume_stop
 	      && thread->last_resume_kind == resume_stop)
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index f61c294401..2194af6c0a 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -450,7 +450,7 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
       if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
 	{
 	  /* Write the mirrored watch register values.  */
-	  int tid = ptid_get_lwp (ptid);
+	  int tid = ptid.lwp ();
 
 	  if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
 			    &priv->watch_mirror, NULL))
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index b637ef96fe..8d79ab17ed 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -93,7 +93,7 @@ lynx_ptid_get_tid (ptid_t ptid)
 {
   /* See lynx_ptid_t: The LynxOS tid is stored inside the lwp field
      of the ptid.  */
-  return ptid_get_lwp (ptid);
+  return ptid.lwp ();
 }
 
 /* For a given PTID, return the associated PID as known by the LynxOS
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index 6a05d2b0be..21f6da61c1 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -92,12 +92,12 @@ nto_set_thread (ptid_t ptid)
   int res = 0;
 
   TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (),
-	 ptid_get_lwp (ptid));
+	 ptid.lwp ());
   if (nto_inferior.ctl_fd != -1
       && !ptid_equal (ptid, null_ptid)
       && !ptid_equal (ptid, minus_one_ptid))
     {
-      pthread_t tid = ptid_get_lwp (ptid);
+      pthread_t tid = ptid.lwp ();
 
       if (EOK == devctl (nto_inferior.ctl_fd, DCMD_PROC_CURTHREAD, &tid,
 	  sizeof (tid), 0))
@@ -213,7 +213,7 @@ do_attach (pid_t pid)
       proc = add_process (status.pid, 1);
       proc->tdesc = nto_tdesc;
       TRACE ("Adding thread: pid=%d tid=%ld\n", status.pid,
-	     ptid_get_lwp (ptid));
+	     ptid.lwp ());
       nto_find_new_threads (&nto_inferior);
     }
   else
@@ -431,8 +431,8 @@ nto_thread_alive (ptid_t ptid)
   int res;
 
   TRACE ("%s pid:%d tid:%d\n", __func__, ptid.pid (),
-	 ptid_get_lwp (ptid));
-  if (SignalKill (0, ptid.pid (), ptid_get_lwp (ptid),
+	 ptid.lwp ());
+  if (SignalKill (0, ptid.pid (), ptid.lwp (),
 		  0, 0, 0) == -1)
     res = 0;
   else
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 400c2be9f8..ac57ce53fd 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -492,7 +492,7 @@ write_ptid (char *buf, ptid_t ptid)
       else
 	buf += sprintf (buf, "p%x.", pid);
     }
-  tid = ptid_get_lwp (ptid);
+  tid = ptid.lwp ();
   if (tid < 0)
     buf += sprintf (buf, "-%x", -tid);
   else
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 28bc9def37..5c24315ecb 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2700,7 +2700,7 @@ visit_actioned_threads (thread_info *thread,
 	  || ptid_equal (action->thread, thread->id)
 	  || ((action->thread.pid ()
 	       == thread->id.pid ())
-	      && ptid_get_lwp (action->thread) == -1))
+	      && action->thread.lwp () == -1))
 	{
 	  if ((*callback) (action, thread))
 	    return true;
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 3436d39118..b3980e72bc 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -66,7 +66,7 @@ fetch_ppc_register (int regno)
 {
   PTRACE_TYPE_RET res;
 
-  int tid = ptid_get_lwp (current_ptid);
+  int tid = current_ptid.lwp ();
 
 #ifndef __powerpc64__
   /* If running as a 32-bit process on a 64-bit system, we attempt
@@ -151,7 +151,7 @@ fetch_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
 	       / sizeof (PTRACE_TYPE_RET));
   PTRACE_TYPE_RET *buffer;
 
-  int tid = ptid_get_lwp (current_ptid);
+  int tid = current_ptid.lwp ();
 
   buffer = XALLOCAVEC (PTRACE_TYPE_RET, count);
   for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
@@ -176,7 +176,7 @@ store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
 	       / sizeof (PTRACE_TYPE_RET));
   PTRACE_TYPE_RET *buffer;
 
-  int tid = ptid_get_lwp (current_ptid);
+  int tid = current_ptid.lwp ();
 
   buffer = XALLOCAVEC (PTRACE_TYPE_RET, count);
 
@@ -241,7 +241,7 @@ spu_proc_xfer_spu (const char *annex, unsigned char *readbuf,
   if (!annex)
     return 0;
 
-  sprintf (buf, "/proc/%ld/fd/%s", ptid_get_lwp (current_ptid), annex);
+  sprintf (buf, "/proc/%ld/fd/%s", current_ptid.lwp (), annex);
   fd = open (buf, writebuf? O_WRONLY : O_RDONLY);
   if (fd <= 0)
     return -1;
@@ -409,7 +409,7 @@ spu_resume (struct thread_resume *resume_info, size_t n)
   regcache_invalidate ();
 
   errno = 0;
-  ptrace (PTRACE_CONT, ptid_get_lwp (ptid_of (thr)), 0, resume_info[i].sig);
+  ptrace (PTRACE_CONT, ptid_of (thr).lwp (), 0, resume_info[i].sig);
   if (errno)
     perror_with_name ("ptrace");
 }
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 400d458ea9..aff316da22 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -321,9 +321,9 @@ target_pid_to_str (ptid_t ptid)
   else if (ptid_get_tid (ptid) != 0)
     xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
 	       ptid.pid (), ptid_get_tid (ptid));
-  else if (ptid_get_lwp (ptid) != 0)
+  else if (ptid.lwp () != 0)
     xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
-	       ptid.pid (), ptid_get_lwp (ptid));
+	       ptid.pid (), ptid.lwp ());
   else
     xsnprintf (buf, sizeof (buf), "Process %d",
 	       ptid.pid ());
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 80125ee9b7..7d4bfb6efe 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -167,7 +167,7 @@ find_one_thread (ptid_t ptid)
   td_err_e err;
   struct lwp_info *lwp;
   struct thread_db *thread_db = current_process ()->priv->thread_db;
-  int lwpid = ptid_get_lwp (ptid);
+  int lwpid = ptid.lwp ();
 
   thread_info *thread = find_thread_ptid (ptid);
   lwp = get_thread_lwp (thread);
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c7c7e893ca..f256a823b1 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -1620,7 +1620,7 @@ rewait:
   else if (ptid_equal (ptid, minus_one_ptid))
     thread = inf_tid_to_thread (inf, -1);
   else
-    thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid));
+    thread = inf_tid_to_thread (inf, ptid.lwp ());
 
   if (!thread || thread->port == MACH_PORT_NULL)
     {
@@ -2049,7 +2049,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
   else
     /* Just allow a single thread to run.  */
     {
-      struct proc *thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid));
+      struct proc *thread = inf_tid_to_thread (inf, ptid.lwp ());
 
       if (!thread)
 	error (_("Can't run single thread id %s: no such thread!"),
@@ -2060,7 +2060,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
 
   if (step)
     {
-      step_thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid));
+      step_thread = inf_tid_to_thread (inf, ptid.lwp ());
       if (!step_thread)
 	warning (_("Can't step thread id %s: no such thread."),
 		 target_pid_to_str (ptid));
@@ -2293,7 +2293,7 @@ gnu_nat_target::thread_alive (ptid_t ptid)
 {
   inf_update_procs (gnu_current_inf);
   return !!inf_tid_to_thread (gnu_current_inf,
-			      ptid_get_lwp (ptid));
+			      ptid.lwp ());
 }
 
 \f
@@ -2716,7 +2716,7 @@ const char *
 gnu_nat_target::pid_to_str (ptid_t ptid)
 {
   struct inf *inf = gnu_current_inf;
-  int tid = ptid_get_lwp (ptid);
+  int tid = ptid.lwp ();
   struct proc *thread = inf_tid_to_thread (inf, tid);
 
   if (thread)
@@ -2818,7 +2818,7 @@ cur_thread (void)
 {
   struct inf *inf = cur_inf ();
   struct proc *thread = inf_tid_to_thread (inf,
-					   ptid_get_lwp (inferior_ptid));
+					   inferior_ptid.lwp ());
   if (!thread)
     error (_("No current thread."));
   return thread;
@@ -3018,7 +3018,7 @@ set_sig_thread_cmd (const char *args, int from_tty)
   else
     {
       struct thread_info *tp = parse_thread_id (args, NULL);
-      inf->signal_thread = inf_tid_to_thread (inf, ptid_get_lwp (tp->ptid));
+      inf->signal_thread = inf_tid_to_thread (inf, tp->ptid.lwp ());
     }
 }
 
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index 20ae5a3280..ed75ea3741 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -183,9 +183,9 @@ i386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_get_lwp (ptid) != 0)
+  if (ptid.lwp () != 0)
     {
-      snprintf (buf, sizeof (buf), "Thread 0x%lx", ptid_get_lwp (ptid));
+      snprintf (buf, sizeof (buf), "Thread 0x%lx", ptid.lwp ());
       return buf;
     }
 
diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c
index 9875d81348..ca30eb6bed 100644
--- a/gdb/i386-gnu-nat.c
+++ b/gdb/i386-gnu-nat.c
@@ -113,7 +113,7 @@ gnu_fetch_registers (struct target_ops *ops,
   /* Make sure we know about new threads.  */
   inf_update_procs (gnu_current_inf);
 
-  thread = inf_tid_to_thread (gnu_current_inf, ptid_get_lwp (ptid));
+  thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
   if (!thread)
     error (_("Can't fetch registers from thread %s: No such thread"),
 	   target_pid_to_str (ptid));
@@ -205,7 +205,7 @@ gnu_store_registers (struct target_ops *ops,
   /* Make sure we know about new threads.  */
   inf_update_procs (gnu_current_inf);
 
-  thread = inf_tid_to_thread (gnu_current_inf, ptid_get_lwp (ptid));
+  thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
   if (!thread)
     error (_("Couldn't store registers into thread %s: No such thread"),
 	   target_pid_to_str (ptid));
@@ -392,7 +392,7 @@ i386_gnu_dr_get_reg (ptid_t ptid, int regnum)
   /* Make sure we know about new threads.  */
   inf_update_procs (gnu_current_inf);
 
-  thread = inf_tid_to_thread (gnu_current_inf, ptid_get_lwp (ptid));
+  thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
   i386_gnu_dr_get (&regs, thread);
 
   return regs.dr[regnum];
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 897a21f53c..fcd014bbb8 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -647,7 +647,7 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
 void
 i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal)
 {
-  int pid = ptid_get_lwp (ptid);
+  int pid = ptid.lwp ();
   int request;
 
   if (catch_syscall_enabled () > 0)
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 49ae702682..1d39ec5c30 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -553,7 +553,7 @@ store_debug_register (ptid_t ptid, int idx, long val)
 {
   int tid;
 
-  tid = ptid_get_lwp (ptid);
+  tid = ptid.lwp ();
   if (tid == 0)
     tid = ptid.pid ();
 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index bdea7f1815..d1c9a90e37 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -325,7 +325,7 @@ get_ptrace_pid (ptid_t ptid)
 
   /* If we have an LWPID to work with, use it.  Otherwise, we're
      dealing with a non-threaded program/target.  */
-  pid = ptid_get_lwp (ptid);
+  pid = ptid.lwp ();
   if (pid == 0)
     pid = ptid.pid ();
   return pid;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9d3854d9e5..18bdd39bfd 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3432,14 +3432,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
 
   stb.printf ("infrun: target_wait (%d.%ld.%ld",
 	      waiton_ptid.pid (),
-	      ptid_get_lwp (waiton_ptid),
+	      waiton_ptid.lwp (),
 	      ptid_get_tid (waiton_ptid));
   if (waiton_ptid.pid () != -1)
     stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
   stb.printf (", status) =\n");
   stb.printf ("infrun:   %d.%ld.%ld [%s],\n",
 	      result_ptid.pid (),
-	      ptid_get_lwp (result_ptid),
+	      result_ptid.lwp (),
 	      ptid_get_tid (result_ptid),
 	      target_pid_to_str (result_ptid));
   stb.printf ("infrun:   %s\n", status_string.c_str ());
@@ -4396,7 +4396,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
 			  "infrun: saving status %s for %d.%ld.%ld\n",
 			  statstr.c_str (),
 			  tp->ptid.pid (),
-			  ptid_get_lwp (tp->ptid),
+			  tp->ptid.lwp (),
 			  ptid_get_tid (tp->ptid));
     }
 
@@ -4634,7 +4634,7 @@ stop_all_threads (void)
 					  "status for %d.%ld.%ld\n",
 					  statstr.c_str (),
 					  t->ptid.pid (),
-					  ptid_get_lwp (t->ptid),
+					  t->ptid.lwp (),
 					  ptid_get_tid (t->ptid));
 		    }
 
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index aaf6466a15..4049021d26 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -721,7 +721,7 @@ checkpoint_command (const char *args, int from_tty)
 		       fp != NULL ? fp->num : -1, (long) retpid);
       if (info_verbose)
 	{
-	  parent_pid = ptid_get_lwp (last_target_ptid);
+	  parent_pid = last_target_ptid.lwp ();
 	  if (parent_pid == 0)
 	    parent_pid = last_target_ptid.pid ();
 	  printf_filtered (_("   gdb says parent = %ld.\n"),
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index d3dfd13bfa..bffbc74c74 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -457,8 +457,8 @@ linux_nat_target::follow_fork (int follow_child, int detach_fork)
 		     == TARGET_WAITKIND_VFORKED);
       parent_ptid = inferior_ptid;
       child_ptid = inferior_thread ()->pending_follow.value.related_pid;
-      parent_pid = ptid_get_lwp (parent_ptid);
-      child_pid = ptid_get_lwp (child_ptid);
+      parent_pid = parent_ptid.lwp ();
+      child_pid = child_ptid.lwp ();
 
       /* We're already attached to the parent, by default.  */
       child_lp = add_lwp (child_ptid);
@@ -668,7 +668,7 @@ static hashval_t
 lwp_info_hash (const void *ap)
 {
   const struct lwp_info *lp = (struct lwp_info *) ap;
-  pid_t pid = ptid_get_lwp (lp->ptid);
+  pid_t pid = lp->ptid.lwp ();
 
   return iterative_hash_object (pid, 0);
 }
@@ -682,7 +682,7 @@ lwp_lwpid_htab_eq (const void *a, const void *b)
   const struct lwp_info *entry = (const struct lwp_info *) a;
   const struct lwp_info *element = (const struct lwp_info *) b;
 
-  return ptid_get_lwp (entry->ptid) == ptid_get_lwp (element->ptid);
+  return entry->ptid.lwp () == element->ptid.lwp ();
 }
 
 /* Create the lwp_lwpid_htab hash table.  */
@@ -936,7 +936,7 @@ find_lwp_pid (ptid_t ptid)
   struct lwp_info dummy;
 
   if (ptid_lwp_p (ptid))
-    lwp = ptid_get_lwp (ptid);
+    lwp = ptid.lwp ();
   else
     lwp = ptid.pid ();
 
@@ -1018,7 +1018,7 @@ exit_lwp (struct lwp_info *lp)
 static int
 linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
 {
-  pid_t new_pid, pid = ptid_get_lwp (ptid);
+  pid_t new_pid, pid = ptid.lwp ();
   int status;
 
   if (linux_proc_pid_is_stopped (pid))
@@ -1104,7 +1104,7 @@ attach_proc_task_lwp_callback (ptid_t ptid)
   lp = find_lwp_pid (ptid);
   if (lp == NULL)
     {
-      int lwpid = ptid_get_lwp (ptid);
+      int lwpid = ptid.lwp ();
 
       if (ptrace (PTRACE_ATTACH, lwpid, 0, 0) < 0)
 	{
@@ -1235,7 +1235,7 @@ linux_nat_target::attach (const char *args, int from_tty)
 
       internal_error (__FILE__, __LINE__,
 		      _("unexpected status %d for PID %ld"),
-		      status, (long) ptid_get_lwp (ptid));
+		      status, (long) ptid.lwp ());
     }
 
   lp->stopped = 1;
@@ -1314,7 +1314,7 @@ get_detach_signal (struct lwp_info *lp)
 
       get_last_target_status (&last_ptid, &last);
 
-      if (ptid_get_lwp (lp->ptid) == ptid_get_lwp (last_ptid))
+      if (lp->ptid.lwp () == last_ptid.lwp ())
 	{
 	  struct thread_info *tp = find_thread_ptid (lp->ptid);
 
@@ -1359,7 +1359,7 @@ get_detach_signal (struct lwp_info *lp)
 static void
 detach_one_lwp (struct lwp_info *lp, int *signo_p)
 {
-  int lwpid = ptid_get_lwp (lp->ptid);
+  int lwpid = lp->ptid.lwp ();
   int signo;
 
   gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
@@ -1451,7 +1451,7 @@ detach_callback (struct lwp_info *lp, void *data)
   /* We don't actually detach from the thread group leader just yet.
      If the thread group exits, we must reap the zombie clone lwps
      before we're able to reap the leader.  */
-  if (ptid_get_lwp (lp->ptid) != lp->ptid.pid ())
+  if (lp->ptid.lwp () != lp->ptid.pid ())
     detach_one_lwp (lp, NULL);
   return 0;
 }
@@ -1558,7 +1558,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp)
      other than ptrace-stopped.  */
 
   /* Don't assume anything if /proc/PID/status can't be read.  */
-  if (linux_proc_pid_is_trace_stopped_nowarn (ptid_get_lwp (lp->ptid)) == 0)
+  if (linux_proc_pid_is_trace_stopped_nowarn (lp->ptid.lwp ()) == 0)
     {
       lp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
       lp->status = 0;
@@ -1831,10 +1831,10 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
 			    "for LWP %ld (stopping threads), "
 			    "resuming with PTRACE_CONT for SIGSTOP\n",
 			    syscall_number,
-			    ptid_get_lwp (lp->ptid));
+			    lp->ptid.lwp ());
 
       lp->syscall_state = TARGET_WAITKIND_IGNORE;
-      ptrace (PTRACE_CONT, ptid_get_lwp (lp->ptid), 0, 0);
+      ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
       lp->stopped = 0;
       return 1;
     }
@@ -1864,7 +1864,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
 				== TARGET_WAITKIND_SYSCALL_ENTRY
 				? "entry" : "return",
 				syscall_number,
-				ptid_get_lwp (lp->ptid));
+				lp->ptid.lwp ());
 	  return 0;
 	}
 
@@ -1875,7 +1875,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
 			    lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
 			    ? "entry" : "return",
 			    syscall_number,
-			    ptid_get_lwp (lp->ptid));
+			    lp->ptid.lwp ());
     }
   else
     {
@@ -1901,7 +1901,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
 			    "with no syscall catchpoints."
 			    " %d for LWP %ld, ignoring\n",
 			    syscall_number,
-			    ptid_get_lwp (lp->ptid));
+			    lp->ptid.lwp ());
       lp->syscall_state = TARGET_WAITKIND_IGNORE;
     }
 
@@ -1925,7 +1925,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
 static int
 linux_handle_extended_wait (struct lwp_info *lp, int status)
 {
-  int pid = ptid_get_lwp (lp->ptid);
+  int pid = lp->ptid.lwp ();
   struct target_waitstatus *ourstatus = &lp->waitstatus;
   int event = linux_ptrace_get_extended_event (status);
 
@@ -2019,7 +2019,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	    {
 	      /* The process is not using thread_db.  Add the LWP to
 		 GDB's list.  */
-	      target_post_attach (ptid_get_lwp (new_lp->ptid));
+	      target_post_attach (new_lp->ptid.lwp ());
 	      add_thread (new_lp->ptid);
 	    }
 
@@ -2049,7 +2049,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 		fprintf_unfiltered (gdb_stdlog,
 				    "LHEW: waitpid of new LWP %ld, "
 				    "saving status %s\n",
-				    (long) ptid_get_lwp (new_lp->ptid),
+				    (long) new_lp->ptid.lwp (),
 				    status_to_str (status));
 	      new_lp->status = status;
 	    }
@@ -2070,7 +2070,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
       if (debug_linux_nat)
 	fprintf_unfiltered (gdb_stdlog,
 			    "LHEW: Got exec event from LWP %ld\n",
-			    ptid_get_lwp (lp->ptid));
+			    lp->ptid.lwp ());
 
       ourstatus->kind = TARGET_WAITKIND_EXECD;
       ourstatus->value.execd_pathname
@@ -2091,7 +2091,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	    fprintf_unfiltered (gdb_stdlog,
 				"LHEW: Got expected PTRACE_EVENT_"
 				"VFORK_DONE from LWP %ld: stopping\n",
-				ptid_get_lwp (lp->ptid));
+				lp->ptid.lwp ());
 
 	  ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
 	  return 0;
@@ -2101,7 +2101,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	fprintf_unfiltered (gdb_stdlog,
 			    "LHEW: Got PTRACE_EVENT_VFORK_DONE "
 			    "from LWP %ld: ignoring\n",
-			    ptid_get_lwp (lp->ptid));
+			    lp->ptid.lwp ());
       return 1;
     }
 
@@ -2152,7 +2152,7 @@ wait_lwp (struct lwp_info *lp)
 
   for (;;)
     {
-      pid = my_waitpid (ptid_get_lwp (lp->ptid), &status, __WALL | WNOHANG);
+      pid = my_waitpid (lp->ptid.lwp (), &status, __WALL | WNOHANG);
       if (pid == -1 && errno == ECHILD)
 	{
 	  /* The thread has previously exited.  We need to delete it
@@ -2181,8 +2181,8 @@ wait_lwp (struct lwp_info *lp)
 	 Therefore always use WNOHANG with sigsuspend - it is equivalent to
 	 waiting waitpid but linux_proc_pid_is_zombie is safe this way.  */
 
-      if (lp->ptid.pid () == ptid_get_lwp (lp->ptid)
-	  && linux_proc_pid_is_zombie (ptid_get_lwp (lp->ptid)))
+      if (lp->ptid.pid () == lp->ptid.lwp ()
+	  && linux_proc_pid_is_zombie (lp->ptid.lwp ()))
 	{
 	  thread_dead = 1;
 	  if (debug_linux_nat)
@@ -2205,7 +2205,7 @@ wait_lwp (struct lwp_info *lp)
 
   if (!thread_dead)
     {
-      gdb_assert (pid == ptid_get_lwp (lp->ptid));
+      gdb_assert (pid == lp->ptid.lwp ());
 
       if (debug_linux_nat)
 	{
@@ -2219,7 +2219,7 @@ wait_lwp (struct lwp_info *lp)
       if (WIFEXITED (status) || WIFSIGNALED (status))
 	{
 	  if (report_thread_events
-	      || lp->ptid.pid () == ptid_get_lwp (lp->ptid))
+	      || lp->ptid.pid () == lp->ptid.lwp ())
 	    {
 	      if (debug_linux_nat)
 		fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n",
@@ -2254,7 +2254,7 @@ wait_lwp (struct lwp_info *lp)
       struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
       int options = linux_nat_ptrace_options (inf->attach_flag);
 
-      linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
+      linux_enable_event_reporting (lp->ptid.lwp (), options);
       lp->must_set_ptrace_flags = 0;
     }
 
@@ -2307,7 +2307,7 @@ stop_callback (struct lwp_info *lp, void *data)
 			      target_pid_to_str (lp->ptid));
 	}
       errno = 0;
-      ret = kill_lwp (ptid_get_lwp (lp->ptid), SIGSTOP);
+      ret = kill_lwp (lp->ptid.lwp (), SIGSTOP);
       if (debug_linux_nat)
 	{
 	  fprintf_unfiltered (gdb_stdlog,
@@ -2397,7 +2397,7 @@ maybe_clear_ignore_sigint (struct lwp_info *lp)
   if (!lp->ignore_sigint)
     return;
 
-  if (!linux_nat_has_pending_sigint (ptid_get_lwp (lp->ptid)))
+  if (!linux_nat_has_pending_sigint (lp->ptid.lwp ()))
     {
       if (debug_linux_nat)
 	fprintf_unfiltered (gdb_stdlog,
@@ -2496,7 +2496,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
 	  lp->ignore_sigint = 0;
 
 	  errno = 0;
-	  ptrace (PTRACE_CONT, ptid_get_lwp (lp->ptid), 0, 0);
+	  ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
 	  lp->stopped = 0;
 	  if (debug_linux_nat)
 	    fprintf_unfiltered (gdb_stdlog,
@@ -2970,7 +2970,7 @@ linux_nat_filter_event (int lwpid, int status)
       struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
       int options = linux_nat_ptrace_options (inf->attach_flag);
 
-      linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
+      linux_enable_event_reporting (lp->ptid.lwp (), options);
       lp->must_set_ptrace_flags = 0;
     }
 
@@ -3029,7 +3029,7 @@ linux_nat_filter_event (int lwpid, int status)
       if (debug_linux_nat)
 	fprintf_unfiltered (gdb_stdlog,
 			    "LWP %ld exited (resumed=%d)\n",
-			    ptid_get_lwp (lp->ptid), lp->resumed);
+			    lp->ptid.lwp (), lp->resumed);
 
       /* Dead LWP's aren't expected to reported a pending sigstop.  */
       lp->signalled = 0;
@@ -3652,7 +3652,7 @@ kill_wait_one_lwp (pid_t pid)
 static int
 kill_callback (struct lwp_info *lp, void *data)
 {
-  kill_one_lwp (ptid_get_lwp (lp->ptid));
+  kill_one_lwp (lp->ptid.lwp ());
   return 0;
 }
 
@@ -3661,7 +3661,7 @@ kill_callback (struct lwp_info *lp, void *data)
 static int
 kill_wait_callback (struct lwp_info *lp, void *data)
 {
-  kill_wait_one_lwp (ptid_get_lwp (lp->ptid));
+  kill_wait_one_lwp (lp->ptid.lwp ());
   return 0;
 }
 
@@ -3683,7 +3683,7 @@ kill_unfollowed_fork_children (struct inferior *inf)
 	  {
 	    ptid_t child_ptid = ws->value.related_pid;
 	    int child_pid = child_ptid.pid ();
-	    int child_lwp = ptid_get_lwp (child_ptid);
+	    int child_lwp = child_ptid.lwp ();
 
 	    kill_one_lwp (child_lwp);
 	    kill_wait_one_lwp (child_lwp);
@@ -3776,7 +3776,7 @@ linux_xfer_siginfo (enum target_object object,
   gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
   gdb_assert (readbuf || writebuf);
 
-  pid = ptid_get_lwp (inferior_ptid);
+  pid = inferior_ptid.lwp ();
   if (pid == 0)
     pid = inferior_ptid.pid ();
 
@@ -3928,10 +3928,10 @@ linux_nat_target::pid_to_str (ptid_t ptid)
   static char buf[64];
 
   if (ptid_lwp_p (ptid)
-      && (ptid.pid () != ptid_get_lwp (ptid)
+      && (ptid.pid () != ptid.lwp ()
 	  || num_lwps (ptid.pid ()) > 1))
     {
-      snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
+      snprintf (buf, sizeof (buf), "LWP %ld", ptid.lwp ());
       return buf;
     }
 
@@ -3977,7 +3977,7 @@ linux_proc_xfer_partial (enum target_object object,
   /* We could keep this file open and cache it - possibly one per
      thread.  That requires some juggling, but is even faster.  */
   xsnprintf (filename, sizeof filename, "/proc/%ld/mem",
-	     ptid_get_lwp (inferior_ptid));
+	     inferior_ptid.lwp ());
   fd = gdb_open_cloexec (filename, ((readbuf ? O_RDONLY : O_WRONLY)
 				    | O_LARGEFILE), 0);
   if (fd == -1)
@@ -4070,7 +4070,7 @@ linux_proc_xfer_spu (enum target_object object,
   char buf[128];
   int fd = 0;
   int ret = -1;
-  int pid = ptid_get_lwp (inferior_ptid);
+  int pid = inferior_ptid.lwp ();
 
   if (!annex)
     {
@@ -4435,7 +4435,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
 	    fprintf_unfiltered (gdb_stdlog,
 				"linux-nat: already stopping LWP %ld at "
 				"GDB's request\n",
-				ptid_get_lwp (lwp->ptid));
+				lwp->ptid.lwp ());
 	  return 0;
 	}
 
@@ -4492,7 +4492,7 @@ linux_nat_target::thread_address_space (ptid_t ptid)
   struct inferior *inf;
   int pid;
 
-  if (ptid_get_lwp (ptid) == 0)
+  if (ptid.lwp () == 0)
     {
       /* An (lwpid,0,0) ptid.  Look up the lwp object to get at the
 	 tgid.  */
@@ -4638,7 +4638,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
 {
   int pid;
 
-  pid = ptid_get_lwp (ptid);
+  pid = ptid.lwp ();
   if (pid == 0)
     pid = ptid.pid ();
 
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index da8a1f07f7..12455a79f6 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -419,9 +419,9 @@ linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_get_lwp (ptid) != 0)
+  if (ptid.lwp () != 0)
     {
-      snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
+      snprintf (buf, sizeof (buf), "LWP %ld", ptid.lwp ());
       return buf;
     }
 
@@ -1632,7 +1632,7 @@ linux_collect_thread_registers (const struct regcache *regcache,
   data.abort_iteration = 0;
 
   /* For remote targets the LWP may not be available, so use the TID.  */
-  data.lwp = ptid_get_lwp (ptid);
+  data.lwp = ptid.lwp ();
   if (!data.lwp)
     data.lwp = ptid_get_tid (ptid);
 
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index c2c9a6253c..20fe6c95a0 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -392,17 +392,17 @@ thread_from_lwp (ptid_t ptid)
 
   /* This ptid comes from linux-nat.c, which should always fill in the
      LWP.  */
-  gdb_assert (ptid_get_lwp (ptid) != 0);
+  gdb_assert (ptid.lwp () != 0);
 
   info = get_thread_db_info (ptid.pid ());
 
   /* Access an lwp we know is stopped.  */
   info->proc_handle.ptid = ptid;
-  err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid_get_lwp (ptid),
+  err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid.lwp (),
 				   &th);
   if (err != TD_OK)
     error (_("Cannot find user-level thread for LWP %ld: %s"),
-	   ptid_get_lwp (ptid), thread_db_err_str (err));
+	   ptid.lwp (), thread_db_err_str (err));
 
   err = info->td_thr_get_info_p (&th, &ti);
   if (err != TD_OK)
@@ -1634,7 +1634,7 @@ thread_db_target::pid_to_str (ptid_t ptid)
       thread_db_thread_info *priv = get_thread_db_thread_info (thread_info);
 
       snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
-		(unsigned long) priv->tid, ptid_get_lwp (ptid));
+		(unsigned long) priv->tid, ptid.lwp ());
 
       return buf;
     }
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 8d87dc82fb..21b1f583b9 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -460,7 +460,7 @@ mips_linux_nat_target::read_description ()
     {
       int tid;
 
-      tid = ptid_get_lwp (inferior_ptid);
+      tid = inferior_ptid.lwp ();
       if (tid == 0)
 	tid = inferior_ptid.pid ();
 
@@ -543,7 +543,7 @@ mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
   int i;
   uint32_t wanted_mask, irw_mask;
 
-  if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+  if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
 					&watch_readback,
 					&watch_readback_valid, 0))
     return 0;
@@ -584,7 +584,7 @@ mips_linux_nat_target::stopped_by_watchpoint ()
   int n;
   int num_valid;
 
-  if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+  if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
 					&watch_readback,
 					&watch_readback_valid, 1))
     return false;
@@ -619,7 +619,7 @@ mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
   struct pt_watch_regs dummy_regs;
   int i;
 
-  if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+  if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
 					&watch_readback,
 					&watch_readback_valid, 0))
     return 0;
@@ -641,7 +641,7 @@ write_watchpoint_regs (void)
 
   ALL_LWPS (lp)
     {
-      tid = ptid_get_lwp (lp->ptid);
+      tid = lp->ptid.lwp ();
       if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
 	perror_with_name (_("Couldn't write debug register"));
     }
@@ -680,7 +680,7 @@ mips_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
   int i;
   int retval;
 
-  if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+  if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
 					&watch_readback,
 					&watch_readback_valid, 0))
     return -1;
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index 3de3e5bec1..18b5af2d49 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -296,7 +296,7 @@ debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
 {
   struct aarch64_dr_update_callback_param *param_p
     = (struct aarch64_dr_update_callback_param *) ptr;
-  int tid = ptid_get_lwp (ptid_of_lwp (lwp));
+  int tid = ptid_of_lwp (lwp).lwp ();
   int idx = param_p->idx;
   int is_watchpoint = param_p->is_watchpoint;
   struct arch_lwp_info *info = lwp_arch_private_info (lwp);
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
index c3c29a0665..0f2c8011ea 100644
--- a/gdb/nat/aarch64-linux.c
+++ b/gdb/nat/aarch64-linux.c
@@ -45,7 +45,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       || DR_HAS_CHANGED (info->dr_changed_wp))
     {
       ptid_t ptid = ptid_of_lwp (lwp);
-      int tid = ptid_get_lwp (ptid);
+      int tid = ptid.lwp ();
       struct aarch64_debug_reg_state *state
 	= aarch64_get_debug_reg_state (ptid.pid ());
 
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index b2c30b3e47..83afe881a8 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -469,7 +469,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
   bts->attr.exclude_hv = 1;
   bts->attr.exclude_idle = 1;
 
-  pid = ptid_get_lwp (ptid);
+  pid = ptid.lwp ();
   if (pid == 0)
     pid = ptid.pid ();
 
@@ -585,7 +585,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
   size_t pages;
   int pid, pg;
 
-  pid = ptid_get_lwp (ptid);
+  pid = ptid.lwp ();
   if (pid == 0)
     pid = ptid.pid ();
 
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 358a89eb5e..25e895df19 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -70,7 +70,7 @@ linux_common_core_of_thread (ptid_t ptid)
   int core;
 
   sprintf (filename, "/proc/%lld/task/%lld/stat",
-	   (PID_T) ptid.pid (), (PID_T) ptid_get_lwp (ptid));
+	   (PID_T) ptid.pid (), (PID_T) ptid.lwp ());
   gdb_file_up f = gdb_fopen_cloexec (filename, "r");
   if (!f)
     return -1;
diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index a672cdfc3a..20708fa41c 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -240,7 +240,7 @@ linux_proc_tid_get_name (ptid_t ptid)
   char comm_path[100];
   const char *comm_val;
   pid_t pid = ptid.pid ();
-  pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : ptid.pid ();
+  pid_t tid = ptid_lwp_p (ptid) ? ptid.lwp () : ptid.pid ();
 
   xsnprintf (comm_path, sizeof (comm_path),
 	     "/proc/%ld/task/%ld/comm", (long) pid, (long) tid);
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index d362c3008e..8aa8717163 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -44,7 +44,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
   unsigned long value;
 
   gdb_assert (ptid_lwp_p (ptid));
-  tid = ptid_get_lwp (ptid);
+  tid = ptid.lwp ();
 
   errno = 0;
   value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
@@ -62,7 +62,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
   int tid;
 
   gdb_assert (ptid_lwp_p (ptid));
-  tid = ptid_get_lwp (ptid);
+  tid = ptid.lwp ();
 
   errno = 0;
   ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index a3058b00c3..e654d3367a 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -38,11 +38,11 @@
 const char *
 obsd_nat_target::pid_to_str (ptid_t ptid)
 {
-  if (ptid_get_lwp (ptid) != 0)
+  if (ptid.lwp () != 0)
     {
       static char buf[64];
 
-      xsnprintf (buf, sizeof buf, "thread %ld", ptid_get_lwp (ptid));
+      xsnprintf (buf, sizeof buf, "thread %ld", ptid.lwp ());
       return buf;
     }
 
@@ -66,7 +66,7 @@ obsd_nat_target::update_thread_list ()
 
       if (!in_thread_list (ptid))
 	{
-	  if (ptid_get_lwp (inferior_ptid) == 0)
+	  if (inferior_ptid.lwp () == 0)
 	    thread_change_ptid (inferior_ptid, ptid);
 	  else
 	    add_thread (ptid);
@@ -154,7 +154,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
       ptid = ptid_t (pid, pe.pe_tid, 0);
       if (!in_thread_list (ptid))
 	{
-	  if (ptid_get_lwp (inferior_ptid) == 0)
+	  if (inferior_ptid.lwp () == 0)
 	    thread_change_ptid (inferior_ptid, ptid);
 	  else
 	    add_thread (ptid);
diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c
index 44661e9a24..5d2d391447 100644
--- a/gdb/ppc-fbsd-nat.c
+++ b/gdb/ppc-fbsd-nat.c
@@ -127,7 +127,7 @@ void
 ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
 {
   gdb_gregset_t regs;
-  pid_t pid = ptid_get_lwp (regcache->ptid ());
+  pid_t pid = regcache->ptid ().lwp ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
@@ -153,7 +153,7 @@ void
 ppc_fbsd_nat_target::store_registers (struct regcache *regcache, int regno)
 {
   gdb_gregset_t regs;
-  pid_t pid = ptid_get_lwp (regcache->ptid ());
+  pid_t pid = regcache->ptid ().lwp ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 09cb247a7a..9719a0e906 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1224,7 +1224,7 @@ have_ptrace_hwdebug_interface (void)
     {
       int tid;
 
-      tid = ptid_get_lwp (inferior_ptid);
+      tid = inferior_ptid.lwp ();
       if (tid == 0)
 	tid = inferior_ptid.pid ();
 
@@ -1296,7 +1296,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
       /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG
 	 and whether the target has DABR.  If either answer is no, the
 	 ptrace call will return -1.  Fail in that case.  */
-      tid = ptid_get_lwp (ptid);
+      tid = ptid.lwp ();
       if (tid == 0)
 	tid = ptid.pid ();
 
@@ -1508,7 +1508,7 @@ ppc_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
     }
 
   ALL_LWPS (lp)
-    hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid));
+    hwdebug_insert_point (&p, lp->ptid.lwp ());
 
   return 0;
 }
@@ -1544,7 +1544,7 @@ ppc_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
     }
 
   ALL_LWPS (lp)
-    hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid));
+    hwdebug_remove_point (&p, lp->ptid.lwp ());
 
   return 0;
 }
@@ -1587,7 +1587,7 @@ ppc_linux_nat_target::insert_mask_watchpoint (CORE_ADDR addr,  CORE_ADDR mask,
   p.condition_value = 0;
 
   ALL_LWPS (lp)
-    hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid));
+    hwdebug_insert_point (&p, lp->ptid.lwp ());
 
   return 0;
 }
@@ -1615,7 +1615,7 @@ ppc_linux_nat_target::remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
   p.condition_value = 0;
 
   ALL_LWPS (lp)
-    hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid));
+    hwdebug_remove_point (&p, lp->ptid.lwp ());
 
   return 0;
 }
@@ -1625,7 +1625,7 @@ static int
 can_use_watchpoint_cond_accel (void)
 {
   struct thread_points *p;
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   int cnt = hwdebug_info.num_condition_regs, i;
   CORE_ADDR tmp_value;
 
@@ -1879,7 +1879,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
       create_watchpoint_request (&p, addr, len, type, cond, 1);
 
       ALL_LWPS (lp)
-	hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid));
+	hwdebug_insert_point (&p, lp->ptid.lwp ());
 
       ret = 0;
     }
@@ -1923,7 +1923,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
       saved_dabr_value = dabr_value;
 
       ALL_LWPS (lp)
-	if (ptrace (PTRACE_SET_DEBUGREG, ptid_get_lwp (lp->ptid), 0,
+	if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0,
 		    saved_dabr_value) < 0)
 	  return -1;
 
@@ -1948,7 +1948,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
       create_watchpoint_request (&p, addr, len, type, cond, 0);
 
       ALL_LWPS (lp)
-	hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid));
+	hwdebug_remove_point (&p, lp->ptid.lwp ());
 
       ret = 0;
     }
@@ -1956,7 +1956,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
     {
       saved_dabr_value = 0;
       ALL_LWPS (lp)
-	if (ptrace (PTRACE_SET_DEBUGREG, ptid_get_lwp (lp->ptid), 0,
+	if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0,
 		    saved_dabr_value) < 0)
 	  return -1;
 
@@ -1969,7 +1969,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
 void
 ppc_linux_nat_target::low_new_thread (struct lwp_info *lp)
 {
-  int tid = ptid_get_lwp (lp->ptid);
+  int tid = lp->ptid.lwp ();
 
   if (have_ptrace_hwdebug_interface ())
     {
@@ -2008,7 +2008,7 @@ static void
 ppc_linux_thread_exit (struct thread_info *tp, int silent)
 {
   int i;
-  int tid = ptid_get_lwp (tp->ptid);
+  int tid = tp->ptid.lwp ();
   struct hw_break_tuple *hw_breaks;
   struct thread_points *t = NULL, *p;
 
@@ -2057,7 +2057,7 @@ ppc_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
       /* The index (or slot) of the *point is passed in the si_errno field.  */
       int slot = siginfo.si_errno;
 
-      t = hwdebug_find_thread_points_by_tid (ptid_get_lwp (inferior_ptid), 0);
+      t = hwdebug_find_thread_points_by_tid (inferior_ptid.lwp (), 0);
 
       /* Find out if this *point is a hardware breakpoint.
 	 If so, we should return 0.  */
@@ -2183,7 +2183,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
 				  gdb_byte *endptr, CORE_ADDR *typep,
 				  CORE_ADDR *valp)
 {
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid ();
 
@@ -2210,7 +2210,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
 const struct target_desc *
 ppc_linux_nat_target::read_description ()
 {
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid ();
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 07b13b80dc..aa4498af90 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1635,17 +1635,17 @@ procfs_find_LDT_entry (ptid_t ptid)
   procinfo      *pi;
 
   /* Find procinfo for the lwp.  */
-  if ((pi = find_procinfo (ptid.pid (), ptid_get_lwp (ptid))) == NULL)
+  if ((pi = find_procinfo (ptid.pid (), ptid.lwp ())) == NULL)
     {
       warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
-	       ptid.pid (), ptid_get_lwp (ptid));
+	       ptid.pid (), ptid.lwp ());
       return NULL;
     }
   /* get its general registers.  */
   if ((gregs = proc_get_gregs (pi)) == NULL)
     {
       warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
-	       ptid.pid (), ptid_get_lwp (ptid));
+	       ptid.pid (), ptid.lwp ());
       return NULL;
     }
   /* Now extract the GS register's lower 16 bits.  */
@@ -2065,7 +2065,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
   procinfo *pi;
   ptid_t ptid = regcache->ptid ();
   int pid = ptid.pid ();
-  int tid = ptid_get_lwp (ptid);
+  int tid = ptid.lwp ();
   struct gdbarch *gdbarch = regcache->arch ();
 
   pi = find_procinfo_or_die (pid, tid);
@@ -2114,7 +2114,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum)
   procinfo *pi;
   ptid_t ptid = regcache->ptid ();
   int pid = ptid.pid ();
-  int tid = ptid_get_lwp (ptid);
+  int tid = ptid.lwp ();
   struct gdbarch *gdbarch = regcache->arch ();
 
   pi = find_procinfo_or_die (pid, tid);
@@ -2533,9 +2533,9 @@ wait_again:
 		     procinfo, resume may be unhappy later.  */
 		  add_thread (retval);
 		  if (find_procinfo (retval.pid (),
-				     ptid_get_lwp (retval)) == NULL)
+				     retval.lwp ()) == NULL)
 		    create_procinfo (retval.pid (),
-				     ptid_get_lwp (retval));
+				     retval.lwp ());
 		}
 	    }
 	  else	/* Flags do not indicate STOPPED.  */
@@ -2752,7 +2752,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
     {
       /* Resume a specific thread, presumably suppressing the
 	 others.  */
-      thread = find_procinfo (ptid.pid (), ptid_get_lwp (ptid));
+      thread = find_procinfo (ptid.pid (), ptid.lwp ());
       if (thread != NULL)
 	{
 	  if (thread->tid != 0)
@@ -3178,7 +3178,7 @@ procfs_target::thread_alive (ptid_t ptid)
   procinfo *pi;
 
   proc    = ptid.pid ();
-  thread  = ptid_get_lwp (ptid);
+  thread  = ptid.lwp ();
   /* If I don't know it, it ain't alive!  */
   if ((pi = find_procinfo (proc, thread)) == NULL)
     return false;
@@ -3203,10 +3203,10 @@ procfs_target::pid_to_str (ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_get_lwp (ptid) == 0)
+  if (ptid.lwp () == 0)
     sprintf (buf, "process %d", ptid.pid ());
   else
-    sprintf (buf, "LWP %ld", ptid_get_lwp (ptid));
+    sprintf (buf, "LWP %ld", ptid.lwp ());
 
   return buf;
 }
@@ -3764,7 +3764,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
   gdb_fpregset_t fpregs;
   unsigned long merged_pid;
 
-  merged_pid = ptid_get_lwp (ptid) << 16 | ptid.pid ();
+  merged_pid = ptid.lwp () << 16 | ptid.pid ();
 
   /* This part is the old method for fetching registers.
      It should be replaced by the newer one using regsets
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 67cf4c4641..a24d1f4a3a 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -267,7 +267,7 @@ gdbpy_create_ptid_object (ptid_t ptid)
     return NULL;
 
   pid = ptid.pid ();
-  lwp = ptid_get_lwp (ptid);
+  lwp = ptid.lwp ();
   tid = ptid_get_tid (ptid);
 
   PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index f748e87989..fccb37ebda 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid)
      2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
      query, which the remote protocol layer then treats as a thread
      whose TID is 0.  This is obviously not a ravenscar task.  */
-  return ptid_get_lwp (ptid) == 0 && ptid_get_tid (ptid) != 0;
+  return ptid.lwp () == 0 && ptid_get_tid (ptid) != 0;
 }
 
 /* Given PTID, which can be either a ravenscar task or a CPU thread,
@@ -171,7 +171,7 @@ ravenscar_get_thread_base_cpu (ptid_t ptid)
   else
     {
       /* We assume that the LWP of the PTID is equal to the CPU number.  */
-      base_cpu = ptid_get_lwp (ptid);
+      base_cpu = ptid.lwp ();
     }
 
   return base_cpu;
diff --git a/gdb/remote.c b/gdb/remote.c
index 2d2d224783..53359ca44a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2780,7 +2780,7 @@ remote_thread_always_alive (ptid_t ptid)
     /* The main thread is always alive.  */
     return 1;
 
-  if (ptid.pid () != 0 && ptid_get_lwp (ptid) == 0)
+  if (ptid.pid () != 0 && ptid.lwp () == 0)
     /* The main thread is always alive.  This can happen after a
        vAttach, if the remote side doesn't support
        multi-threading.  */
@@ -2922,7 +2922,7 @@ remote_target::write_ptid (char *buf, const char *endbuf, ptid_t ptid)
       else
 	buf += xsnprintf (buf, endbuf - buf, "p%x.", pid);
     }
-  tid = ptid_get_lwp (ptid);
+  tid = ptid.lwp ();
   if (tid < 0)
     buf += xsnprintf (buf, endbuf - buf, "-%x", -tid);
   else
@@ -3839,7 +3839,7 @@ remote_target::extra_thread_info (thread_info *tp)
 		    _("remote_threads_extra_info"));
 
   if (ptid_equal (tp->ptid, magic_null_ptid)
-      || (tp->ptid.pid () != 0 && ptid_get_lwp (tp->ptid) == 0))
+      || (tp->ptid.pid () != 0 && tp->ptid.lwp () == 0))
     /* This is the main thread which was added by GDB.  The remote
        server doesn't know about it.  */
     return NULL;
@@ -3881,7 +3881,7 @@ remote_target::extra_thread_info (thread_info *tp)
   rs->use_threadextra_query = 0;
   set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME
     | TAG_MOREDISPLAY | TAG_DISPLAY;
-  int_to_threadref (&id, ptid_get_lwp (tp->ptid));
+  int_to_threadref (&id, tp->ptid.lwp ());
   if (remote_get_threadinfo (&id, set, &threadinfo))
     if (threadinfo.active)
       {
@@ -11470,14 +11470,14 @@ remote_target::pid_to_str (ptid_t ptid)
       if (ptid_equal (magic_null_ptid, ptid))
 	xsnprintf (buf, sizeof buf, "Thread <main>");
       else if (remote_multi_process_p (rs))
-	if (ptid_get_lwp (ptid) == 0)
+	if (ptid.lwp () == 0)
 	  return normal_pid_to_str (ptid);
 	else
 	  xsnprintf (buf, sizeof buf, "Thread %d.%ld",
-		     ptid.pid (), ptid_get_lwp (ptid));
+		     ptid.pid (), ptid.lwp ());
       else
 	xsnprintf (buf, sizeof buf, "Thread %ld",
-		   ptid_get_lwp (ptid));
+		   ptid.lwp ());
       return buf;
     }
 }
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index b112a3dd75..2c60562810 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -258,7 +258,7 @@ static int
 s390_inferior_tid (void)
 {
   /* GNU/Linux LWP ID's are process ID's.  */
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid (); /* Not a threaded program.  */
 
@@ -730,7 +730,7 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
 
   lp_priv->per_info_changed = 0;
 
-  tid = ptid_get_lwp (ptid_of_lwp (lp));
+  tid = ptid_of_lwp (lp).lwp ();
   if (tid == 0)
     tid = pid;
 
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 44a98a1d65..c5540577f0 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -348,7 +348,7 @@ lwp_to_thread (ptid_t lwp)
   if (!target_thread_alive (lwp))
     return ptid_t (-1);	/* Must be a defunct LPW.  */
 
-  val = p_td_ta_map_lwp2thr (main_ta, ptid_get_lwp (lwp), &th);
+  val = p_td_ta_map_lwp2thr (main_ta, lwp.lwp (), &th);
   if (val == TD_NOTHR)
     return ptid_t (-1);	/* Thread must have terminated.  */
   else if (val != TD_OK)
@@ -1014,13 +1014,13 @@ sol_thread_target::pid_to_str (ptid_t ptid)
 		   ptid_get_tid (ptid));
       else if (lwp.pid () != -2)
 	xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
-		 ptid_get_tid (ptid), ptid_get_lwp (lwp));
+		 ptid_get_tid (ptid), lwp.lwp ());
       else
 	xsnprintf (buf, sizeof (buf), "Thread %ld        ",
 		   ptid_get_tid (ptid));
     }
-  else if (ptid_get_lwp (ptid) != 0)
-    xsnprintf (buf, sizeof (buf), "LWP    %ld        ", ptid_get_lwp (ptid));
+  else if (ptid.lwp () != 0)
+    xsnprintf (buf, sizeof (buf), "LWP    %ld        ", ptid.lwp ());
   else
     xsnprintf (buf, sizeof (buf), "process %d    ", ptid.pid ());
 
diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c
index 71e813b3c5..ba37fe180e 100644
--- a/gdb/sol2-tdep.c
+++ b/gdb/sol2-tdep.c
@@ -49,11 +49,11 @@ sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
 
   /* Check whether we're printing an LWP (gdb thread) or a
      process.  */
-  pid = ptid_get_lwp (ptid);
+  pid = ptid.lwp ();
   if (pid != 0)
     {
       /* A thread.  */
-      xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
+      xsnprintf (buf, sizeof buf, "LWP %ld", ptid.lwp ());
       return buf;
     }
 
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 65b434efec..c2d6569ee0 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -69,7 +69,7 @@ fetch_ppc_register (int regno)
 {
   PTRACE_TYPE_RET res;
 
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid ();
 
@@ -154,7 +154,7 @@ fetch_ppc_memory (ULONGEST memaddr, gdb_byte *myaddr, int len)
 	       / sizeof (PTRACE_TYPE_RET));
   PTRACE_TYPE_RET *buffer;
 
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid ();
 
@@ -184,7 +184,7 @@ store_ppc_memory (ULONGEST memaddr, const gdb_byte *myaddr, int len)
 	       / sizeof (PTRACE_TYPE_RET));
   PTRACE_TYPE_RET *buffer;
 
-  int tid = ptid_get_lwp (inferior_ptid);
+  int tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid ();
 
@@ -422,7 +422,7 @@ spu_linux_nat_target::post_startup_inferior (ptid_t ptid)
   int fd;
   ULONGEST addr;
 
-  int tid = ptid_get_lwp (ptid);
+  int tid = ptid.lwp ();
   if (tid == 0)
     tid = ptid.pid ();
   
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index b1a96c1f94..fe6598e12f 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -114,7 +114,7 @@ x86_linux_nat_target::read_description ()
   uint64_t xcr0_features_bits;
 
   /* GNU/Linux LWP ID's are process ID's.  */
-  tid = ptid_get_lwp (inferior_ptid);
+  tid = inferior_ptid.lwp ();
   if (tid == 0)
     tid = inferior_ptid.pid (); /* Not a threaded program.  */
 
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 5ac29ee18b..007a5c3f05 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -202,7 +202,7 @@ supply_fpregset (struct regcache *regcache,
 static void
 fetch_gregs (struct regcache *regcache, int regnum)
 {
-  int tid = ptid_get_lwp (regcache->ptid ());
+  int tid = regcache->ptid ().lwp ();
   gdb_gregset_t regs;
   int areg;
   
@@ -221,7 +221,7 @@ fetch_gregs (struct regcache *regcache, int regnum)
 static void
 store_gregs (struct regcache *regcache, int regnum)
 {
-  int tid = ptid_get_lwp (regcache->ptid ());
+  int tid = regcache->ptid ().lwp ();
   gdb_gregset_t regs;
   int areg;
 
@@ -249,7 +249,7 @@ static int xtreg_high;
 static void
 fetch_xtregs (struct regcache *regcache, int regnum)
 {
-  int tid = ptid_get_lwp (regcache->ptid ());
+  int tid = regcache->ptid ().lwp ();
   const xtensa_regtable_t *ptr;
   char xtregs [XTENSA_ELF_XTREG_SIZE];
 
@@ -264,7 +264,7 @@ fetch_xtregs (struct regcache *regcache, int regnum)
 static void
 store_xtregs (struct regcache *regcache, int regnum)
 {
-  int tid = ptid_get_lwp (regcache->ptid ());
+  int tid = regcache->ptid ().lwp ();
   const xtensa_regtable_t *ptr;
   char xtregs [XTENSA_ELF_XTREG_SIZE];
 
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 01/10] Remove ptid_build
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (8 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 04/10] Remove ptid_get_lwp Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 23:22 ` [RFA 00/10] Remove standalone ptid functions Joel Brobecker
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_build in favor of simply calling the ptid_t
constructor directly.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.h (ptid_build): Don't declare.
	* common/ptid.c (ptid_build): Remove.
	* aix-thread.c: Update.
	* bsd-kvm.c: Update.
	* bsd-uthread.c: Update.
	* common/agent.c: Update.
	* common/ptid.c: Update.
	* common/ptid.h: Update.
	* corelow.c: Update.
	* darwin-nat.c: Update.
	* fbsd-nat.c: Update.
	* gnu-nat.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-thread-db.c: Update.
	* nat/linux-osdata.c: Update.
	* nat/linux-procfs.c: Update.
	* nto-procfs.c: Update.
	* obsd-nat.c: Update.
	* proc-service.c: Update.
	* procfs.c: Update.
	* ravenscar-thread.c: Update.
	* remote-sim.c: Update.
	* remote.c: Update.
	* sol-thread.c: Update.
	* target.c: Update.
	* windows-nat.c: Update.

gdbserver/ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* linux-low.c: Update.
	* lynx-low.c: Update.
	* nto-low.c: Update.
	* remote-utils.c: Update.
	* spu-low.c: Update.
	* thread-db.c: Update.
	* win32-low.c: Update.
---
 gdb/ChangeLog                | 30 ++++++++++++++++++++++++++++++
 gdb/aix-thread.c             |  4 ++--
 gdb/bsd-kvm.c                |  2 +-
 gdb/bsd-uthread.c            |  4 ++--
 gdb/common/agent.c           |  2 +-
 gdb/common/ptid.c            |  8 --------
 gdb/common/ptid.h            |  4 ----
 gdb/corelow.c                |  2 +-
 gdb/darwin-nat.c             | 18 +++++++++---------
 gdb/fbsd-nat.c               |  6 +++---
 gdb/gdbserver/ChangeLog      | 10 ++++++++++
 gdb/gdbserver/linux-low.c    | 12 ++++++------
 gdb/gdbserver/lynx-low.c     | 16 ++++++++--------
 gdb/gdbserver/nto-low.c      | 10 +++++-----
 gdb/gdbserver/remote-utils.c |  4 ++--
 gdb/gdbserver/spu-low.c      |  8 ++++----
 gdb/gdbserver/thread-db.c    |  2 +-
 gdb/gdbserver/win32-low.c    |  4 ++--
 gdb/gnu-nat.c                | 10 +++++-----
 gdb/linux-fork.c             |  2 +-
 gdb/linux-nat.c              | 22 +++++++++++-----------
 gdb/linux-thread-db.c        |  6 +++---
 gdb/nat/linux-osdata.c       |  6 +++---
 gdb/nat/linux-procfs.c       |  2 +-
 gdb/nto-procfs.c             |  6 +++---
 gdb/obsd-nat.c               |  4 ++--
 gdb/proc-service.c           |  8 ++++----
 gdb/procfs.c                 | 14 +++++++-------
 gdb/ravenscar-thread.c       |  6 +++---
 gdb/remote-sim.c             |  2 +-
 gdb/remote.c                 | 18 +++++++++---------
 gdb/sol-thread.c             | 16 ++++++++--------
 gdb/target.c                 |  2 +-
 gdb/windows-nat.c            | 27 +++++++++++++--------------
 34 files changed, 162 insertions(+), 135 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index edb60f7c00..2ee61577af 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,33 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.h (ptid_build): Don't declare.
+	* common/ptid.c (ptid_build): Remove.
+	* aix-thread.c: Update.
+	* bsd-kvm.c: Update.
+	* bsd-uthread.c: Update.
+	* common/agent.c: Update.
+	* common/ptid.c: Update.
+	* common/ptid.h: Update.
+	* corelow.c: Update.
+	* darwin-nat.c: Update.
+	* fbsd-nat.c: Update.
+	* gnu-nat.c: Update.
+	* linux-fork.c: Update.
+	* linux-nat.c: Update.
+	* linux-thread-db.c: Update.
+	* nat/linux-osdata.c: Update.
+	* nat/linux-procfs.c: Update.
+	* nto-procfs.c: Update.
+	* obsd-nat.c: Update.
+	* proc-service.c: Update.
+	* procfs.c: Update.
+	* ravenscar-thread.c: Update.
+	* remote-sim.c: Update.
+	* remote.c: Update.
+	* sol-thread.c: Update.
+	* target.c: Update.
+	* windows-nat.c: Update.
+
 2018-06-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 	    Stephen Roberts  <stephen.roberts@arm.com>
 
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 8b1b0ed97f..f4d3ac4770 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -818,7 +818,7 @@ sync_threadlists (void)
 	  ptid_t pptid, gptid;
 	  int cmp_result;
 
-	  pptid = ptid_build (infpid, 0, pbuf[pi].pthid);
+	  pptid = ptid_t (infpid, 0, pbuf[pi].pthid);
 	  gptid = gbuf[gi]->ptid;
 	  pdtid = pbuf[pi].pdtid;
 	  tid = pbuf[pi].tid;
@@ -1832,7 +1832,7 @@ aix_thread_target::extra_thread_info (struct thread_info *thread)
 ptid_t
 aix_thread_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_build (ptid_get_pid (inferior_ptid), 0, thread);
+  return ptid_t (ptid_get_pid (inferior_ptid), 0, thread);
 }
 
 
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 336dbf2b97..46c773ff95 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -413,5 +413,5 @@ Generic command for manipulating the kernel memory interface."),
      ptid (1, 1, 2) -> kvm inferior 1, process 2
      ptid (1, 1, n) -> kvm inferior 1, process n  */
 
-  bsd_kvm_ptid = ptid_build (1, 1, 0);
+  bsd_kvm_ptid = ptid_t (1, 1, 0);
 }
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index ee2e5ade96..4eeb787153 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -407,7 +407,7 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
 	{
 	  ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
 	  if (magic == BSD_UTHREAD_PTHREAD_MAGIC)
-	    ptid = ptid_build (ptid_get_pid (ptid), 0, addr);
+	    ptid = ptid_t (ptid_get_pid (ptid), 0, addr);
 	}
     }
 
@@ -465,7 +465,7 @@ bsd_uthread_target::update_thread_list ()
   addr = bsd_uthread_read_memory_address (bsd_uthread_thread_list_addr);
   while (addr != 0)
     {
-      ptid_t ptid = ptid_build (pid, 0, addr);
+      ptid_t ptid = ptid_t (pid, 0, addr);
 
       if (!in_thread_list (ptid) || is_exited (ptid))
 	{
diff --git a/gdb/common/agent.c b/gdb/common/agent.c
index da91f2d60a..65d5f1938b 100644
--- a/gdb/common/agent.c
+++ b/gdb/common/agent.c
@@ -190,7 +190,7 @@ agent_run_command (int pid, const char *cmd, int len)
 {
   int fd;
   int tid = agent_get_helper_thread_id ();
-  ptid_t ptid = ptid_build (pid, tid, 0);
+  ptid_t ptid = ptid_t (pid, tid, 0);
 
   int ret = target_write_memory (ipa_sym_addrs.addr_cmd_buf,
 				 (gdb_byte *) cmd, len);
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index c3d2794141..49d27b4d55 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
 
 /* See ptid.h.  */
 
-ptid_t
-ptid_build (int pid, long lwp, long tid)
-{
-  return ptid_t (pid, lwp, tid);
-}
-
-/* See ptid.h.  */
-
 ptid_t
 pid_to_ptid (int pid)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 4b45452058..030e97d45b 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -158,10 +158,6 @@ extern ptid_t minus_one_ptid;
 
 /* See ptid_t::ptid_t.  */
 
-extern ptid_t ptid_build (int pid, long lwp, long tid);
-
-/* See ptid_t::ptid_t.  */
-
 extern ptid_t pid_to_ptid (int pid);
 
 /* See ptid_t::pid.  */
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 2ae233ec1a..99fe04c8c9 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -312,7 +312,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
       inf->fake_pid_p = fake_pid_p;
     }
 
-  ptid = ptid_build (pid, lwpid, 0);
+  ptid = ptid_t (pid, lwpid, 0);
 
   add_thread (ptid);
 
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index ed1ed32898..363a89f3c1 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -342,7 +342,7 @@ darwin_check_new_threads (struct inferior *inf)
 	  pti->msg_state = DARWIN_RUNNING;
 
 	  /* Add the new thread.  */
-	  add_thread_with_info (ptid_build (inf->pid, 0, new_id), pti);
+	  add_thread_with_info (ptid_t (inf->pid, 0, new_id), pti);
 	  new_thread_vec.push_back (pti);
 	  new_ix++;
 	  continue;
@@ -350,7 +350,7 @@ darwin_check_new_threads (struct inferior *inf)
       if (old_ix < old_nbr && (new_ix == new_nbr || new_id > old_id))
 	{
 	  /* A thread was removed.  */
-	  delete_thread (ptid_build (inf->pid, 0, old_id));
+	  delete_thread (ptid_t (inf->pid, 0, old_id));
 	  kret = mach_port_deallocate (gdb_task, old_id);
 	  MACH_CHECK_ERROR (kret);
 	  old_ix++;
@@ -1072,7 +1072,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
 	  break;
 	}
 
-      return ptid_build (inf->pid, 0, thread->gdb_port);
+      return ptid_t (inf->pid, 0, thread->gdb_port);
     }
   else if (hdr->msgh_id == 0x48)
     {
@@ -1132,7 +1132,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
 	      /* Looks necessary on Leopard and harmless...  */
 	      wait4 (inf->pid, &wstatus, 0, NULL);
 
-	      inferior_ptid = ptid_build (inf->pid, 0, 0);
+	      inferior_ptid = ptid_t (inf->pid, 0, 0);
 	      return inferior_ptid;
 	    }
 	  else
@@ -1140,7 +1140,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
 	      inferior_debug (4, _("darwin_wait: pid=%d\n"), inf->pid);
 	      status->kind = TARGET_WAITKIND_EXITED;
 	      status->value.integer = 0; /* Don't know.  */
-	      return ptid_build (inf->pid, 0, 0);
+	      return ptid_t (inf->pid, 0, 0);
 	    }
 	}
     }
@@ -1211,7 +1211,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
       status->value.sig = GDB_SIGNAL_TRAP;
       thread = priv->threads[0];
       thread->msg_state = DARWIN_STOPPED;
-      return ptid_build (inf->pid, 0, thread->gdb_port);
+      return ptid_t (inf->pid, 0, thread->gdb_port);
     }
 
   do
@@ -1283,7 +1283,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 	  && thread->event.ex_type == EXC_BREAKPOINT)
 	{
 	  if (thread->single_step
-	      || cancel_breakpoint (ptid_build (inf->pid, 0, thread->gdb_port)))
+	      || cancel_breakpoint (ptid_t (inf->pid, 0, thread->gdb_port)))
 	    {
 	      gdb_assert (thread->msg_state == DARWIN_MESSAGE);
 	      darwin_send_reply (inf, thread);
@@ -2255,7 +2255,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
   for (darwin_thread_t *t : priv->threads)
     {
       if (t->inf_port == lwp)
-	return ptid_build (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
+	return ptid_t (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
     }
 
   /* Maybe the port was never extract.  Do it now.  */
@@ -2299,7 +2299,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
                  names_count * sizeof (mach_port_t));
 
   if (res)
-    return ptid_build (ptid_get_pid (inferior_ptid), 0, res);
+    return ptid_t (ptid_get_pid (inferior_ptid), 0, res);
   else
     return null_ptid;
 }
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 069e1e44be..cfacb2cf23 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -939,7 +939,7 @@ fbsd_add_threads (pid_t pid)
 
   for (i = 0; i < nlwps; i++)
     {
-      ptid_t ptid = ptid_build (pid, lwps[i], 0);
+      ptid_t ptid = ptid_t (pid, lwps[i], 0);
 
       if (!in_thread_list (ptid))
 	{
@@ -1253,7 +1253,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	  if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
 	    perror_with_name (("ptrace"));
 
-	  wptid = ptid_build (pid, pl.pl_lwpid, 0);
+	  wptid = ptid_t (pid, pl.pl_lwpid, 0);
 
 	  if (debug_fbsd_nat)
 	    {
@@ -1356,7 +1356,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 		    perror_with_name (("ptrace"));
 
 		  gdb_assert (pl.pl_flags & PL_FLAG_CHILD);
-		  child_ptid = ptid_build (child, pl.pl_lwpid, 0);
+		  child_ptid = ptid_t (child, pl.pl_lwpid, 0);
 		}
 
 	      /* Enable additional events on the child process.  */
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index ac1eb1c909..86f77a957d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,13 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* linux-low.c: Update.
+	* lynx-low.c: Update.
+	* nto-low.c: Update.
+	* remote-utils.c: Update.
+	* spu-low.c: Update.
+	* thread-db.c: Update.
+	* win32-low.c: Update.
+
 2018-06-11  Alan Hayward  <alan.hayward@arm.com>
 
 	* linux-aarch64-ipa.c (get_ipa_tdesc): Add null VQ param.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 1211944d79..ce4d660806 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -523,7 +523,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 	  struct thread_info *child_thr;
 	  struct target_desc *tdesc;
 
-	  ptid = ptid_build (new_pid, new_pid, 0);
+	  ptid = ptid_t (new_pid, new_pid, 0);
 
 	  if (debug_threads)
 	    {
@@ -630,7 +630,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 		      "from LWP %ld, new child is LWP %ld\n",
 		      lwpid_of (event_thr), new_pid);
 
-      ptid = ptid_build (pid_of (event_thr), new_pid, 0);
+      ptid = ptid_t (pid_of (event_thr), new_pid, 0);
       new_lwp = add_lwp (ptid);
 
       /* Either we're going to immediately resume the new thread
@@ -1017,7 +1017,7 @@ linux_create_inferior (const char *program,
 
   linux_add_process (pid, 0);
 
-  ptid = ptid_build (pid, pid, 0);
+  ptid = ptid_t (pid, pid, 0);
   new_lwp = add_lwp (ptid);
   new_lwp->must_set_ptrace_flags = 1;
 
@@ -1185,7 +1185,7 @@ linux_attach (unsigned long pid)
 {
   struct process_info *proc;
   struct thread_info *initial_thread;
-  ptid_t ptid = ptid_build (pid, pid, 0);
+  ptid_t ptid = ptid_t (pid, pid, 0);
   int err;
 
   /* Attach to PID.  We will check for other threads
@@ -1202,7 +1202,7 @@ linux_attach (unsigned long pid)
 
   /* Don't ignore the initial SIGSTOP if we just attached to this
      process.  It will be collected by wait shortly.  */
-  initial_thread = find_thread_ptid (ptid_build (pid, pid, 0));
+  initial_thread = find_thread_ptid (ptid_t (pid, pid, 0));
   initial_thread->last_resume_kind = resume_stop;
 
   /* We must attach to every LWP.  If /proc is mounted, use that to
@@ -2391,7 +2391,7 @@ linux_low_filter_event (int lwpid, int wstat)
 			"after exec.\n", lwpid);
 	}
 
-      child_ptid = ptid_build (lwpid, lwpid, 0);
+      child_ptid = ptid_t (lwpid, lwpid, 0);
       child = add_lwp (child_ptid);
       child->stopped = 1;
       current_thread = child->thread;
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index a0b9817729..b19ea62172 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -64,14 +64,14 @@ lynx_debug (char *string, ...)
 /* Build a ptid_t given a PID and a LynxOS TID.  */
 
 static ptid_t
-lynx_ptid_build (int pid, long tid)
+lynx_ptid_t (int pid, long tid)
 {
   /* brobecker/2010-06-21: It looks like the LWP field in ptids
      should be distinct for each thread (see write_ptid where it
      writes the thread ID from the LWP).  So instead of storing
      the LynxOS tid in the tid field of the ptid, we store it in
      the lwp field.  */
-  return ptid_build (pid, tid, 0);
+  return ptid_t (pid, tid, 0);
 }
 
 /* Return the process ID of the given PTID.
@@ -91,7 +91,7 @@ lynx_ptid_get_pid (ptid_t ptid)
 static long
 lynx_ptid_get_tid (ptid_t ptid)
 {
-  /* See lynx_ptid_build: The LynxOS tid is stored inside the lwp field
+  /* See lynx_ptid_t: The LynxOS tid is stored inside the lwp field
      of the ptid.  */
   return ptid_get_lwp (ptid);
 }
@@ -294,7 +294,7 @@ lynx_add_threads_after_attach (int pid)
     if ((sscanf (buf, "%d %d", &thread_pid, &thread_tid) == 2
 	 && thread_pid == pid))
     {
-      ptid_t thread_ptid = lynx_ptid_build (pid, thread_tid);
+      ptid_t thread_ptid = lynx_ptid_t (pid, thread_tid);
 
       if (!find_thread_ptid (thread_ptid))
 	{
@@ -312,7 +312,7 @@ lynx_add_threads_after_attach (int pid)
 static int
 lynx_attach (unsigned long pid)
 {
-  ptid_t ptid = lynx_ptid_build (pid, 0);
+  ptid_t ptid = lynx_ptid_t (pid, 0);
 
   if (lynx_ptrace (PTRACE_ATTACH, ptid, 0, 0, 0) != 0)
     error ("Cannot attach to process %lu: %s (%d)\n", pid,
@@ -430,7 +430,7 @@ lynx_wait_1 (ptid_t ptid, struct target_waitstatus *status, int options)
 retry:
 
   ret = lynx_waitpid (pid, &wstat);
-  new_ptid = lynx_ptid_build (ret, ((union wait *) &wstat)->w_tid);
+  new_ptid = lynx_ptid_t (ret, ((union wait *) &wstat)->w_tid);
   find_process_pid (ret)->priv->last_wait_event_ptid = new_ptid;
 
   /* If this is a new thread, then add it now.  The reason why we do
@@ -524,7 +524,7 @@ lynx_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 static int
 lynx_kill (int pid)
 {
-  ptid_t ptid = lynx_ptid_build (pid, 0);
+  ptid_t ptid = lynx_ptid_t (pid, 0);
   struct target_waitstatus status;
   struct process_info *process;
 
@@ -543,7 +543,7 @@ lynx_kill (int pid)
 static int
 lynx_detach (int pid)
 {
-  ptid_t ptid = lynx_ptid_build (pid, 0);
+  ptid_t ptid = lynx_ptid_t (pid, 0);
   struct process_info *process;
 
   process = find_process_pid (pid);
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index b68b811159..ed28426542 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -142,7 +142,7 @@ nto_find_new_threads (struct nto_inferior *nto_inferior)
 	{
 	  struct thread_info *ti;
 
-	  ptid = ptid_build (nto_inferior->pid, tid, 0);
+	  ptid = ptid_t (nto_inferior->pid, tid, 0);
 	  ti = find_thread_ptid (ptid);
 	  if (ti != NULL)
 	    {
@@ -157,7 +157,7 @@ nto_find_new_threads (struct nto_inferior *nto_inferior)
       if (status.state != STATE_DEAD)
 	{
 	  TRACE ("Adding thread %d\n", tid);
-	  ptid = ptid_build (nto_inferior->pid, tid, 0);
+	  ptid = ptid_t (nto_inferior->pid, tid, 0);
 	  if (!find_thread_ptid (ptid))
 	    add_thread (ptid, NULL);
 	}
@@ -208,7 +208,7 @@ do_attach (pid_t pid)
       struct process_info *proc;
 
       kill (pid, SIGCONT);
-      ptid = ptid_build (status.pid, status.tid, 0);
+      ptid = ptid_t (status.pid, status.tid, 0);
       the_low_target.arch_setup ();
       proc = add_process (status.pid, 1);
       proc->tdesc = nto_tdesc;
@@ -609,7 +609,7 @@ nto_wait (ptid_t ptid,
 	}
     }
 
-  return ptid_build (status.pid, status.tid, 0);
+  return ptid_t (status.pid, status.tid, 0);
 }
 
 /* Fetch inferior's registers for currently selected thread (CURRENT_INFERIOR).
@@ -740,7 +740,7 @@ static void
 nto_request_interrupt (void)
 {
   TRACE ("%s\n", __func__);
-  nto_set_thread (ptid_build (nto_inferior.pid, 1, 0));
+  nto_set_thread (ptid_t (nto_inferior.pid, 1, 0));
   if (EOK != devctl (nto_inferior.ctl_fd, DCMD_PROC_STOP, NULL, 0, 0))
     TRACE ("Error stopping inferior.\n");
 }
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 967b2f0ebb..a1a06dcdf5 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -542,7 +542,7 @@ read_ptid (const char *buf, const char **obuf)
 
       if (obuf)
 	*obuf = pp;
-      return ptid_build (pid, tid, 0);
+      return ptid_t (pid, tid, 0);
     }
 
   /* No multi-process.  Just a tid.  */
@@ -555,7 +555,7 @@ read_ptid (const char *buf, const char **obuf)
 
   if (obuf)
     *obuf = pp;
-  return ptid_build (pid, tid, 0);
+  return ptid_t (pid, tid, 0);
 }
 
 /* Write COUNT bytes in BUF to the client.
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 5b880d2a42..13f2b353f2 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -297,7 +297,7 @@ spu_create_inferior (const char *program,
   proc = add_process (pid, 0);
   proc->tdesc = tdesc_spu;
 
-  ptid = ptid_build (pid, pid, 0);
+  ptid = ptid_t (pid, pid, 0);
   add_thread (ptid, NULL);
   return pid;
 }
@@ -319,7 +319,7 @@ spu_attach (unsigned long  pid)
 
   proc = add_process (pid, 1);
   proc->tdesc = tdesc_spu;
-  ptid = ptid_build (pid, pid, 0);
+  ptid = ptid_t (pid, pid, 0);
   add_thread (ptid, NULL);
   return 0;
 }
@@ -474,12 +474,12 @@ spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
     {
       ourstatus->kind = TARGET_WAITKIND_STOPPED;
       ourstatus->value.sig = GDB_SIGNAL_0;
-      return ptid_build (ret, ret, 0);
+      return ptid_t (ret, ret, 0);
     }
 
   ourstatus->kind = TARGET_WAITKIND_STOPPED;
   ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w));
-  return ptid_build (ret, ret, 0);
+  return ptid_t (ret, ret, 0);
 }
 
 /* Fetch inferior registers.  */
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 7dda2edba0..3e42db4420 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -215,7 +215,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
 {
   struct process_info *proc = current_process ();
   int pid = pid_of (proc);
-  ptid_t ptid = ptid_build (pid, ti_p->ti_lid, 0);
+  ptid_t ptid = ptid_t (pid, ti_p->ti_lid, 0);
   struct lwp_info *lwp;
   int err;
 
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 8f5ea5aa59..05bea69adb 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -120,7 +120,7 @@ current_thread_ptid (void)
 static ptid_t
 debug_event_ptid (DEBUG_EVENT *event)
 {
-  return ptid_build (event->dwProcessId, event->dwThreadId, 0);
+  return ptid_t (event->dwProcessId, event->dwThreadId, 0);
 }
 
 /* Get the thread context of the thread associated with TH.  */
@@ -208,7 +208,7 @@ static win32_thread_info *
 child_add_thread (DWORD pid, DWORD tid, HANDLE h, void *tlb)
 {
   win32_thread_info *th;
-  ptid_t ptid = ptid_build (pid, tid, 0);
+  ptid_t ptid = ptid_t (pid, tid, 0);
 
   if ((th = thread_rec (ptid, FALSE)))
     return th;
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c7a40400fc..491d725ce2 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -1096,7 +1096,7 @@ inf_validate_procs (struct inf *inf)
 	    last = thread;
 	    proc_debug (thread, "new thread: %lu", threads[i]);
 
-	    ptid = ptid_build (inf->pid, thread->tid, 0);
+	    ptid = ptid_t (inf->pid, thread->tid, 0);
 
 	    /* Tell GDB's generic thread code.  */
 
@@ -1616,7 +1616,7 @@ rewait:
 
   thread = inf->wait.thread;
   if (thread)
-    ptid = ptid_build (inf->pid, thread->tid, 0);
+    ptid = ptid_t (inf->pid, thread->tid, 0);
   else if (ptid_equal (ptid, minus_one_ptid))
     thread = inf_tid_to_thread (inf, -1);
   else
@@ -1626,7 +1626,7 @@ rewait:
     {
       /* TID is dead; try and find a new thread.  */
       if (inf_update_procs (inf) && inf->threads)
-	ptid = ptid_build (inf->pid, inf->threads->tid, 0); /* The first
+	ptid = ptid_t (inf->pid, inf->threads->tid, 0); /* The first
 							       available
 							       thread.  */
       else
@@ -2167,7 +2167,7 @@ gnu_nat_target::create_inferior (const char *exec_file,
 
   /* We now have thread info.  */
   thread_change_ptid (inferior_ptid,
-		      ptid_build (inf->pid, inf_pick_first_thread (), 0));
+		      ptid_t (inf->pid, inf_pick_first_thread (), 0));
 
   gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
 
@@ -2228,7 +2228,7 @@ gnu_nat_target::attach (const char *args, int from_tty)
 
   inf_update_procs (inf);
 
-  inferior_ptid = ptid_build (pid, inf_pick_first_thread (), 0);
+  inferior_ptid = ptid_t (pid, inf_pick_first_thread (), 0);
 
   /* We have to initialize the terminal settings now, since the code
      below might try to restore them.  */
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 0ae213c825..2ba67e0bd4 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -94,7 +94,7 @@ add_fork (pid_t pid)
     }
 
   fp = XCNEW (struct fork_info);
-  fp->ptid = ptid_build (pid, pid, 0);
+  fp->ptid = ptid_t (pid, pid, 0);
   fp->num = ++highest_fork_num;
 
   if (fork_list == NULL)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 445b59fa4a..aa1a22b8b5 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -940,7 +940,7 @@ find_lwp_pid (ptid_t ptid)
   else
     lwp = ptid_get_pid (ptid);
 
-  dummy.ptid = ptid_build (0, lwp, 0);
+  dummy.ptid = ptid_t (0, lwp, 0);
   lp = (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
   return lp;
 }
@@ -1196,9 +1196,9 @@ linux_nat_target::attach (const char *args, int from_tty)
 
   /* The ptrace base target adds the main thread with (pid,0,0)
      format.  Decorate it with lwp info.  */
-  ptid = ptid_build (ptid_get_pid (inferior_ptid),
-		     ptid_get_pid (inferior_ptid),
-		     0);
+  ptid = ptid_t (ptid_get_pid (inferior_ptid),
+		 ptid_get_pid (inferior_ptid),
+		 0);
   thread_change_ptid (inferior_ptid, ptid);
 
   /* Add the initial process as the first LWP to the list.  */
@@ -1958,7 +1958,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 			    _("wait returned unexpected status 0x%x"), status);
 	}
 
-      ourstatus->value.related_pid = ptid_build (new_pid, new_pid, 0);
+      ourstatus->value.related_pid = ptid_t (new_pid, new_pid, 0);
 
       if (event == PTRACE_EVENT_FORK || event == PTRACE_EVENT_VFORK)
 	{
@@ -1977,7 +1977,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 
 	  /* This won't actually modify the breakpoint list, but will
 	     physically remove the breakpoints from the child.  */
-	  detach_breakpoints (ptid_build (new_pid, new_pid, 0));
+	  detach_breakpoints (ptid_t (new_pid, new_pid, 0));
 
 	  /* Retain child fork in ptrace (stopped) state.  */
 	  if (!find_fork_pid (new_pid))
@@ -2008,7 +2008,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 				"from LWP %d, new child is LWP %ld\n",
 				pid, new_pid);
 
-	  new_lp = add_lwp (ptid_build (ptid_get_pid (lp->ptid), new_pid, 0));
+	  new_lp = add_lwp (ptid_t (ptid_get_pid (lp->ptid), new_pid, 0));
 	  new_lp->stopped = 1;
 	  new_lp->resumed = 1;
 
@@ -2938,7 +2938,7 @@ linux_nat_filter_event (int lwpid, int status)
 			    "LLW: Re-adding thread group leader LWP %d.\n",
 			    lwpid);
 
-      lp = add_lwp (ptid_build (lwpid, lwpid, 0));
+      lp = add_lwp (ptid_t (lwpid, lwpid, 0));
       lp->stopped = 1;
       lp->resumed = 1;
       add_thread (lp->ptid);
@@ -3253,8 +3253,8 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
     {
       /* Upgrade the main thread's ptid.  */
       thread_change_ptid (inferior_ptid,
-			  ptid_build (ptid_get_pid (inferior_ptid),
-				      ptid_get_pid (inferior_ptid), 0));
+			  ptid_t (ptid_get_pid (inferior_ptid),
+				  ptid_get_pid (inferior_ptid), 0));
 
       lp = add_initial_lwp (inferior_ptid);
       lp->resumed = 1;
@@ -4235,7 +4235,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
   int pid = ptid_get_pid (inferior_ptid);
   std::vector<static_tracepoint_marker> markers;
   const char *p = s;
-  ptid_t ptid = ptid_build (pid, 0, 0);
+  ptid_t ptid = ptid_t (pid, 0, 0);
   static_tracepoint_marker marker;
 
   /* Pause all */
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 192e0870cc..3a15b78b92 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -670,7 +670,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
      calls are made, we just assume they were; future changes
      to how GDB accesses TLS could result in this passing
      without exercising the calls it's supposed to.  */
-  ptid_t ptid = ptid_build (tdb_testinfo->info->pid, ti.ti_lid, 0);
+  ptid_t ptid = ptid_t (tdb_testinfo->info->pid, ti.ti_lid, 0);
   struct thread_info *thread_info = find_thread_ptid (ptid);
   if (thread_info != NULL && thread_info->priv != NULL)
     {
@@ -1476,7 +1476,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 	return 0;
     }
 
-  ptid = ptid_build (info->pid, ti.ti_lid, 0);
+  ptid = ptid_t (info->pid, ti.ti_lid, 0);
   tp = find_thread_ptid (ptid);
   if (tp == NULL || tp->priv == NULL)
     record_thread (info, tp, ptid, th_p, &ti);
@@ -1780,7 +1780,7 @@ ptid_t
 thread_db_target::get_ada_task_ptid (long lwp, long thread)
 {
   /* NPTL uses a 1:1 model, so the LWP id suffices.  */
-  return ptid_build (ptid_get_pid (inferior_ptid), lwp, 0);
+  return ptid_t (ptid_get_pid (inferior_ptid), lwp, 0);
 }
 
 void
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 877b31b0b2..1f3a911473 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -266,8 +266,8 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
 	    continue;
 
 	  sscanf (dp->d_name, "%lld", &tid);
-	  core = linux_common_core_of_thread (ptid_build ((pid_t) pid,
-							  (pid_t) tid, 0));
+	  core = linux_common_core_of_thread (ptid_t ((pid_t) pid,
+						      (pid_t) tid, 0));
 
 	  if (core >= 0 && core < num_cores)
 	    {
@@ -595,7 +595,7 @@ linux_xfer_osdata_threads (gdb_byte *readbuf,
 			    continue;
 
 			  tid = atoi (dp2->d_name);
-			  core = linux_common_core_of_thread (ptid_build (pid, tid, 0));
+			  core = linux_common_core_of_thread (ptid_t (pid, tid, 0));
 
 			  buffer_xml_printf (
 			    &buffer,
diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index 55487507d0..5a9464195d 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -308,7 +308,7 @@ linux_proc_attach_tgid_threads (pid_t pid,
 	  lwp = strtoul (dp->d_name, NULL, 10);
 	  if (lwp != 0)
 	    {
-	      ptid_t ptid = ptid_build (pid, lwp, 0);
+	      ptid_t ptid = ptid_t (pid, lwp, 0);
 
 	      if (attach_lwp (ptid))
 		new_threads_found = 1;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index a572fc166c..c1b38e8616 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -413,7 +413,7 @@ nto_procfs_target::update_thread_list ()
 	   returned different tid, meaning the requested tid no longer exists
 	   (e.g. thread exited).  */
 	continue;
-      ptid = ptid_build (pid, 0, tid);
+      ptid = ptid_t (pid, 0, tid);
       new_thread = find_thread_ptid (ptid);
       if (!new_thread)
 	new_thread = add_thread (ptid);
@@ -766,7 +766,7 @@ do_attach (ptid_t ptid)
       && status.flags & _DEBUG_FLAG_STOPPED)
     SignalKill (nto_node (), ptid_get_pid (ptid), 0, SIGCONT, 0, 0);
   nto_init_solib_absolute_prefix ();
-  return ptid_build (ptid_get_pid (ptid), 0, status.tid);
+  return ptid_t (ptid_get_pid (ptid), 0, status.tid);
 }
 
 /* Ask the user what to do when an interrupt is received.  */
@@ -899,7 +899,7 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	}
     }
 
-  return ptid_build (status.pid, 0, status.tid);
+  return ptid_t (status.pid, 0, status.tid);
 }
 
 /* Read the current values of the inferior's registers, both the
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index 91bed717a5..08e873d11f 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -62,7 +62,7 @@ obsd_nat_target::update_thread_list ()
 
   while (pts.pts_tid != -1)
     {
-      ptid_t ptid = ptid_build (pid, pts.pts_tid, 0);
+      ptid_t ptid = ptid_t (pid, pts.pts_tid, 0);
 
       if (!in_thread_list (ptid))
 	{
@@ -151,7 +151,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	  return pid_to_ptid (pid);
 	}
 
-      ptid = ptid_build (pid, pe.pe_tid, 0);
+      ptid = ptid_t (pid, pe.pe_tid, 0);
       if (!in_thread_list (ptid))
 	{
 	  if (ptid_get_lwp (inferior_ptid) == 0)
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 8afa667a06..7784f79438 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -131,7 +131,7 @@ ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr,
 ps_err_e
 ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -147,7 +147,7 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
 ps_err_e
 ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -163,7 +163,7 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
 ps_err_e
 ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, gdb_prfpregset_t *fpregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -180,7 +180,7 @@ ps_err_e
 ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	       const gdb_prfpregset_t *fpregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 082f5d4374..c4e01673c0 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1996,7 +1996,7 @@ do_attach (ptid_t ptid)
   create_procinfo (pi->pid, lwpid);
 
   /* Add it to gdb's thread list.  */
-  ptid = ptid_build (pi->pid, lwpid, 0);
+  ptid = ptid_t (pi->pid, lwpid, 0);
   add_thread (ptid);
 
   return ptid;
@@ -2283,7 +2283,7 @@ wait_again:
 
 	      /* The 'pid' we will return to GDB is composed of
 		 the process ID plus the lwp ID.  */
-	      retval = ptid_build (pi->pid, proc_get_current_thread (pi), 0);
+	      retval = ptid_t (pi->pid, proc_get_current_thread (pi), 0);
 
 	      switch (why) {
 	      case PR_SIGNALLED:
@@ -2400,7 +2400,7 @@ wait_again:
 		    if (!find_procinfo (pi->pid, temp_tid))
 		      create_procinfo  (pi->pid, temp_tid);
 
-		    temp_ptid = ptid_build (pi->pid, temp_tid, 0);
+		    temp_ptid = ptid_t (pi->pid, temp_tid, 0);
 		    /* If not in GDB's thread list, add it.  */
 		    if (!in_thread_list (temp_ptid))
 		      add_thread (temp_ptid);
@@ -2468,7 +2468,7 @@ wait_again:
 		      create_procinfo  (pi->pid, temp_tid);
 
 		    /* If not in GDB's thread list, add it.  */
-		    temp_ptid = ptid_build (pi->pid, temp_tid, 0);
+		    temp_ptid = ptid_t (pi->pid, temp_tid, 0);
 		    if (!in_thread_list (temp_ptid))
 		      add_thread (temp_ptid);
 
@@ -2960,7 +2960,7 @@ procfs_init_inferior (struct target_ops *ops, int pid)
      this point, but it didn't have any lwp info yet.  Notify the core
      about it.  This changes inferior_ptid as well.  */
   thread_change_ptid (pid_to_ptid (pid),
-		      ptid_build (pid, lwpid, 0));
+		      ptid_t (pid, lwpid, 0));
 
   gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
 }
@@ -3143,7 +3143,7 @@ procfs_inferior_created (struct target_ops *ops, int from_tty)
 static int
 procfs_notice_thread (procinfo *pi, procinfo *thread, void *ptr)
 {
-  ptid_t gdb_threadid = ptid_build (pi->pid, thread->tid, 0);
+  ptid_t gdb_threadid = ptid_t (pi->pid, thread->tid, 0);
 
   if (!in_thread_list (gdb_threadid) || is_exited (gdb_threadid))
     add_thread (gdb_threadid);
@@ -3807,7 +3807,7 @@ procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data)
 
   if (pi != NULL)
     {
-      ptid_t ptid = ptid_build (pi->pid, thread->tid, 0);
+      ptid_t ptid = ptid_t (pi->pid, thread->tid, 0);
 
       args->note_data = procfs_do_thread_registers (args->obfd, ptid,
 						    args->note_data,
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 01f58ee788..d269f388f5 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -211,7 +211,7 @@ get_base_thread_from_ravenscar_task (ptid_t ptid)
     return ptid;
 
   base_cpu = ravenscar_get_thread_base_cpu (ptid);
-  return ptid_build (ptid_get_pid (ptid), base_cpu, 0);
+  return ptid_t (ptid_get_pid (ptid), base_cpu, 0);
 }
 
 /* Fetch the ravenscar running thread from target memory and
@@ -384,7 +384,7 @@ ravenscar_active_task (int cpu)
   if (tid == 0)
     return null_ptid;
   else
-    return ptid_build (ptid_get_pid (base_ptid), 0, tid);
+    return ptid_t (ptid_get_pid (base_ptid), 0, tid);
 }
 
 const char *
@@ -571,7 +571,7 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty)
 ptid_t
 ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_build (ptid_get_pid (base_ptid), 0, thread);
+  return ptid_t (ptid_get_pid (base_ptid), 0, thread);
 }
 
 /* Command-list for the "set/show ravenscar" prefix command.  */
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9c89ab9db7..cd69f72e23 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -253,7 +253,7 @@ get_sim_inferior_data (struct inferior *inf, int sim_instance_needed)
       set_inferior_data (inf, sim_inferior_data_key, sim_data);
 
       /* Allocate a ptid for this inferior.  */
-      sim_data->remote_sim_ptid = ptid_build (next_pid, 0, next_pid);
+      sim_data->remote_sim_ptid = ptid_t (next_pid, 0, next_pid);
       next_pid++;
 
       /* Initialize the other instance variables.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index 7cef0cf19f..b72a27e62a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2953,7 +2953,7 @@ read_ptid (const char *buf, const char **obuf)
       pp = unpack_varlen_hex (p + 1, &tid);
       if (obuf)
 	*obuf = pp;
-      return ptid_build (pid, tid, 0);
+      return ptid_t (pid, tid, 0);
     }
 
   /* No multi-process.  Just a tid.  */
@@ -2978,7 +2978,7 @@ read_ptid (const char *buf, const char **obuf)
 
   if (obuf)
     *obuf = pp;
-  return ptid_build (pid, tid, 0);
+  return ptid_t (pid, tid, 0);
 }
 
 static int
@@ -3974,7 +3974,7 @@ remote_target::static_tracepoint_markers_by_strid (const char *strid)
 ptid_t
 remote_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_build (ptid_get_pid (inferior_ptid), lwp, 0);
+  return ptid_t (ptid_get_pid (inferior_ptid), lwp, 0);
 }
 \f
 
@@ -6039,7 +6039,7 @@ remote_target::append_resumption (char *p, char *endp,
       ptid_t nptid;
 
       /* All (-1) threads of process.  */
-      nptid = ptid_build (ptid_get_pid (ptid), -1, 0);
+      nptid = ptid_t (ptid_get_pid (ptid), -1, 0);
 
       p += xsnprintf (p, endp - p, ":");
       p = write_ptid (p, endp, nptid);
@@ -6617,7 +6617,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
 
       if (ptid_is_pid (ptid))
 	  /* All (-1) threads of process.  */
-	nptid = ptid_build (ptid_get_pid (ptid), -1, 0);
+	nptid = ptid_t (ptid_get_pid (ptid), -1, 0);
       else
 	{
 	  /* Small optimization: if we already have a stop reply for
@@ -11323,7 +11323,7 @@ threadalive_test (const char *cmd, int tty)
 {
   int sample_thread = SAMPLE_THREAD;
   int pid = ptid_get_pid (inferior_ptid);
-  ptid_t ptid = ptid_build (pid, sample_thread, 0);
+  ptid_t ptid = ptid_t (pid, sample_thread, 0);
 
   if (remote_thread_alive (ptid))
     printf_filtered ("PASS: Thread alive test\n");
@@ -14739,7 +14739,7 @@ stepping is supported by the target.  The default is on."),
 
   /* 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_build (42000, -1, 1);
-  not_sent_ptid = ptid_build (42000, -2, 1);
-  any_thread_ptid = ptid_build (42000, 0, 1);
+  magic_null_ptid = ptid_t (42000, -1, 1);
+  not_sent_ptid = ptid_t (42000, -2, 1);
+  any_thread_ptid = ptid_t (42000, 0, 1);
 }
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 47d86e469c..d67fd8352f 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -325,7 +325,7 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
 	     td_state_string (ti.ti_state));
     }
 
-  return ptid_build (ptid_get_pid (thread_id), ti.ti_lid, 0);
+  return ptid_t (ptid_get_pid (thread_id), ti.ti_lid, 0);
 }
 
 /* Convert an LWP ID into a POSIX or Solaris thread ID.  If LWP_ID
@@ -366,7 +366,7 @@ lwp_to_thread (ptid_t lwp)
   else if (val != TD_OK)
     error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
 
-  return ptid_build (ptid_get_pid (lwp), 0 , ti.ti_tid);
+  return ptid_t (ptid_get_pid (lwp), 0 , ti.ti_tid);
 }
 \f
 
@@ -849,7 +849,7 @@ ps_ptwrite (struct ps_prochandle *ph, psaddr_t addr,
 ps_err_e
 ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -865,7 +865,7 @@ ps_err_e
 ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	     const prgregset_t gregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -917,7 +917,7 @@ ps_err_e
 ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	       prfpregset_t *fpregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -933,7 +933,7 @@ ps_err_e
 ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	       const prfpregset_t * fpregset)
 {
-  ptid_t ptid = ptid_build (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -982,7 +982,7 @@ ps_lgetLDT (struct ps_prochandle *ph, lwpid_t lwpid,
   if (ptid_get_pid (inferior_ptid) <= 0 || lwpid <= 0)
     return PS_BADLID;
 
-  ret = procfs_find_LDT_entry (ptid_build (ptid_get_pid (inferior_ptid),
+  ret = procfs_find_LDT_entry (ptid_t (ptid_get_pid (inferior_ptid),
 			       lwpid, 0));
   if (ret)
     {
@@ -1042,7 +1042,7 @@ sol_update_thread_list_callback (const td_thrhandle_t *th, void *ignored)
   if (retval != TD_OK)
     return -1;
 
-  ptid = ptid_build (ptid_get_pid (inferior_ptid), 0, ti.ti_tid);
+  ptid = ptid_t (ptid_get_pid (inferior_ptid), 0, ti.ti_tid);
   if (!in_thread_list (ptid) || is_exited (ptid))
     add_thread (ptid);
 
diff --git a/gdb/target.c b/gdb/target.c
index a1fe8f9765..080480c609 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -618,7 +618,7 @@ default_terminal_info (struct target_ops *self, const char *args, int from_tty)
 static ptid_t
 default_get_ada_task_ptid (struct target_ops *self, long lwp, long tid)
 {
-  return ptid_build (ptid_get_pid (inferior_ptid), lwp, tid);
+  return ptid_t (ptid_get_pid (inferior_ptid), lwp, tid);
 }
 
 static enum exec_direction_kind
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 63a780014a..5eaa98af02 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1350,8 +1350,8 @@ fake_create_process (void)
     }
   main_thread_id = current_event.dwThreadId;
   current_thread = windows_add_thread (
-		     ptid_build (current_event.dwProcessId, 0,
-				 current_event.dwThreadId),
+		     ptid_t (current_event.dwProcessId, 0,
+			     current_event.dwThreadId),
 		     current_event.u.CreateThread.hThread,
 		     current_event.u.CreateThread.lpThreadLocalBase);
   return main_thread_id;
@@ -1523,8 +1523,8 @@ get_windows_debug_event (struct target_ops *ops,
 	}
       /* Record the existence of this thread.  */
       thread_id = current_event.dwThreadId;
-      th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
-					 current_event.dwThreadId),
+      th = windows_add_thread (ptid_t (current_event.dwProcessId, 0,
+				       current_event.dwThreadId),
 			     current_event.u.CreateThread.hThread,
 			     current_event.u.CreateThread.lpThreadLocalBase);
 
@@ -1538,8 +1538,8 @@ get_windows_debug_event (struct target_ops *ops,
 
       if (current_event.dwThreadId != main_thread_id)
 	{
-	  windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
-					     current_event.dwThreadId),
+	  windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
+					 current_event.dwThreadId),
 				 current_event.u.ExitThread.dwExitCode);
 	  th = &dummy_thread_info;
 	}
@@ -1556,13 +1556,13 @@ get_windows_debug_event (struct target_ops *ops,
 
       current_process_handle = current_event.u.CreateProcessInfo.hProcess;
       if (main_thread_id)
-	windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
-					   main_thread_id),
+	windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
+				       main_thread_id),
 			       0);
       main_thread_id = current_event.dwThreadId;
       /* Add the main thread.  */
-      th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
-					   current_event.dwThreadId),
+      th = windows_add_thread (ptid_t (current_event.dwProcessId, 0,
+				       current_event.dwThreadId),
 	     current_event.u.CreateProcessInfo.hThread,
 	     current_event.u.CreateProcessInfo.lpThreadLocalBase);
       thread_id = current_event.dwThreadId;
@@ -1664,8 +1664,7 @@ get_windows_debug_event (struct target_ops *ops,
     }
   else
     {
-      inferior_ptid = ptid_build (current_event.dwProcessId, 0,
-				  thread_id);
+      inferior_ptid = ptid_t (current_event.dwProcessId, 0, thread_id);
       current_thread = th;
       if (!current_thread)
 	current_thread = thread_rec (thread_id, TRUE);
@@ -1725,7 +1724,7 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
       SetConsoleCtrlHandler (&ctrl_c_handler, FALSE);
 
       if (retval)
-	return ptid_build (current_event.dwProcessId, 0, retval);
+	return ptid_t (current_event.dwProcessId, 0, retval);
       else
 	{
 	  int detach = 0;
@@ -3000,7 +2999,7 @@ windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
 ptid_t
 windows_nat_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_build (ptid_get_pid (inferior_ptid), 0, lwp);
+  return ptid_t (ptid_get_pid (inferior_ptid), 0, lwp);
 }
 
 /* Implementation of the to_thread_name method.  */
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 02/10] Remove pid_to_ptid
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (6 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 05/10] Remove ptid_get_tid Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 04/10] Remove ptid_get_lwp Tom Tromey
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes pid_to_ptid in favor of calling the ptid_t constructor
directly.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (pid_to_ptid): Remove.
	* common/ptid.h (pid_to_ptid): Don't declare.
	* aix-thread.c: Update.
	* arm-linux-nat.c: Update.
	* common/ptid.c: Update.
	* common/ptid.h: Update.
	* corelow.c: Update.
	* ctf.c: Update.
	* darwin-nat.c: Update.
	* fbsd-nat.c: Update.
	* fork-child.c: Update.
	* gnu-nat.c: Update.
	* go32-nat.c: Update.
	* inf-ptrace.c: Update.
	* infcmd.c: Update.
	* inferior.c: Update.
	* infrun.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* nat/aarch64-linux-hw-point.c: Update.
	* nat/fork-inferior.c: Update.
	* nat/x86-linux-dregs.c: Update.
	* nto-procfs.c: Update.
	* obsd-nat.c: Update.
	* procfs.c: Update.
	* progspace.c: Update.
	* remote.c: Update.
	* rs6000-nat.c: Update.
	* s390-linux-nat.c: Update.
	* sol-thread.c: Update.
	* spu-linux-nat.c: Update.
	* target.c: Update.
	* top.c: Update.
	* tracefile-tfile.c: Update.
	* windows-nat.c: Update.

gdbserver/ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* linux-low.c: Update.
	* linux-ppc-low.c: Update.
	* linux-x86-low.c: Update.
	* proc-service.c: Update.
	* server.c: Update.
	* spu-low.c: Update.
	* thread-db.c: Update.
	* win32-low.c: Update.
---
 gdb/ChangeLog                    | 38 ++++++++++++++++++++++++++++++++++++++
 gdb/aix-thread.c                 | 10 +++++-----
 gdb/arm-linux-nat.c              |  4 ++--
 gdb/common/ptid.c                |  8 --------
 gdb/common/ptid.h                |  4 ----
 gdb/corelow.c                    |  4 ++--
 gdb/ctf.c                        |  2 +-
 gdb/darwin-nat.c                 |  6 +++---
 gdb/fbsd-nat.c                   |  6 +++---
 gdb/fork-child.c                 |  2 +-
 gdb/gdbserver/ChangeLog          | 11 +++++++++++
 gdb/gdbserver/linux-low.c        | 12 ++++++------
 gdb/gdbserver/linux-ppc-low.c    |  2 +-
 gdb/gdbserver/linux-x86-low.c    |  2 +-
 gdb/gdbserver/proc-service.c     |  2 +-
 gdb/gdbserver/server.c           | 12 ++++++------
 gdb/gdbserver/spu-low.c          |  4 ++--
 gdb/gdbserver/thread-db.c        |  2 +-
 gdb/gdbserver/win32-low.c        |  4 ++--
 gdb/gnu-nat.c                    |  4 ++--
 gdb/go32-nat.c                   |  4 ++--
 gdb/inf-ptrace.c                 | 18 +++++++++---------
 gdb/infcmd.c                     |  6 +++---
 gdb/inferior.c                   |  6 +++---
 gdb/infrun.c                     | 18 +++++++++---------
 gdb/linux-fork.c                 |  2 +-
 gdb/linux-nat.c                  | 16 ++++++++--------
 gdb/nat/aarch64-linux-hw-point.c |  2 +-
 gdb/nat/fork-inferior.c          |  2 +-
 gdb/nat/x86-linux-dregs.c        |  4 ++--
 gdb/nto-procfs.c                 |  8 ++++----
 gdb/obsd-nat.c                   | 10 +++++-----
 gdb/procfs.c                     | 22 +++++++++++-----------
 gdb/progspace.c                  |  4 ++--
 gdb/remote.c                     | 20 ++++++++++----------
 gdb/rs6000-nat.c                 |  2 +-
 gdb/s390-linux-nat.c             |  2 +-
 gdb/sol-thread.c                 | 14 +++++++-------
 gdb/spu-linux-nat.c              |  2 +-
 gdb/target.c                     |  2 +-
 gdb/top.c                        |  4 ++--
 gdb/tracefile-tfile.c            |  2 +-
 gdb/windows-nat.c                |  6 +++---
 43 files changed, 176 insertions(+), 139 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2ee61577af..43061b54c7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,41 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (pid_to_ptid): Remove.
+	* common/ptid.h (pid_to_ptid): Don't declare.
+	* aix-thread.c: Update.
+	* arm-linux-nat.c: Update.
+	* common/ptid.c: Update.
+	* common/ptid.h: Update.
+	* corelow.c: Update.
+	* ctf.c: Update.
+	* darwin-nat.c: Update.
+	* fbsd-nat.c: Update.
+	* fork-child.c: Update.
+	* gnu-nat.c: Update.
+	* go32-nat.c: Update.
+	* inf-ptrace.c: Update.
+	* infcmd.c: Update.
+	* inferior.c: Update.
+	* infrun.c: Update.
+	* linux-fork.c: Update.
+	* linux-nat.c: Update.
+	* nat/aarch64-linux-hw-point.c: Update.
+	* nat/fork-inferior.c: Update.
+	* nat/x86-linux-dregs.c: Update.
+	* nto-procfs.c: Update.
+	* obsd-nat.c: Update.
+	* procfs.c: Update.
+	* progspace.c: Update.
+	* remote.c: Update.
+	* rs6000-nat.c: Update.
+	* s390-linux-nat.c: Update.
+	* sol-thread.c: Update.
+	* spu-linux-nat.c: Update.
+	* target.c: Update.
+	* top.c: Update.
+	* tracefile-tfile.c: Update.
+	* windows-nat.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.h (ptid_build): Don't declare.
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index f4d3ac4770..bd66889e9d 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -325,7 +325,7 @@ pid_to_prc (ptid_t *ptidp)
 
   ptid = *ptidp;
   if (PD_TID (ptid))
-    *ptidp = pid_to_ptid (ptid_get_pid (ptid));
+    *ptidp = ptid_t (ptid_get_pid (ptid));
 }
 
 /* pthdb callback: for <i> from 0 to COUNT, set SYMBOLS[<i>].addr to
@@ -1042,7 +1042,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
     {
       scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
       
-      inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
+      inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
       beneath ()->resume (ptid, step, sig);
     }
   else
@@ -1082,12 +1082,12 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
 
     pid_to_prc (&ptid);
 
-    inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
+    inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
     ptid = beneath ()->wait (ptid, status, options);
   }
 
   if (ptid_get_pid (ptid) == -1)
-    return pid_to_ptid (-1);
+    return ptid_t (-1);
 
   /* Check whether libpthdebug might be ready to be initialized.  */
   if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED
@@ -1722,7 +1722,7 @@ aix_thread_target::xfer_partial (enum target_object object,
 {
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
-  inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
+  inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
   return beneath ()->xfer_partial (object, annex, readbuf,
 				   writebuf, offset, len, xfered_len);
 }
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index d0b43132b8..b5ee3a9063 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -994,7 +994,7 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
   struct update_registers_data data;
 
   pid = ptid_get_pid (inferior_ptid);
-  pid_ptid = pid_to_ptid (pid);
+  pid_ptid = ptid_t (pid);
 
   if (watchpoint)
     {
@@ -1033,7 +1033,7 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
   struct update_registers_data data;
 
   pid = ptid_get_pid (inferior_ptid);
-  pid_ptid = pid_to_ptid (pid);
+  pid_ptid = ptid_t (pid);
 
   if (watchpoint)
     {
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 49d27b4d55..42e51d2624 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
 
 /* See ptid.h.  */
 
-ptid_t
-pid_to_ptid (int pid)
-{
-  return ptid_t (pid);
-}
-
-/* See ptid.h.  */
-
 int
 ptid_get_pid (const ptid_t &ptid)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 030e97d45b..5591690437 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
 /* The following functions are kept for backwards compatibility.  The use of
    the ptid_t methods is preferred.  */
 
-/* See ptid_t::ptid_t.  */
-
-extern ptid_t pid_to_ptid (int pid);
-
 /* See ptid_t::pid.  */
 
 extern int ptid_get_pid (const ptid_t &ptid);
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 99fe04c8c9..9c92095e05 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -459,7 +459,7 @@ core_target_open (const char *arg, int from_tty)
       if (thread == NULL)
 	{
 	  inferior_appeared (current_inferior (), CORELOW_PID);
-	  inferior_ptid = pid_to_ptid (CORELOW_PID);
+	  inferior_ptid = ptid_t (CORELOW_PID);
 	  add_thread_silent (inferior_ptid);
 	}
       else
@@ -1009,7 +1009,7 @@ core_target::pid_to_str (ptid_t ptid)
   /* Try the LWPID field first.  */
   pid = ptid_get_lwp (ptid);
   if (pid != 0)
-    return normal_pid_to_str (pid_to_ptid (pid));
+    return normal_pid_to_str (ptid_t (pid));
 
   /* Otherwise, this isn't a "threaded" core -- use the PID field, but
      only if it isn't a fake PID.  */
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 7e2207484c..ebc01a5b97 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1160,7 +1160,7 @@ ctf_target_open (const char *dirname, int from_tty)
   push_target (&ctf_ops);
 
   inferior_appeared (current_inferior (), CTF_PID);
-  inferior_ptid = pid_to_ptid (CTF_PID);
+  inferior_ptid = ptid_t (CTF_PID);
   add_thread_silent (inferior_ptid);
 
   merge_uploaded_trace_state_variables (&uploaded_tsvs);
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 363a89f3c1..682a62f1d3 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1864,10 +1864,10 @@ darwin_nat_target::attach (const char *args, int from_tty)
 
       if (exec_file)
 	printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
       else
 	printf_unfiltered (_("Attaching to %s\n"),
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
 
       gdb_flush (gdb_stdout);
     }
@@ -1876,7 +1876,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
     error (_("Can't attach to process %d: %s (%d)"),
            pid, safe_strerror (errno), errno);
 
-  inferior_ptid = pid_to_ptid (pid);
+  inferior_ptid = ptid_t (pid);
   inf = current_inferior ();
   inferior_appeared (inf, pid);
   inf->attach_flag = 1;
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index cfacb2cf23..27fee703e0 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -926,7 +926,7 @@ fbsd_add_threads (pid_t pid)
 {
   int i, nlwps;
 
-  gdb_assert (!in_thread_list (pid_to_ptid (pid)));
+  gdb_assert (!in_thread_list (ptid_t (pid)));
   nlwps = ptrace (PT_GETNUMLWPS, pid, NULL, 0);
   if (nlwps == -1)
     perror_with_name (("ptrace"));
@@ -1297,13 +1297,13 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	     PL_FLAG_BORN in case the first stop reported after
 	     attaching to an existing process is a PL_FLAG_BORN
 	     event.  */
-	  if (in_thread_list (pid_to_ptid (pid)))
+	  if (in_thread_list (ptid_t (pid)))
 	    {
 	      if (debug_fbsd_lwp)
 		fprintf_unfiltered (gdb_stdlog,
 				    "FLWP: using LWP %u for first thread\n",
 				    pl.pl_lwpid);
-	      thread_change_ptid (pid_to_ptid (pid), wptid);
+	      thread_change_ptid (ptid_t (pid), wptid);
 	    }
 
 #ifdef PT_LWP_EVENTS
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index e1719a09ce..1de96b6685 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -88,7 +88,7 @@ postfork_hook (pid_t pid)
   inferior_appeared (inf, pid);
 
   /* Needed for wait_for_inferior stuff.  */
-  inferior_ptid = pid_to_ptid (pid);
+  inferior_ptid = ptid_t (pid);
 
   gdb_assert (saved_ui != NULL);
   current_ui = saved_ui;
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 86f77a957d..ca4a82bdb3 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,14 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* linux-low.c: Update.
+	* linux-ppc-low.c: Update.
+	* linux-x86-low.c: Update.
+	* proc-service.c: Update.
+	* server.c: Update.
+	* spu-low.c: Update.
+	* thread-db.c: Update.
+	* win32-low.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* linux-low.c: Update.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index ce4d660806..a5e0d5beb6 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1226,13 +1226,13 @@ linux_attach (unsigned long pid)
     {
       struct lwp_info *lwp;
       int wstat, lwpid;
-      ptid_t pid_ptid = pid_to_ptid (pid);
+      ptid_t pid_ptid = ptid_t (pid);
 
       lwpid = linux_wait_for_event_filtered (pid_ptid, pid_ptid,
 					     &wstat, __WALL);
       gdb_assert (lwpid > 0);
 
-      lwp = find_lwp_pid (pid_to_ptid (lwpid));
+      lwp = find_lwp_pid (ptid_t (lwpid));
 
       if (!WIFSTOPPED (wstat) || WSTOPSIG (wstat) != SIGSTOP)
 	{
@@ -1405,7 +1405,7 @@ linux_kill (int pid)
 
   /* See the comment in linux_kill_one_lwp.  We did not kill the first
      thread in the list, so do so now.  */
-  lwp = find_lwp_pid (pid_to_ptid (pid));
+  lwp = find_lwp_pid (ptid_t (pid));
 
   if (lwp == NULL)
     {
@@ -1640,7 +1640,7 @@ linux_detach (int pid)
      able to reap the leader.  */
   for_each_thread (pid, linux_detach_lwp_callback);
 
-  main_lwp = find_lwp_pid (pid_to_ptid (pid));
+  main_lwp = find_lwp_pid (ptid_t (pid));
   linux_detach_one_lwp (main_lwp);
 
   the_target->mourn (process);
@@ -1878,7 +1878,7 @@ check_zombie_leaders (void)
     pid_t leader_pid = pid_of (proc);
     struct lwp_info *leader_lp;
 
-    leader_lp = find_lwp_pid (pid_to_ptid (leader_pid));
+    leader_lp = find_lwp_pid (ptid_t (leader_pid));
 
     if (debug_threads)
       debug_printf ("leader_pid=%d, leader_lp!=NULL=%d, "
@@ -2363,7 +2363,7 @@ linux_low_filter_event (int lwpid, int wstat)
   struct thread_info *thread;
   int have_stop_pc = 0;
 
-  child = find_lwp_pid (pid_to_ptid (lwpid));
+  child = find_lwp_pid (ptid_t (lwpid));
 
   /* Check for stop events reported by a process we didn't already
      know about - anything not already in our LWP list.
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index c6e00b7eb8..47428c1529 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -703,7 +703,7 @@ ppc_supports_tracepoints (void)
 static int
 ppc_get_thread_area (int lwpid, CORE_ADDR *addr)
 {
-  struct lwp_info *lwp = find_lwp_pid (pid_to_ptid (lwpid));
+  struct lwp_info *lwp = find_lwp_pid (ptid_t (lwpid));
   struct thread_info *thr = get_lwp_thread (lwp);
   struct regcache *regcache = get_thread_regcache (thr, 1);
   ULONGEST tp = 0;
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 408b54f257..80b43802c7 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -255,7 +255,7 @@ x86_get_thread_area (int lwpid, CORE_ADDR *addr)
 #endif
 
   {
-    struct lwp_info *lwp = find_lwp_pid (pid_to_ptid (lwpid));
+    struct lwp_info *lwp = find_lwp_pid (ptid_t (lwpid));
     struct thread_info *thr = get_lwp_thread (lwp);
     struct regcache *regcache = get_thread_regcache (thr, 1);
     unsigned int desc[4];
diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c
index f7912b884c..64fdf8a9d5 100644
--- a/gdb/gdbserver/proc-service.c
+++ b/gdb/gdbserver/proc-service.c
@@ -108,7 +108,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
   struct thread_info *reg_thread, *saved_thread;
   struct regcache *regcache;
 
-  lwp = find_lwp_pid (pid_to_ptid (lwpid));
+  lwp = find_lwp_pid (ptid_t (lwpid));
   if (lwp == NULL)
     return PS_ERR;
 
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index e4de426476..c2f7287a94 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -308,7 +308,7 @@ attach_inferior (int pid)
 
   if (!non_stop)
     {
-      cs.last_ptid = mywait (pid_to_ptid (pid), &cs.last_status, 0, 0);
+      cs.last_ptid = mywait (ptid_t (pid), &cs.last_status, 0, 0);
 
       /* GDB knows to ignore the first SIGSTOP after attaching to a running
 	 process using the "attach" command, but this is different; it's
@@ -1256,7 +1256,7 @@ handle_detach (char *own_buf)
     write_enn (own_buf);
   else
     {
-      discard_queued_stop_replies (pid_to_ptid (pid));
+      discard_queued_stop_replies (ptid_t (pid));
       write_ok (own_buf);
 
       if (extended_protocol || target_running ())
@@ -1266,7 +1266,7 @@ handle_detach (char *own_buf)
 	     and instead treat this like a normal program exit.  */
 	  cs.last_status.kind = TARGET_WAITKIND_EXITED;
 	  cs.last_status.value.integer = 0;
-	  cs.last_ptid = pid_to_ptid (pid);
+	  cs.last_ptid = ptid_t (pid);
 
 	  current_thread = NULL;
 	}
@@ -3081,7 +3081,7 @@ handle_v_kill (char *own_buf)
     {
       cs.last_status.kind = TARGET_WAITKIND_SIGNALLED;
       cs.last_status.value.sig = GDB_SIGNAL_KILL;
-      cs.last_ptid = pid_to_ptid (pid);
+      cs.last_ptid = ptid_t (pid);
       discard_queued_stop_replies (cs.last_ptid);
       write_ok (own_buf);
       return 1;
@@ -3481,7 +3481,7 @@ kill_inferior_callback (process_info *process)
   int pid = process->pid;
 
   kill_inferior (pid);
-  discard_queued_stop_replies (pid_to_ptid (pid));
+  discard_queued_stop_replies (ptid_t (pid));
 }
 
 /* Call this when exiting gdbserver with possible inferiors that need
@@ -3527,7 +3527,7 @@ detach_or_kill_for_exit (void)
     else
       kill_inferior (pid);
 
-    discard_queued_stop_replies (pid_to_ptid (pid));
+    discard_queued_stop_replies (ptid_t (pid));
   });
 }
 
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 13f2b353f2..8a221a2c6c 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -457,7 +457,7 @@ spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
       ourstatus->kind =  TARGET_WAITKIND_EXITED;
       ourstatus->value.integer = WEXITSTATUS (w);
       clear_inferiors ();
-      return pid_to_ptid (ret);
+      return ptid_t (ret);
     }
   else if (!WIFSTOPPED (w))
     {
@@ -465,7 +465,7 @@ spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
       ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
       ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w));
       clear_inferiors ();
-      return pid_to_ptid (ret);
+      return ptid_t (ret);
     }
 
   /* After attach, we may have received a SIGSTOP.  Do not return this
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 3e42db4420..80125ee9b7 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -252,7 +252,7 @@ maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p,
 {
   struct lwp_info *lwp;
 
-  lwp = find_lwp_pid (pid_to_ptid (ti_p->ti_lid));
+  lwp = find_lwp_pid (ptid_t (ti_p->ti_lid));
   if (lwp != NULL)
     return 1;
 
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 05bea69adb..53b843b3ba 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -707,7 +707,7 @@ win32_create_inferior (const char *program,
 
   /* Wait till we are at 1st instruction in program, return new pid
      (assuming success).  */
-  cs.last_ptid = win32_wait (pid_to_ptid (current_process_id), &cs.last_status, 0);
+  cs.last_ptid = win32_wait (ptid_t (current_process_id), &cs.last_status, 0);
 
   return current_process_id;
 }
@@ -1612,7 +1612,7 @@ win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
 	  OUTMSG2 (("Child exited with retcode = %x\n",
 		    ourstatus->value.integer));
 	  win32_clear_inferiors ();
-	  return pid_to_ptid (current_event.dwProcessId);
+	  return ptid_t (current_event.dwProcessId);
 	case TARGET_WAITKIND_STOPPED:
 	case TARGET_WAITKIND_LOADED:
 	  OUTMSG2 (("Child Stopped with signal = %d \n",
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 491d725ce2..78276a71df 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -1100,7 +1100,7 @@ inf_validate_procs (struct inf *inf)
 
 	    /* Tell GDB's generic thread code.  */
 
-	    if (ptid_equal (inferior_ptid, pid_to_ptid (inf->pid)))
+	    if (ptid_equal (inferior_ptid, ptid_t (inf->pid)))
 	      /* This is the first time we're hearing about thread
 		 ids, after a fork-child.  */
 	      thread_change_ptid (inferior_ptid, ptid);
@@ -2148,7 +2148,7 @@ gnu_nat_target::create_inferior (const char *exec_file,
   /* We have something that executes now.  We'll be running through
      the shell at this point (if startup-with-shell is true), but the
      pid shouldn't change.  */
-  add_thread_silent (pid_to_ptid (pid));
+  add_thread_silent (ptid_t (pid));
 
   /* Attach to the now stopped child, which is actually a shell...  */
   inf_debug (inf, "attaching to child: %d", pid);
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index f00e424d46..0120cbf7d2 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -533,7 +533,7 @@ go32_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
 	    }
 	}
     }
-  return pid_to_ptid (SOME_PID);
+  return ptid_t (SOME_PID);
 }
 
 static void
@@ -752,7 +752,7 @@ go32_nat_target::create_inferior (const char *exec_file,
   save_npx ();
 #endif
 
-  inferior_ptid = pid_to_ptid (SOME_PID);
+  inferior_ptid = ptid_t (SOME_PID);
   inf = current_inferior ();
   inferior_appeared (inf, SOME_PID);
 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 945af830c5..3b32b678ee 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -131,7 +131,7 @@ inf_ptrace_target::create_inferior (const char *exec_file,
   pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
 		       NULL, NULL, NULL);
 
-  ptid = pid_to_ptid (pid);
+  ptid = ptid_t (pid);
   /* We have something that executes now.  We'll be running through
      the shell at this point (if startup-with-shell is true), but the
      pid shouldn't change.  */
@@ -213,10 +213,10 @@ inf_ptrace_target::attach (const char *args, int from_tty)
 
       if (exec_file)
 	printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
       else
 	printf_unfiltered (_("Attaching to %s\n"),
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
 
       gdb_flush (gdb_stdout);
     }
@@ -233,7 +233,7 @@ inf_ptrace_target::attach (const char *args, int from_tty)
   inf = current_inferior ();
   inferior_appeared (inf, pid);
   inf->attach_flag = 1;
-  inferior_ptid = pid_to_ptid (pid);
+  inferior_ptid = ptid_t (pid);
 
   /* Always add a main thread.  If some target extends the ptrace
      target, it should decorate the ptid later with more info.  */
@@ -428,7 +428,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	{
 	case PTRACE_FORK:
 	  ourstatus->kind = TARGET_WAITKIND_FORKED;
-	  ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
+	  ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
 
 	  /* Make sure the other end of the fork is stopped too.  */
 	  fpid = waitpid (pe.pe_other_pid, &status, 0);
@@ -443,17 +443,17 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	  gdb_assert (pe.pe_other_pid == pid);
 	  if (fpid == ptid_get_pid (inferior_ptid))
 	    {
-	      ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
-	      return pid_to_ptid (fpid);
+	      ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
+	      return ptid_t (fpid);
 	    }
 
-	  return pid_to_ptid (pid);
+	  return ptid_t (pid);
 	}
     }
 #endif
 
   store_waitstatus (ourstatus, status);
-  return pid_to_ptid (pid);
+  return ptid_t (pid);
 }
 
 /* Transfer data via ptrace into process PID's memory from WRITEBUF, or
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index b3f0238eba..07c893663a 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2599,7 +2599,7 @@ kill_command (const char *arg, int from_tty)
   int pid = current_inferior ()->pid;
   /* Save the pid as a string before killing the inferior, since that
      may unpush the current target, and we need the string after.  */
-  std::string pid_str = target_pid_to_str (pid_to_ptid (pid));
+  std::string pid_str = target_pid_to_str (ptid_t (pid));
   int infnum = current_inferior ()->num;
 
   target_kill ();
@@ -2750,7 +2750,7 @@ attach_post_wait (const char *args, int from_tty, enum attach_post_wait_mode mod
 	 Be sure to explicitly stop all threads of the process.  This
 	 should have no effect on already stopped threads.  */
       if (non_stop)
-	target_stop (pid_to_ptid (inferior->pid));
+	target_stop (ptid_t (inferior->pid));
       else if (target_is_non_stop_p ())
 	{
 	  struct thread_info *thread;
@@ -2896,7 +2896,7 @@ attach_command (const char *args, int from_tty)
       else
 	/* The user requested an `attach', so stop all threads of this
 	   inferior.  */
-	target_stop (pid_to_ptid (ptid_get_pid (inferior_ptid)));
+	target_stop (ptid_t (ptid_get_pid (inferior_ptid)));
     }
 
   mode = async_exec ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_STOP;
diff --git a/gdb/inferior.c b/gdb/inferior.c
index ec2f985919..c08893607a 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -124,7 +124,7 @@ add_inferior (int pid)
   if (print_inferior_events)
     printf_unfiltered (_("[New inferior %d (%s)]\n"),
 		       inf->num,
-		       target_pid_to_str (pid_to_ptid (pid)));
+		       target_pid_to_str (ptid_t (pid)));
 
   return inf;
 }
@@ -266,7 +266,7 @@ detach_inferior (inferior *inf)
   if (print_inferior_events)
     printf_unfiltered (_("[Inferior %d (%s) detached]\n"),
 		       inf->num,
-		       target_pid_to_str (pid_to_ptid (pid)));
+		       target_pid_to_str (ptid_t (pid)));
 }
 
 /* See inferior.h.  */
@@ -514,7 +514,7 @@ static const char *
 inferior_pid_to_str (int pid)
 {
   if (pid != 0)
-    return target_pid_to_str (pid_to_ptid (pid));
+    return target_pid_to_str (ptid_t (pid));
   else
     return _("<null>");
 }
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f455af2948..1488bb16e4 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -464,7 +464,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  if (print_inferior_events)
 	    {
 	      /* Ensure that we have a process ptid.  */
-	      ptid_t process_ptid = pid_to_ptid (ptid_get_pid (child_ptid));
+	      ptid_t process_ptid = ptid_t (ptid_get_pid (child_ptid));
 
 	      target_terminal::ours_for_output ();
 	      fprintf_filtered (gdb_stdlog,
@@ -600,7 +600,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  if (print_inferior_events)
 	    {
 	      /* Ensure that we have a process ptid.  */
-	      ptid_t process_ptid = pid_to_ptid (ptid_get_pid (parent_ptid));
+	      ptid_t process_ptid = ptid_t (ptid_get_pid (parent_ptid));
 
 	      target_terminal::ours_for_output ();
 	      fprintf_filtered (gdb_stdlog,
@@ -962,7 +962,7 @@ handle_vfork_child_exec_or_exit (int exec)
 	  if (print_inferior_events)
 	    {
 	      const char *pidstr
-		= target_pid_to_str (pid_to_ptid (inf->vfork_parent->pid));
+		= target_pid_to_str (ptid_t (inf->vfork_parent->pid));
 
 	      target_terminal::ours_for_output ();
 
@@ -1151,7 +1151,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
   update_breakpoints_after_exec ();
 
   /* What is this a.out's name?  */
-  process_ptid = pid_to_ptid (pid);
+  process_ptid = ptid_t (pid);
   printf_unfiltered (_("%s is executing new program: %s\n"),
 		     target_pid_to_str (process_ptid),
 		     exec_file_target);
@@ -2277,7 +2277,7 @@ user_visible_resume_ptid (int step)
     {
       /* Resume all threads of the current process (and none of other
 	 processes).  */
-      resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
+      resume_ptid = ptid_t (ptid_get_pid (inferior_ptid));
     }
   else
     {
@@ -3630,7 +3630,7 @@ void
 prepare_for_detach (void)
 {
   struct inferior *inf = current_inferior ();
-  ptid_t pid_ptid = pid_to_ptid (inf->pid);
+  ptid_t pid_ptid = ptid_t (inf->pid);
   struct displaced_step_inferior_state *displaced;
 
   displaced = get_displaced_stepping_state (inf->pid);
@@ -4567,7 +4567,7 @@ stop_all_threads (void)
 	    {
 	      if (debug_infrun)
 		{
-		  ptid_t ptid = pid_to_ptid (ws.value.integer);
+		  ptid_t ptid = ptid_t (ws.value.integer);
 
 		  fprintf_unfiltered (gdb_stdlog,
 				      "infrun: %s exited while "
@@ -4924,7 +4924,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
 	   process as not-executing so that finish_thread_state marks
 	   them stopped (in the user's perspective) if/when we present
 	   the stop to the user.  */
-	mark_ptid = pid_to_ptid (ptid_get_pid (ecs->ptid));
+	mark_ptid = ptid_t (ptid_get_pid (ecs->ptid));
       }
     else
       mark_ptid = ecs->ptid;
@@ -7894,7 +7894,7 @@ void
 print_exited_reason (struct ui_out *uiout, int exitstatus)
 {
   struct inferior *inf = current_inferior ();
-  const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid));
+  const char *pidstr = target_pid_to_str (ptid_t (inf->pid));
 
   annotate_exited (exitstatus);
   if (exitstatus)
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 2ba67e0bd4..a0e16df553 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -216,7 +216,7 @@ fork_id_to_ptid (int num)
   if (fork)
     return fork->ptid;
   else
-    return pid_to_ptid (-1);
+    return ptid_t (-1);
 }
 
 static void
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index aa1a22b8b5..c17f541591 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1467,17 +1467,17 @@ linux_nat_target::detach (inferior *inf, int from_tty)
 
   /* Stop all threads before detaching.  ptrace requires that the
      thread is stopped to sucessfully detach.  */
-  iterate_over_lwps (pid_to_ptid (pid), stop_callback, NULL);
+  iterate_over_lwps (ptid_t (pid), stop_callback, NULL);
   /* ... and wait until all of them have reported back that
      they're no longer running.  */
-  iterate_over_lwps (pid_to_ptid (pid), stop_wait_callback, NULL);
+  iterate_over_lwps (ptid_t (pid), stop_wait_callback, NULL);
 
-  iterate_over_lwps (pid_to_ptid (pid), detach_callback, NULL);
+  iterate_over_lwps (ptid_t (pid), detach_callback, NULL);
 
   /* Only the initial process should be left right now.  */
   gdb_assert (num_lwps (pid) == 1);
 
-  main_lwp = find_lwp_pid (pid_to_ptid (pid));
+  main_lwp = find_lwp_pid (ptid_t (pid));
 
   if (forks_exist_p ())
     {
@@ -2914,7 +2914,7 @@ linux_nat_filter_event (int lwpid, int status)
   struct lwp_info *lp;
   int event = linux_ptrace_get_extended_event (status);
 
-  lp = find_lwp_pid (pid_to_ptid (lwpid));
+  lp = find_lwp_pid (ptid_t (lwpid));
 
   /* Check for stop events reported by a process we didn't already
      know about - anything not already in our LWP list.
@@ -3119,7 +3119,7 @@ linux_nat_filter_event (int lwpid, int status)
 		 will receive it - unless they're using CLONE_THREAD to
 		 share signals.  Since we only want to report it once, we
 		 mark it as ignored for all LWPs except this one.  */
-	      iterate_over_lwps (pid_to_ptid (ptid_get_pid (lp->ptid)),
+	      iterate_over_lwps (ptid_t (ptid_get_pid (lp->ptid)),
 					      set_ignore_sigint, NULL);
 	      lp->ignore_sigint = 0;
 	    }
@@ -3170,7 +3170,7 @@ check_zombie_leaders (void)
       if (inf->pid == 0)
 	continue;
 
-      leader_lp = find_lwp_pid (pid_to_ptid (inf->pid));
+      leader_lp = find_lwp_pid (ptid_t (inf->pid));
       if (leader_lp != NULL
 	  /* Check if there are other threads in the group, as we may
 	     have raced with the inferior simply exiting.  */
@@ -3707,7 +3707,7 @@ linux_nat_target::kill ()
     linux_fork_killall ();
   else
     {
-      ptid_t ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
+      ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid));
 
       /* Stop all threads before killing them, since ptrace requires
 	 that the thread is stopped to sucessfully PTRACE_KILL.  */
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index a3931ea6a9..22b265eaf0 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -357,7 +357,7 @@ aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
 				 int is_watchpoint, unsigned int idx)
 {
   struct aarch64_dr_update_callback_param param;
-  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
 
   param.is_watchpoint = is_watchpoint;
   param.idx = idx;
diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
index 8b59387fa5..ea71aad25f 100644
--- a/gdb/nat/fork-inferior.c
+++ b/gdb/nat/fork-inferior.c
@@ -484,7 +484,7 @@ startup_inferior (pid_t pid, int ntraps,
     }
 
   if (target_supports_multi_process ())
-    resume_ptid = pid_to_ptid (pid);
+    resume_ptid = ptid_t (pid);
   else
     resume_ptid = minus_one_ptid;
 
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index 74e481c4f6..9865ac63b1 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -102,7 +102,7 @@ x86_linux_dr_get_addr (int regnum)
 void
 x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
 {
-  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
 
   gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
 
@@ -122,7 +122,7 @@ x86_linux_dr_get_control (void)
 void
 x86_linux_dr_set_control (unsigned long control)
 {
-  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
 
   iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
 }
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index c1b38e8616..7591a608d7 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -713,14 +713,14 @@ nto_procfs_target::attach (const char *args, int from_tty)
 
       if (exec_file)
 	printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
       else
 	printf_unfiltered ("Attaching to %s\n",
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
 
       gdb_flush (gdb_stdout);
     }
-  inferior_ptid = do_attach (pid_to_ptid (pid));
+  inferior_ptid = do_attach (ptid_t (pid));
   inf = current_inferior ();
   inferior_appeared (inf, pid);
   inf->attach_flag = 1;
@@ -1311,7 +1311,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
   if (fds[2] != STDERR_FILENO)
     close (fds[2]);
 
-  inferior_ptid = do_attach (pid_to_ptid (pid));
+  inferior_ptid = do_attach (ptid_t (pid));
   procfs_update_thread_list (ops);
 
   inf = current_inferior ();
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index 08e873d11f..ac05fae9a1 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -115,7 +115,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
     }
   while (pid == -1);
 
-  ptid = pid_to_ptid (pid);
+  ptid = ptid_t (pid);
 
   if (WIFSTOPPED (status))
     {
@@ -129,7 +129,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	{
 	case PTRACE_FORK:
 	  ourstatus->kind = TARGET_WAITKIND_FORKED;
-	  ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
+	  ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
 
 	  /* Make sure the other end of the fork is stopped too.  */
 	  fpid = waitpid (pe.pe_other_pid, &status, 0);
@@ -144,11 +144,11 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	  gdb_assert (pe.pe_other_pid == pid);
 	  if (fpid == ptid_get_pid (inferior_ptid))
 	    {
-	      ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
-	      return pid_to_ptid (fpid);
+	      ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
+	      return ptid_t (fpid);
 	    }
 
-	  return pid_to_ptid (pid);
+	  return ptid_t (pid);
 	}
 
       ptid = ptid_t (pid, pe.pe_tid, 0);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index c4e01673c0..fc6568f956 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1895,14 +1895,14 @@ procfs_target::attach (const char *args, int from_tty)
 
       if (exec_file)
 	printf_filtered (_("Attaching to program `%s', %s\n"),
-			 exec_file, target_pid_to_str (pid_to_ptid (pid)));
+			 exec_file, target_pid_to_str (ptid_t (pid)));
       else
 	printf_filtered (_("Attaching to %s\n"),
-			 target_pid_to_str (pid_to_ptid (pid)));
+			 target_pid_to_str (ptid_t (pid)));
 
       fflush (stdout);
     }
-  inferior_ptid = do_attach (pid_to_ptid (pid));
+  inferior_ptid = do_attach (ptid_t (pid));
   if (!target_is_pushed (this))
     push_target (this);
 }
@@ -1921,7 +1921,7 @@ procfs_target::detach (inferior *inf, int from_tty)
 	exec_file = "";
 
       printf_filtered (_("Detaching from program: %s, %s\n"), exec_file,
-		       target_pid_to_str (pid_to_ptid (pid)));
+		       target_pid_to_str (ptid_t (pid)));
       gdb_flush (gdb_stdout);
     }
 
@@ -2208,7 +2208,7 @@ wait_again:
 
   retry++;
   wstat    = 0;
-  retval   = pid_to_ptid (-1);
+  retval   = ptid_t (-1);
 
   /* Find procinfo for main process.  */
   pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
@@ -2244,7 +2244,7 @@ wait_again:
 		       ptid_get_pid (inferior_ptid), wait_retval);
 	      /* FIXME: might I not just use waitpid?
 		 Or try find_procinfo to see if I know about this child?  */
-	      retval = pid_to_ptid (wait_retval);
+	      retval = ptid_t (wait_retval);
 	    }
 	  else if (errno == EINTR)
 	    goto wait_again;
@@ -2340,7 +2340,7 @@ wait_again:
 			/* If wait returns -1, that's what we return
 			   to GDB.  */
 			if (temp < 0)
-			  retval = pid_to_ptid (temp);
+			  retval = ptid_t (temp);
 		      }
 		  }
 		else
@@ -2507,7 +2507,7 @@ wait_again:
 		case FLTPAGE:	/* Recoverable page fault */
 		default:	/* FIXME: use si_signo if possible for
 				   fault.  */
-		  retval = pid_to_ptid (-1);
+		  retval = ptid_t (-1);
 		  printf_filtered ("procfs:%d -- ", __LINE__);
 		  printf_filtered (_("child stopped for unknown reason:\n"));
 		  proc_prettyprint_why (why, what, 1);
@@ -2959,7 +2959,7 @@ procfs_init_inferior (struct target_ops *ops, int pid)
   /* We already have a main thread registered in the thread table at
      this point, but it didn't have any lwp info yet.  Notify the core
      about it.  This changes inferior_ptid as well.  */
-  thread_change_ptid (pid_to_ptid (pid),
+  thread_change_ptid (ptid_t (pid),
 		      ptid_t (pid, lwpid, 0));
 
   gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
@@ -3126,7 +3126,7 @@ procfs_target::create_inferior (const char *exec_file,
   /* We have something that executes now.  We'll be running through
      the shell at this point (if startup-with-shell is true), but the
      pid shouldn't change.  */
-  add_thread_silent (pid_to_ptid (pid));
+  add_thread_silent (ptid_t (pid));
 
   procfs_init_inferior (this, pid);
 }
@@ -3749,7 +3749,7 @@ _initialize_procfs (void)
 ptid_t
 procfs_first_available (void)
 {
-  return pid_to_ptid (procinfo_list ? procinfo_list->pid : -1);
+  return ptid_t (procinfo_list ? procinfo_list->pid : -1);
 }
 
 /* ===================  GCORE .NOTE "MODULE" =================== */
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 9954a190d3..d11f9ef873 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -292,12 +292,12 @@ print_program_space (struct ui_out *uiout, int requested)
 		printed_header = 1;
 		printf_filtered ("\n\tBound inferiors: ID %d (%s)",
 				 inf->num,
-				 target_pid_to_str (pid_to_ptid (inf->pid)));
+				 target_pid_to_str (ptid_t (inf->pid)));
 	      }
 	    else
 	      printf_filtered (", ID %d (%s)",
 			       inf->num,
-			       target_pid_to_str (pid_to_ptid (inf->pid)));
+			       target_pid_to_str (ptid_t (inf->pid)));
 	  }
 
       uiout->text ("\n");
diff --git a/gdb/remote.c b/gdb/remote.c
index b72a27e62a..0eea37a176 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2439,7 +2439,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing)
 	     stub doesn't support qC.  This is the first stop reported
 	     after an attach, so this is the main thread.  Update the
 	     ptid in the thread list.  */
-	  if (in_thread_list (pid_to_ptid (pid)))
+	  if (in_thread_list (ptid_t (pid)))
 	    thread_change_ptid (inferior_ptid, currthread);
 	  else
 	    {
@@ -5684,7 +5684,7 @@ remote_target::remote_detach_1 (int from_tty, inferior *inf)
     {
       /* Save the pid as a string before mourning, since that will
 	 unpush the remote target, and we need the string after.  */
-      std::string infpid = target_pid_to_str (pid_to_ptid (pid));
+      std::string infpid = target_pid_to_str (ptid_t (pid));
 
       target_mourn_inferior (inferior_ptid);
       if (print_inferior_events)
@@ -5806,10 +5806,10 @@ extended_remote_target::attach (const char *args, int from_tty)
 
       if (exec_file)
 	printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
       else
 	printf_unfiltered (_("Attaching to %s\n"),
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
 
       gdb_flush (gdb_stdout);
     }
@@ -5830,19 +5830,19 @@ extended_remote_target::attach (const char *args, int from_tty)
 	}
       else if (strcmp (rs->buf, "OK") != 0)
 	error (_("Attaching to %s failed with: %s"),
-	       target_pid_to_str (pid_to_ptid (pid)),
+	       target_pid_to_str (ptid_t (pid)),
 	       rs->buf);
       break;
     case PACKET_UNKNOWN:
       error (_("This target does not support attaching to a process"));
     default:
       error (_("Attaching to %s failed"),
-	     target_pid_to_str (pid_to_ptid (pid)));
+	     target_pid_to_str (ptid_t (pid)));
     }
 
   set_current_inferior (remote_add_inferior (0, pid, 1, 0));
 
-  inferior_ptid = pid_to_ptid (pid);
+  inferior_ptid = ptid_t (pid);
 
   if (target_is_non_stop_p ())
     {
@@ -5855,7 +5855,7 @@ extended_remote_target::attach (const char *args, int from_tty)
       if (thread)
 	inferior_ptid = thread->ptid;
       else
-	inferior_ptid = pid_to_ptid (pid);
+	inferior_ptid = ptid_t (pid);
 
       /* Invalidate our notion of the remote current thread.  */
       record_currthread (rs, minus_one_ptid);
@@ -6577,7 +6577,7 @@ remote_target::commit_resume ()
 	    {
 	      if (get_remote_inferior (inf)->may_wildcard_vcont)
 		{
-		  vcont_builder.push_action (pid_to_ptid (inf->pid),
+		  vcont_builder.push_action (ptid_t (inf->pid),
 					     false, GDB_SIGNAL_0);
 		}
 	    }
@@ -7532,7 +7532,7 @@ Packet: '%s'\n"),
 	  }
 	else
 	  error (_("unknown stop reply packet: %s"), buf);
-	event->ptid = pid_to_ptid (pid);
+	event->ptid = ptid_t (pid);
       }
       break;
     case 'N':
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 31677c24c5..8a9a0ed81f 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -543,7 +543,7 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
   else
     store_waitstatus (ourstatus, status);
 
-  return pid_to_ptid (pid);
+  return ptid_t (pid);
 }
 \f
 
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 8d3ed55ed0..74cab71420 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -848,7 +848,7 @@ s390_refresh_per_info_cb (struct lwp_info *lp, void *arg)
 static int
 s390_refresh_per_info (void)
 {
-  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
 
   iterate_over_lwps (pid_ptid, s390_refresh_per_info_cb, NULL);
   return 0;
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index d67fd8352f..85d3ad92ff 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -307,20 +307,20 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
 
   val = p_td_ta_map_id2thr (main_ta, ptid_get_tid (thread_id), &th);
   if (val == TD_NOTHR)
-    return pid_to_ptid (-1);	/* Thread must have terminated.  */
+    return ptid_t (-1);	/* Thread must have terminated.  */
   else if (val != TD_OK)
     error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
 
   val = p_td_thr_get_info (&th, &ti);
   if (val == TD_NOTHR)
-    return pid_to_ptid (-1);	/* Thread must have terminated.  */
+    return ptid_t (-1);	/* Thread must have terminated.  */
   else if (val != TD_OK)
     error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
 
   if (ti.ti_state != TD_THR_ACTIVE)
     {
       if (default_lwp != -1)
-	return pid_to_ptid (default_lwp);
+	return ptid_t (default_lwp);
       error (_("thread_to_lwp: thread state not active: %s"),
 	     td_state_string (ti.ti_state));
     }
@@ -346,11 +346,11 @@ lwp_to_thread (ptid_t lwp)
   /* It's an LWP.  Convert it to a thread ID.  */
 
   if (!target_thread_alive (lwp))
-    return pid_to_ptid (-1);	/* Must be a defunct LPW.  */
+    return ptid_t (-1);	/* Must be a defunct LPW.  */
 
   val = p_td_ta_map_lwp2thr (main_ta, ptid_get_lwp (lwp), &th);
   if (val == TD_NOTHR)
-    return pid_to_ptid (-1);	/* Thread must have terminated.  */
+    return ptid_t (-1);	/* Thread must have terminated.  */
   else if (val != TD_OK)
     error (_("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val));
 
@@ -362,7 +362,7 @@ lwp_to_thread (ptid_t lwp)
 
   val = p_td_thr_get_info (&th, &ti);
   if (val == TD_NOTHR)
-    return pid_to_ptid (-1);	/* Thread must have terminated.  */
+    return ptid_t (-1);	/* Thread must have terminated.  */
   else if (val != TD_OK)
     error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
 
@@ -387,7 +387,7 @@ sol_thread_target::detach (inferior *inf, int from_tty)
   target_ops *beneath = this->beneath ();
 
   sol_thread_active = 0;
-  inferior_ptid = pid_to_ptid (ptid_get_pid (main_ph.ptid));
+  inferior_ptid = ptid_t (ptid_get_pid (main_ph.ptid));
   unpush_target (this);
   beneath->detach (inf, from_tty);
 }
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 96cda7274d..18c1856f7b 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -503,7 +503,7 @@ spu_linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
     }
 
   store_waitstatus (ourstatus, status);
-  return pid_to_ptid (pid);
+  return ptid_t (pid);
 }
 
 /* Override the fetch_inferior_register routine.  */
diff --git a/gdb/target.c b/gdb/target.c
index 080480c609..66db4b278c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3243,7 +3243,7 @@ target_announce_detach (int from_tty)
 
   pid = ptid_get_pid (inferior_ptid);
   printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
-		     target_pid_to_str (pid_to_ptid (pid)));
+		     target_pid_to_str (ptid_t (pid)));
   gdb_flush (gdb_stdout);
 }
 
diff --git a/gdb/top.c b/gdb/top.c
index 8e0a39494e..c68f8d36ec 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1543,11 +1543,11 @@ print_inferior_quit_action (struct inferior *inf, void *arg)
   if (inf->attach_flag)
     fprintf_filtered (stb,
 		      _("\tInferior %d [%s] will be detached.\n"), inf->num,
-		      target_pid_to_str (pid_to_ptid (inf->pid)));
+		      target_pid_to_str (ptid_t (inf->pid)));
   else
     fprintf_filtered (stb,
 		      _("\tInferior %d [%s] will be killed.\n"), inf->num,
-		      target_pid_to_str (pid_to_ptid (inf->pid)));
+		      target_pid_to_str (ptid_t (inf->pid)));
 
   return 0;
 }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 28abdcdbe9..7e46b182ba 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -555,7 +555,7 @@ tfile_target_open (const char *arg, int from_tty)
   END_CATCH
 
   inferior_appeared (current_inferior (), TFILE_PID);
-  inferior_ptid = pid_to_ptid (TFILE_PID);
+  inferior_ptid = ptid_t (TFILE_PID);
   add_thread_silent (inferior_ptid);
 
   if (ts->traceframe_count <= 0)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 5eaa98af02..890cd06c07 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1824,7 +1824,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
      can rely on it.  When attaching, we don't know about any thread
      id here, but that's OK --- nothing should be referencing the
      current thread until we report an event out of windows_wait.  */
-  inferior_ptid = pid_to_ptid (pid);
+  inferior_ptid = ptid_t (pid);
 
   target_terminal::init ();
   target_terminal::inferior ();
@@ -1959,10 +1959,10 @@ windows_nat_target::attach (const char *args, int from_tty)
 
       if (exec_file)
 	printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
       else
 	printf_unfiltered ("Attaching to %s\n",
-			   target_pid_to_str (pid_to_ptid (pid)));
+			   target_pid_to_str (ptid_t (pid)));
 
       gdb_flush (gdb_stdout);
     }
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 07/10] Remove ptid_lwp_p
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 10/10] Remove ptid_equal Tom Tromey
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_lwp_p in favor of the ptid_t::lwp_p method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_lwp_p): Remove.
	* common/ptid.h (ptid_lwp_p): Don't declare.
	* fbsd-nat.c: Update.
	* linux-nat.c: Update.
	* nat/linux-procfs.c: Update.
	* nat/x86-linux-dregs.c: Update.
	* sol-thread.c: Update.
---
 gdb/ChangeLog             | 10 ++++++++++
 gdb/common/ptid.c         |  8 --------
 gdb/common/ptid.h         |  4 ----
 gdb/fbsd-nat.c            |  4 ++--
 gdb/linux-nat.c           |  8 ++++----
 gdb/nat/linux-procfs.c    |  2 +-
 gdb/nat/x86-linux-dregs.c |  4 ++--
 gdb/sol-thread.c          |  2 +-
 8 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cc2eb23db6..ea3bb2c467 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (ptid_lwp_p): Remove.
+	* common/ptid.h (ptid_lwp_p): Don't declare.
+	* fbsd-nat.c: Update.
+	* linux-nat.c: Update.
+	* nat/linux-procfs.c: Update.
+	* nat/x86-linux-dregs.c: Update.
+	* sol-thread.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.c (ptid_is_pid): Remove.
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 1e71104cdb..9bf6e2d9a9 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_lwp_p (const ptid_t &ptid)
-{
-  return ptid.lwp_p ();
-}
-
-/* See ptid.h.  */
-
 int
 ptid_tid_p (const ptid_t &ptid)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 61a8d5f710..8830dce2dc 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::lwp_p.  */
-
-extern int ptid_lwp_p (const ptid_t &ptid);
-
 /* See ptid_t::tid_p.  */
 
 extern int ptid_tid_p (const ptid_t &ptid);
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 2adb7a437f..88eb80ee25 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -810,7 +810,7 @@ show_fbsd_nat_debug (struct ui_file *file, int from_tty,
 bool
 fbsd_nat_target::thread_alive (ptid_t ptid)
 {
-  if (ptid_lwp_p (ptid))
+  if (ptid.lwp_p ())
     {
       struct ptrace_lwpinfo pl;
 
@@ -1102,7 +1102,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 			"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
 			ptid.pid (), ptid.lwp (),
 			ptid.tid ());
-  if (ptid_lwp_p (ptid))
+  if (ptid.lwp_p ())
     {
       /* If ptid is a specific LWP, suspend all other LWPs in the process.  */
       struct thread_info *tp;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 6512fb7b93..a0ecb654e0 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -858,7 +858,7 @@ add_initial_lwp (ptid_t ptid)
 {
   struct lwp_info *lp;
 
-  gdb_assert (ptid_lwp_p (ptid));
+  gdb_assert (ptid.lwp_p ());
 
   lp = XNEW (struct lwp_info);
 
@@ -935,7 +935,7 @@ find_lwp_pid (ptid_t ptid)
   int lwp;
   struct lwp_info dummy;
 
-  if (ptid_lwp_p (ptid))
+  if (ptid.lwp_p ())
     lwp = ptid.lwp ();
   else
     lwp = ptid.pid ();
@@ -3927,7 +3927,7 @@ linux_nat_target::pid_to_str (ptid_t ptid)
 {
   static char buf[64];
 
-  if (ptid_lwp_p (ptid)
+  if (ptid.lwp_p ()
       && (ptid.pid () != ptid.lwp ()
 	  || num_lwps (ptid.pid ()) > 1))
     {
@@ -4657,7 +4657,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
 ptid_t
 current_lwp_ptid (void)
 {
-  gdb_assert (ptid_lwp_p (inferior_ptid));
+  gdb_assert (inferior_ptid.lwp_p ());
   return inferior_ptid;
 }
 
diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index 20708fa41c..1c236c543d 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -240,7 +240,7 @@ linux_proc_tid_get_name (ptid_t ptid)
   char comm_path[100];
   const char *comm_val;
   pid_t pid = ptid.pid ();
-  pid_t tid = ptid_lwp_p (ptid) ? ptid.lwp () : ptid.pid ();
+  pid_t tid = ptid.lwp_p () ? ptid.lwp () : ptid.pid ();
 
   xsnprintf (comm_path, sizeof (comm_path),
 	     "/proc/%ld/task/%ld/comm", (long) pid, (long) tid);
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index 8aa8717163..5437fb406a 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -43,7 +43,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
   int tid;
   unsigned long value;
 
-  gdb_assert (ptid_lwp_p (ptid));
+  gdb_assert (ptid.lwp_p ());
   tid = ptid.lwp ();
 
   errno = 0;
@@ -61,7 +61,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
 {
   int tid;
 
-  gdb_assert (ptid_lwp_p (ptid));
+  gdb_assert (ptid.lwp_p ());
   tid = ptid.lwp ();
 
   errno = 0;
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 95248f2c17..bb73c4a031 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -300,7 +300,7 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
   td_thrhandle_t th;
   td_err_e val;
 
-  if (ptid_lwp_p (thread_id))
+  if (thread_id.lwp_p ())
     return thread_id;		/* It's already an LWP ID.  */
 
   /* It's a thread.  Convert to LWP.  */
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 10/10] Remove ptid_equal
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
  2018-06-13 21:51 ` [RFA 07/10] Remove ptid_lwp_p Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 08/10] Remove ptid_tid_p Tom Tromey
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Remove ptid_equal in favor of using "==".

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_equal): Remove.
	* common/ptid.h (ptid_equal): Don't declare.
	* ada-tasks.c: Update.
	* breakpoint.c: Update.
	* common/agent.c: Update.
	* corelow.c: Update.
	* darwin-nat-info.c: Update.
	* darwin-nat.c: Update.
	* dcache.c: Update.
	* dtrace-probe.c: Update.
	* dummy-frame.c: Update.
	* fbsd-nat.c: Update.
	* frame.c: Update.
	* gdbthread.h: Update.
	* gnu-nat.c: Update.
	* go32-nat.c: Update.
	* inf-loop.c: Update.
	* inf-ptrace.c: Update.
	* infcall.c: Update.
	* infcmd.c: Update.
	* inflow.c: Update.
	* infrun.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-thread-db.c: Update.
	* mi/mi-cmd-var.c: Update.
	* mi/mi-interp.c: Update.
	* mi/mi-main.c: Update.
	* nto-procfs.c: Update.
	* ppc-linux-tdep.c: Update.
	* procfs.c: Update.
	* python/py-inferior.c: Update.
	* python/py-record-btrace.c: Update.
	* python/py-record.c: Update.
	* ravenscar-thread.c: Update.
	* regcache.c: Update.
	* remote-sim.c: Update.
	* remote.c: Update.
	* sol-thread.c: Update.
	* solib.c: Update.
	* target.c: Update.
	* tui/tui-stack.c: Update.
	* varobj.c: Update.
	* windows-nat.c: Update.
	* windows-tdep.c: Update.

gdbserver/ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* linux-low.c: Update.
	* lynx-low.c: Update.
	* mem-break.c: Update.
	* nto-low.c: Update.
	* remote-utils.c: Update.
	* server.c: Update.
	* spu-low.c: Update.
	* target.c: Update.
	* win32-low.c: Update.
---
 gdb/ChangeLog                 | 48 +++++++++++++++++++++++++++++
 gdb/ada-tasks.c               |  7 ++---
 gdb/breakpoint.c              | 18 +++++------
 gdb/common/agent.c            |  2 +-
 gdb/common/ptid.c             |  8 -----
 gdb/common/ptid.h             |  8 -----
 gdb/corelow.c                 |  2 +-
 gdb/darwin-nat-info.c         | 10 +++---
 gdb/darwin-nat.c              |  8 ++---
 gdb/dcache.c                  |  4 +--
 gdb/dtrace-probe.c            |  4 +--
 gdb/dummy-frame.c             |  4 +--
 gdb/fbsd-nat.c                |  6 ++--
 gdb/frame.c                   |  2 +-
 gdb/gdbserver/ChangeLog       | 12 ++++++++
 gdb/gdbserver/linux-low.c     | 20 ++++++------
 gdb/gdbserver/lynx-low.c      |  6 ++--
 gdb/gdbserver/mem-break.c     | 12 +++-----
 gdb/gdbserver/nto-low.c       |  4 +--
 gdb/gdbserver/remote-utils.c  |  2 +-
 gdb/gdbserver/server.c        | 26 ++++++++--------
 gdb/gdbserver/spu-low.c       |  6 ++--
 gdb/gdbserver/target.c        |  4 +--
 gdb/gdbserver/win32-low.c     |  4 +--
 gdb/gdbthread.h               |  2 +-
 gdb/gnu-nat.c                 |  8 ++---
 gdb/go32-nat.c                |  2 +-
 gdb/inf-loop.c                |  2 +-
 gdb/inf-ptrace.c              |  2 +-
 gdb/infcall.c                 |  4 +--
 gdb/infcmd.c                  | 12 ++++----
 gdb/inflow.c                  |  2 +-
 gdb/infrun.c                  | 72 +++++++++++++++++++++----------------------
 gdb/linux-fork.c              | 18 +++++------
 gdb/linux-nat.c               |  8 ++---
 gdb/linux-thread-db.c         |  2 +-
 gdb/mi/mi-cmd-var.c           |  2 +-
 gdb/mi/mi-interp.c            |  4 +--
 gdb/mi/mi-main.c              | 10 +++---
 gdb/nto-procfs.c              | 10 +++---
 gdb/ppc-linux-tdep.c          |  2 +-
 gdb/procfs.c                  |  8 ++---
 gdb/python/py-inferior.c      |  2 +-
 gdb/python/py-record-btrace.c |  6 ++--
 gdb/python/py-record.c        |  4 +--
 gdb/ravenscar-thread.c        |  6 ++--
 gdb/regcache.c                |  6 ++--
 gdb/remote-sim.c              |  8 ++---
 gdb/remote.c                  | 48 ++++++++++++++---------------
 gdb/sol-thread.c              |  2 +-
 gdb/solib.c                   |  2 +-
 gdb/target.c                  | 18 +++++------
 gdb/tui/tui-stack.c           |  2 +-
 gdb/varobj.c                  |  2 +-
 gdb/windows-nat.c             |  2 +-
 gdb/windows-tdep.c            |  4 +--
 56 files changed, 274 insertions(+), 235 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5cbd26d247..901d32e812 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,51 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (ptid_equal): Remove.
+	* common/ptid.h (ptid_equal): Don't declare.
+	* ada-tasks.c: Update.
+	* breakpoint.c: Update.
+	* common/agent.c: Update.
+	* corelow.c: Update.
+	* darwin-nat-info.c: Update.
+	* darwin-nat.c: Update.
+	* dcache.c: Update.
+	* dtrace-probe.c: Update.
+	* dummy-frame.c: Update.
+	* fbsd-nat.c: Update.
+	* frame.c: Update.
+	* gdbthread.h: Update.
+	* gnu-nat.c: Update.
+	* go32-nat.c: Update.
+	* inf-loop.c: Update.
+	* inf-ptrace.c: Update.
+	* infcall.c: Update.
+	* infcmd.c: Update.
+	* inflow.c: Update.
+	* infrun.c: Update.
+	* linux-fork.c: Update.
+	* linux-nat.c: Update.
+	* linux-thread-db.c: Update.
+	* mi/mi-cmd-var.c: Update.
+	* mi/mi-interp.c: Update.
+	* mi/mi-main.c: Update.
+	* nto-procfs.c: Update.
+	* ppc-linux-tdep.c: Update.
+	* procfs.c: Update.
+	* python/py-inferior.c: Update.
+	* python/py-record-btrace.c: Update.
+	* python/py-record.c: Update.
+	* ravenscar-thread.c: Update.
+	* regcache.c: Update.
+	* remote-sim.c: Update.
+	* remote.c: Update.
+	* sol-thread.c: Update.
+	* solib.c: Update.
+	* target.c: Update.
+	* tui/tui-stack.c: Update.
+	* varobj.c: Update.
+	* windows-nat.c: Update.
+	* windows-tdep.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.c (ptid_match): Remove.
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index a75aa0f9f1..c927a48197 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -302,8 +302,7 @@ ada_get_task_number (ptid_t ptid)
   data = get_ada_tasks_inferior_data (inf);
 
   for (i = 0; i < VEC_length (ada_task_info_s, data->task_list); i++)
-    if (ptid_equal (VEC_index (ada_task_info_s, data->task_list, i)->ptid,
-		    ptid))
+    if (VEC_index (ada_task_info_s, data->task_list, i)->ptid == ptid)
       return i + 1;
 
   return 0;  /* No matching task found.  */
@@ -370,7 +369,7 @@ ada_get_task_info_from_ptid (ptid_t ptid)
   for (i = 0; i < nb_tasks; i++)
     {
       task = VEC_index (ada_task_info_s, data->task_list, i);
-      if (ptid_equal (task->ptid, ptid))
+      if (task->ptid == ptid)
 	return task;
     }
 
@@ -1111,7 +1110,7 @@ print_ada_task_info (struct ui_out *uiout,
 
       /* Print a star if this task is the current task (or the task
          currently selected).  */
-      if (ptid_equal (task_info->ptid, inferior_ptid))
+      if (task_info->ptid == inferior_ptid)
 	uiout->field_string ("current", "*");
       else
 	uiout->field_skip ("current");
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 85da620b40..78dbe61d8a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1546,8 +1546,8 @@ static int
 watchpoint_in_thread_scope (struct watchpoint *b)
 {
   return (b->pspace == current_program_space
-	  && (ptid_equal (b->watchpoint_thread, null_ptid)
-	      || (ptid_equal (inferior_ptid, b->watchpoint_thread)
+	  && (b->watchpoint_thread == null_ptid
+	      || (inferior_ptid == b->watchpoint_thread
 		  && !is_executing (inferior_ptid))));
 }
 
@@ -2904,7 +2904,7 @@ update_inserted_breakpoint_locations (void)
 	 if we aren't attached to any process yet, we should still
 	 insert breakpoints.  */
       if (!gdbarch_has_global_breakpoints (target_gdbarch ())
-	  && ptid_equal (inferior_ptid, null_ptid))
+	  && inferior_ptid == null_ptid)
 	continue;
 
       val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
@@ -2960,7 +2960,7 @@ insert_breakpoint_locations (void)
 	 if we aren't attached to any process yet, we should still
 	 insert breakpoints.  */
       if (!gdbarch_has_global_breakpoints (target_gdbarch ())
-	  && ptid_equal (inferior_ptid, null_ptid))
+	  && inferior_ptid == null_ptid)
 	continue;
 
       val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
@@ -4332,7 +4332,7 @@ bpstat_clear_actions (void)
   struct thread_info *tp;
   bpstat bs;
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return;
 
   tp = find_thread_ptid (inferior_ptid);
@@ -4351,7 +4351,7 @@ bpstat_clear_actions (void)
 static void
 breakpoint_about_to_proceed (void)
 {
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       struct thread_info *tp = inferior_thread ();
 
@@ -4472,7 +4472,7 @@ bpstat_do_actions (void)
   struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup ();
 
   /* Do any commands attached to breakpoint we are stopped at.  */
-  while (!ptid_equal (inferior_ptid, null_ptid)
+  while (inferior_ptid != null_ptid
 	 && target_has_execution
 	 && !is_exited (inferior_ptid)
 	 && !is_executing (inferior_ptid))
@@ -7779,7 +7779,7 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
     uiout->field_skip ("addr");
   annotate_field (5);
   uiout->text ("fork");
-  if (!ptid_equal (c->forked_inferior_pid, null_ptid))
+  if (c->forked_inferior_pid != null_ptid)
     {
       uiout->text (", process ");
       uiout->field_int ("what", c->forked_inferior_pid.pid ());
@@ -7894,7 +7894,7 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc)
     uiout->field_skip ("addr");
   annotate_field (5);
   uiout->text ("vfork");
-  if (!ptid_equal (c->forked_inferior_pid, null_ptid))
+  if (c->forked_inferior_pid != null_ptid)
     {
       uiout->text (", process ");
       uiout->field_int ("what", c->forked_inferior_pid.pid ());
diff --git a/gdb/common/agent.c b/gdb/common/agent.c
index 65d5f1938b..8f80aee533 100644
--- a/gdb/common/agent.c
+++ b/gdb/common/agent.c
@@ -234,7 +234,7 @@ agent_run_command (int pid, const char *cmd, int len)
     return -1;
 
   /* Need to read response with the inferior stopped.  */
-  if (!ptid_equal (ptid, null_ptid))
+  if (ptid != null_ptid)
     {
       /* Stop thread PTID.  */
       DEBUG_AGENT ("agent: stop helper thread\n");
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index b9a331ad5e..22d79e2e41 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -24,11 +24,3 @@
 
 ptid_t null_ptid = ptid_t::make_null ();
 ptid_t minus_one_ptid = ptid_t::make_minus_one ();
-
-/* See ptid.h.  */
-
-int
-ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2)
-{
-  return ptid1 == ptid2;
-}
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 2fc84b9c85..03f532185a 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -152,12 +152,4 @@ extern ptid_t null_ptid;
 
 extern ptid_t minus_one_ptid;
 
-
-/* The following functions are kept for backwards compatibility.  The use of
-   the ptid_t methods is preferred.  */
-
-/* See ptid_t::operator== and ptid_t::operator!=.  */
-
-extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2);
-
 #endif
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 51330bb7ff..b9a65a40cb 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -446,7 +446,7 @@ core_target_open (const char *arg, int from_tty)
   bfd_map_over_sections (core_bfd, add_to_thread_list,
 			 bfd_get_section_by_name (core_bfd, ".reg"));
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     {
       /* Either we found no .reg/NN section, and hence we have a
 	 non-threaded core (single-threaded, from gdb's perspective),
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index e68637fc0d..f3c8de286a 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -116,7 +116,7 @@ get_task_from_args (const char *args)
 
   if (args == NULL || *args == 0)
     {
-      if (ptid_equal (inferior_ptid, null_ptid))
+      if (inferior_ptid == null_ptid)
 	printf_unfiltered (_("No inferior running\n"));
 
       darwin_inferior *priv = get_darwin_inferior (current_inferior ());
@@ -257,7 +257,7 @@ info_mach_ports_command (const char *args, int from_tty)
 	    printf_unfiltered (_(" gdb-exception"));
 	  else if (port == darwin_port_set)
 	    printf_unfiltered (_(" gdb-port_set"));
-	  else if (!ptid_equal (inferior_ptid, null_ptid))
+	  else if (inferior_ptid != null_ptid)
 	    {
 	      struct inferior *inf = current_inferior ();
 	      darwin_inferior *priv = get_darwin_inferior (inf);
@@ -731,7 +731,7 @@ info_mach_region_command (const char *exp, int from_tty)
     }
   address = value_as_address (val);
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     error (_("Inferior not available"));
 
   inf = current_inferior ();
@@ -803,7 +803,7 @@ info_mach_exceptions_command (const char *args, int from_tty)
     {
       if (strcmp (args, "saved") == 0)
 	{
-	  if (ptid_equal (inferior_ptid, null_ptid))
+	  if (inferior_ptid == null_ptid)
 	    printf_unfiltered (_("No inferior running\n"));
 
 	  darwin_inferior *priv = get_darwin_inferior (current_inferior ());
@@ -827,7 +827,7 @@ info_mach_exceptions_command (const char *args, int from_tty)
     {
       struct inferior *inf;
 
-      if (ptid_equal (inferior_ptid, null_ptid))
+      if (inferior_ptid == null_ptid)
 	printf_unfiltered (_("No inferior running\n"));
       inf = current_inferior ();
       
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 7f6441d273..709731f10f 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -940,7 +940,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
     ptid = inferior_ptid;
 
   /* minus_one_ptid is RESUME_ALL.  */
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     {
       struct resume_inferior_threads_param param;
 
@@ -1242,7 +1242,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 	darwin_dump_message (hdr, darwin_debug_flag > 11);
 
       res = darwin_decode_message (hdr, &thread, &inf, status);
-      if (ptid_equal (res, minus_one_ptid))
+      if (res == minus_one_ptid)
 	continue;
 
       /* Early return in case an inferior has exited.  */
@@ -1515,7 +1515,7 @@ darwin_nat_target::kill ()
   int status;
   int res;
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return;
 
   gdb_assert (inf != NULL);
@@ -2206,7 +2206,7 @@ static void
 set_enable_mach_exceptions (const char *args, int from_tty,
 			    struct cmd_list_element *c)
 {
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       struct inferior *inf = current_inferior ();
       darwin_inferior *priv = get_darwin_inferior (inf);
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 20b781fa01..f72b348cf1 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -472,7 +472,7 @@ dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
   /* If this is a different inferior from what we've recorded,
      flush the cache.  */
 
-  if (! ptid_equal (inferior_ptid, dcache->ptid))
+  if (inferior_ptid != dcache->ptid)
     {
       dcache_invalidate (dcache);
       dcache->ptid = inferior_ptid;
@@ -608,7 +608,7 @@ dcache_info_1 (DCACHE *dcache, const char *exp)
 		   dcache ? (unsigned) dcache->line_size
 		   : dcache_line_size);
 
-  if (dcache == NULL || ptid_equal (dcache->ptid, null_ptid))
+  if (dcache == NULL || dcache->ptid == null_ptid)
     {
       printf_filtered (_("No data cache available.\n"));
       return;
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 71530aa909..fa4e06e794 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -778,7 +778,7 @@ dtrace_probe::enable ()
 
   /* Enabling a dtrace probe implies patching the text section of the
      running process, so make sure the inferior is indeed running.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     error (_("No inferior running"));
 
   /* Fast path.  */
@@ -802,7 +802,7 @@ dtrace_probe::disable ()
 
   /* Disabling a dtrace probe implies patching the text section of the
      running process, so make sure the inferior is indeed running.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     error (_("No inferior running"));
 
   /* Fast path.  */
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 82e7251cce..a5558812b0 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -46,7 +46,7 @@ static int
 dummy_frame_id_eq (struct dummy_frame_id *id1,
 		   struct dummy_frame_id *id2)
 {
-  return frame_id_eq (id1->id, id2->id) && ptid_equal (id1->ptid, id2->ptid);
+  return frame_id_eq (id1->id, id2->id) && id1->ptid == id2->ptid;
 }
 
 /* List of dummy_frame destructors.  */
@@ -154,7 +154,7 @@ pop_dummy_frame (struct dummy_frame **dummy_ptr)
 {
   struct dummy_frame *dummy = *dummy_ptr;
 
-  gdb_assert (ptid_equal (dummy->id.ptid, inferior_ptid));
+  gdb_assert (dummy->id.ptid == inferior_ptid);
 
   while (dummy->dtor_list != NULL)
     {
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 2f7560b067..38b472a0e3 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1089,7 +1089,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
   pid_t pid;
 
   /* Don't PT_CONTINUE a process which has a pending vfork done event.  */
-  if (ptid_equal (minus_one_ptid, ptid))
+  if (minus_one_ptid == ptid)
     pid = inferior_ptid.pid ();
   else
     pid = ptid.pid ();
@@ -1236,7 +1236,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
     {
 #ifndef PTRACE_VFORK
       wptid = fbsd_next_vfork_done ();
-      if (!ptid_equal (wptid, null_ptid))
+      if (wptid != null_ptid)
 	{
 	  ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
 	  return wptid;
@@ -1344,7 +1344,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
 	      /* Make sure the other end of the fork is stopped too.  */
 	      child_ptid = fbsd_is_child_pending (child);
-	      if (ptid_equal (child_ptid, null_ptid))
+	      if (child_ptid == null_ptid)
 		{
 		  pid = waitpid (child, &status, 0);
 		  if (pid == -1)
diff --git a/gdb/frame.c b/gdb/frame.c
index d8309e7407..3c1ee92903 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1624,7 +1624,7 @@ has_stack_frames (void)
   if (get_traceframe_number () < 0)
     {
       /* No current inferior, no frame.  */
-      if (ptid_equal (inferior_ptid, null_ptid))
+      if (inferior_ptid == null_ptid)
 	return 0;
 
       /* Don't try to read from a dead thread.  */
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 137e1cc4de..42b34f5a98 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,15 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* linux-low.c: Update.
+	* lynx-low.c: Update.
+	* mem-break.c: Update.
+	* nto-low.c: Update.
+	* remote-utils.c: Update.
+	* server.c: Update.
+	* spu-low.c: Update.
+	* target.c: Update.
+	* win32-low.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* server.c: Update.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index cef528bbb2..6e026f1aab 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) || filter_ptid.is_pid ())
+  if (filter_ptid == minus_one_ptid || filter_ptid.is_pid ())
     {
       event_thread = find_thread_in_random ([&] (thread_info *thread)
 	{
@@ -2647,7 +2647,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
       if (debug_threads && event_thread)
 	debug_printf ("Got a pending child %ld\n", lwpid_of (event_thread));
     }
-  else if (!ptid_equal (filter_ptid, null_ptid))
+  else if (filter_ptid != null_ptid)
     {
       requested_child = find_lwp_pid (filter_ptid);
 
@@ -3159,7 +3159,7 @@ linux_wait_1 (ptid_t ptid,
   else
     any_resumed = 0;
 
-  if (ptid_equal (step_over_bkpt, null_ptid))
+  if (step_over_bkpt == null_ptid)
     pid = linux_wait_for_event (ptid, &w, options);
   else
     {
@@ -3248,7 +3248,7 @@ linux_wait_1 (ptid_t ptid,
      if it's not the single_step_breakpoint we are hitting.
      This avoids that a program would keep trapping a permanent breakpoint
      forever.  */
-  if (!ptid_equal (step_over_bkpt, null_ptid)
+  if (step_over_bkpt != null_ptid
       && event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
       && (event_child->stepping
 	  || !single_step_breakpoint_inserted_here (event_child->stop_pc)))
@@ -3736,7 +3736,7 @@ linux_wait_1 (ptid_t ptid,
 	 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))
+      if (ptid == minus_one_ptid)
 	{
 	  event_child->status_pending_p = 1;
 	  event_child->status_pending = w;
@@ -3827,7 +3827,7 @@ linux_wait_1 (ptid_t ptid,
       ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w));
     }
 
-  gdb_assert (ptid_equal (step_over_bkpt, null_ptid));
+  gdb_assert (step_over_bkpt == null_ptid);
 
   if (debug_threads)
     {
@@ -3886,14 +3886,14 @@ linux_wait (ptid_t ptid,
       event_ptid = linux_wait_1 (ptid, ourstatus, target_options);
     }
   while ((target_options & TARGET_WNOHANG) == 0
-	 && ptid_equal (event_ptid, null_ptid)
+	 && event_ptid == null_ptid
 	 && ourstatus->kind == TARGET_WAITKIND_IGNORE);
 
   /* If at least one stop was reported, there may be more.  A single
      SIGCHLD can signal more than one child stop.  */
   if (target_is_async_p ()
       && (target_options & TARGET_WNOHANG) != 0
-      && !ptid_equal (event_ptid, null_ptid))
+      && event_ptid != null_ptid)
     async_file_mark ();
 
   return event_ptid;
@@ -4542,7 +4542,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
   for (int ndx = 0; ndx < n; ndx++)
     {
       ptid_t ptid = resume[ndx].thread;
-      if (ptid_equal (ptid, minus_one_ptid)
+      if (ptid == minus_one_ptid
 	  || ptid == thread->id
 	  /* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads
 	     of PID'.  */
@@ -4899,7 +4899,7 @@ finish_step_over (struct lwp_info *lwp)
 static void
 complete_ongoing_step_over (void)
 {
-  if (!ptid_equal (step_over_bkpt, null_ptid))
+  if (step_over_bkpt != null_ptid)
     {
       struct lwp_info *lwp;
       int wstat;
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 8d79ab17ed..b68bbeaf20 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -342,14 +342,14 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
      LynxOS 178 is a little more sensitive, and triggers some
      unexpected signals (Eg SIG61) when we resume the inferior
      using a different thread.  */
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     ptid = current_process()->priv->last_wait_event_ptid;
 
   /* The ptid might still be minus_one_ptid; this can happen between
      the moment we create the inferior or attach to a process, and
      the moment we resume its execution for the first time.  It is
      fine to use the current_thread's ptid in those cases.  */
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     ptid = ptid_of (current_thread);
 
   regcache_invalidate_pid (ptid.pid ());
@@ -422,7 +422,7 @@ lynx_wait_1 (ptid_t ptid, struct target_waitstatus *status, int options)
   int wstat;
   ptid_t new_ptid;
 
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     pid = lynx_ptid_get_pid (ptid_of (current_thread));
   else
     pid = BUILDPID (lynx_ptid_get_pid (ptid), lynx_ptid_get_tid (ptid));
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 7ad8c48d62..447afc7c10 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -1501,8 +1501,7 @@ delete_single_step_breakpoints (struct thread_info *thread)
   while (bp)
     {
       if (bp->type == single_step_breakpoint
-	  && ptid_equal (((struct single_step_breakpoint *) bp)->ptid,
-			 ptid_of (thread)))
+	  && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
 	{
 	  struct thread_info *saved_thread = current_thread;
 
@@ -1598,8 +1597,7 @@ uninsert_single_step_breakpoints (struct thread_info *thread)
   for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
     {
     if (bp->type == single_step_breakpoint
-	&& ptid_equal (((struct single_step_breakpoint *) bp)->ptid,
-		       ptid_of (thread)))
+	&& ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
       {
 	gdb_assert (bp->raw->inserted > 0);
 
@@ -1673,8 +1671,7 @@ has_single_step_breakpoints (struct thread_info *thread)
   while (bp)
     {
       if (bp->type == single_step_breakpoint
-	  && ptid_equal (((struct single_step_breakpoint *) bp)->ptid,
-			 ptid_of (thread)))
+	  && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
 	return 1;
       else
 	{
@@ -1708,8 +1705,7 @@ reinsert_single_step_breakpoints (struct thread_info *thread)
   for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
     {
       if (bp->type == single_step_breakpoint
-	  && ptid_equal (((struct single_step_breakpoint *) bp)->ptid,
-			 ptid_of (thread)))
+	  && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
 	{
 	  gdb_assert (bp->raw->inserted > 0);
 
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index 21f6da61c1..236e555714 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -94,8 +94,8 @@ nto_set_thread (ptid_t ptid)
   TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (),
 	 ptid.lwp ());
   if (nto_inferior.ctl_fd != -1
-      && !ptid_equal (ptid, null_ptid)
-      && !ptid_equal (ptid, minus_one_ptid))
+      && ptid != null_ptid
+      && ptid != minus_one_ptid)
     {
       pthread_t tid = ptid.lwp ();
 
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index ac57ce53fd..45d5c8d451 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1222,7 +1222,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
 	       in GDB will claim this event belongs to inferior_ptid
 	       if we do not specify a thread, and there's no way for
 	       gdbserver to know what inferior_ptid is.  */
-	    if (1 || !ptid_equal (cs.general_thread, ptid))
+	    if (1 || cs.general_thread != ptid)
 	      {
 		int core = -1;
 		/* In non-stop, don't change the general thread behind
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 3c58c6eb10..e5d226c1a4 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -441,8 +441,8 @@ handle_btrace_general_set (char *own_buf)
 
   op = own_buf + strlen ("Qbtrace:");
 
-  if (ptid_equal (cs.general_thread, null_ptid)
-      || ptid_equal (cs.general_thread, minus_one_ptid))
+  if (cs.general_thread == null_ptid
+      || cs.general_thread == minus_one_ptid)
     {
       strcpy (own_buf, "E.Must select a single thread.");
       return -1;
@@ -491,8 +491,8 @@ handle_btrace_conf_general_set (char *own_buf)
 
   op = own_buf + strlen ("Qbtrace-conf:");
 
-  if (ptid_equal (cs.general_thread, null_ptid)
-      || ptid_equal (cs.general_thread, minus_one_ptid))
+  if (cs.general_thread == null_ptid
+      || cs.general_thread == minus_one_ptid)
     {
       strcpy (own_buf, "E.Must select a single thread.");
       return -1;
@@ -1829,8 +1829,8 @@ handle_qxfer_btrace (const char *annex,
   if (writebuf != NULL)
     return -2;
 
-  if (ptid_equal (cs.general_thread, null_ptid)
-      || ptid_equal (cs.general_thread, minus_one_ptid))
+  if (cs.general_thread == null_ptid
+      || cs.general_thread == minus_one_ptid)
     {
       strcpy (cs.own_buf, "E.Must select a single thread.");
       return -3;
@@ -1913,8 +1913,8 @@ handle_qxfer_btrace_conf (const char *annex,
   if (annex[0] != '\0')
     return -1;
 
-  if (ptid_equal (cs.general_thread, null_ptid)
-      || ptid_equal (cs.general_thread, minus_one_ptid))
+  if (cs.general_thread == null_ptid
+      || cs.general_thread == minus_one_ptid)
     {
       strcpy (cs.own_buf, "E.Must select a single thread.");
       return -3;
@@ -2696,8 +2696,8 @@ visit_actioned_threads (thread_info *thread,
     {
       const struct thread_resume *action = &actions[i];
 
-      if (ptid_equal (action->thread, minus_one_ptid)
-	  || ptid_equal (action->thread, thread->id)
+      if (action->thread == minus_one_ptid
+	  || action->thread == thread->id
 	  || ((action->thread.pid ()
 	       == thread->id.pid ())
 	      && action->thread.lwp () == -1))
@@ -3199,8 +3199,8 @@ myresume (char *own_buf, int step, int sig)
   int n = 0;
   int valid_cont_thread;
 
-  valid_cont_thread = (!ptid_equal (cs.cont_thread, null_ptid)
-			 && !ptid_equal (cs.cont_thread, minus_one_ptid));
+  valid_cont_thread = (cs.cont_thread != null_ptid
+			 && cs.cont_thread != minus_one_ptid);
 
   if (step || sig || valid_cont_thread)
     {
@@ -4095,7 +4095,7 @@ process_serial_event (void)
 
 	  if (cs.own_buf[1] == 'g')
 	    {
-	      if (ptid_equal (thread_id, null_ptid))
+	      if (thread_id == null_ptid)
 		{
 		  /* GDB is telling us to choose any thread.  Check if
 		     the currently selected thread is still valid. If
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index b3980e72bc..e9fc6e7beb 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -383,7 +383,7 @@ spu_join (int pid)
 static int
 spu_thread_alive (ptid_t ptid)
 {
-  return ptid_equal (ptid, current_ptid);
+  return ptid == current_ptid;
 }
 
 /* Resume process.  */
@@ -394,8 +394,8 @@ spu_resume (struct thread_resume *resume_info, size_t n)
   size_t i;
 
   for (i = 0; i < n; i++)
-    if (ptid_equal (resume_info[i].thread, minus_one_ptid)
-	|| ptid_equal (resume_info[i].thread, ptid_of (thr)))
+    if (resume_info[i].thread == minus_one_ptid
+	|| resume_info[i].thread == ptid_of (thr))
       break;
 
   if (i == n)
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 81d7cc471a..00379bfdc0 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -314,9 +314,9 @@ target_pid_to_str (ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     xsnprintf (buf, sizeof (buf), "<all threads>");
-  else if (ptid_equal (ptid, null_ptid))
+  else if (ptid == null_ptid)
     xsnprintf (buf, sizeof (buf), "<null thread>");
   else if (ptid.tid () != 0)
     xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 53b843b3ba..8a20972bd4 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -914,7 +914,7 @@ win32_resume (struct thread_resume *resume_info, size_t n)
   /* This handles the very limited set of resume packets that GDB can
      currently produce.  */
 
-  if (n == 1 && ptid_equal (resume_info[0].thread, minus_one_ptid))
+  if (n == 1 && resume_info[0].thread == minus_one_ptid)
     tid = -1;
   else if (n > 1)
     tid = -1;
@@ -923,7 +923,7 @@ win32_resume (struct thread_resume *resume_info, size_t n)
        the Windows resume code do the right thing for thread switching.  */
     tid = current_event.dwThreadId;
 
-  if (!ptid_equal (resume_info[0].thread, minus_one_ptid))
+  if (resume_info[0].thread != minus_one_ptid)
     {
       sig = gdb_signal_from_host (resume_info[0].sig);
       step = resume_info[0].kind == resume_step;
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 09ea5baf23..73941c3150 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -208,7 +208,7 @@ public:
   {
     /* If this is the current thread, or there's code out there that
        relies on it existing (refcount > 0) we can't delete yet.  */
-    return (refcount () == 0 && !ptid_equal (ptid, inferior_ptid));
+    return (refcount () == 0 && ptid != inferior_ptid);
   }
 
   struct thread_info *next = NULL;
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index f256a823b1..a886c2b80c 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -1100,7 +1100,7 @@ inf_validate_procs (struct inf *inf)
 
 	    /* Tell GDB's generic thread code.  */
 
-	    if (ptid_equal (inferior_ptid, ptid_t (inf->pid)))
+	    if (inferior_ptid == ptid_t (inf->pid))
 	      /* This is the first time we're hearing about thread
 		 ids, after a fork-child.  */
 	      thread_change_ptid (inferior_ptid, ptid);
@@ -1617,7 +1617,7 @@ rewait:
   thread = inf->wait.thread;
   if (thread)
     ptid = ptid_t (inf->pid, thread->tid, 0);
-  else if (ptid_equal (ptid, minus_one_ptid))
+  else if (ptid == minus_one_ptid)
     thread = inf_tid_to_thread (inf, -1);
   else
     thread = inf_tid_to_thread (inf, ptid.lwp ());
@@ -1634,7 +1634,7 @@ rewait:
     }
 
   if (thread
-      && !ptid_equal (ptid, minus_one_ptid)
+      && ptid != minus_one_ptid
       && status->kind != TARGET_WAITKIND_SPURIOUS
       && inf->pause_sc == 0 && thread->pause_sc == 0)
     /* If something actually happened to THREAD, make sure we
@@ -2036,7 +2036,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
   inf_update_procs (inf);
 
   /* A specific PTID means `step only this process id'.  */
-  resume_all = ptid_equal (ptid, minus_one_ptid);
+  resume_all = ptid == minus_one_ptid;
 
   if (resume_all)
     /* Allow all threads to run, except perhaps single-stepping one.  */
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 0120cbf7d2..732551630b 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -990,7 +990,7 @@ go32_nat_target::pass_ctrlc ()
 bool
 go32_nat_target::thread_alive (ptid_t ptid)
 {
-  return !ptid_equal (ptid, null_ptid);
+  return ptid != null_ptid;
 }
 
 const char *
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index bb6ad25bb7..2aa6816994 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -55,7 +55,7 @@ inferior_event_handler (enum inferior_event_type event_type,
 
       /* Do all continuations associated with the whole inferior (not
 	 a particular thread).  */
-      if (!ptid_equal (inferior_ptid, null_ptid))
+      if (inferior_ptid != null_ptid)
 	do_all_inferior_continuations (0);
 
       /* When running a command list (from a user command, say), these
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index d1c9a90e37..90ea679689 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -341,7 +341,7 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
   pid_t pid;
   int request;
 
-  if (ptid_equal (minus_one_ptid, ptid))
+  if (minus_one_ptid == ptid)
     /* Resume all threads.  Traditionally ptrace() only supports
        single-threaded processes, so simply resume the inferior.  */
     pid = inferior_ptid.pid ();
diff --git a/gdb/infcall.c b/gdb/infcall.c
index c20ab6f877..edfee72514 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -657,7 +657,7 @@ run_inferior_call (struct call_thread_fsm *sm,
      evaluates true and thus we'll present a user-visible stop is
      decided elsewhere.  */
   if (!was_running
-      && ptid_equal (call_thread_ptid, inferior_ptid)
+      && call_thread_ptid == inferior_ptid
       && stop_stack_dummy == STOP_STACK_DUMMY)
     finish_thread_state (user_visible_resume_ptid (0));
 
@@ -1271,7 +1271,7 @@ When the function is done executing, GDB will silently stop."),
 	     name);
     }
 
-  if (! ptid_equal (call_thread_ptid, inferior_ptid))
+  if (call_thread_ptid != inferior_ptid)
     {
       const char *name = get_function_name (funaddr,
 					    name_buf, sizeof (name_buf));
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 32c968c6d9..862994738f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -510,7 +510,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
 static void
 kill_if_already_running (int from_tty)
 {
-  if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution)
+  if (inferior_ptid != null_ptid && target_has_execution)
     {
       /* Bail out before killing the program if we will not be able to
 	 restart it.  */
@@ -735,7 +735,7 @@ proceed_thread_callback (struct thread_info *thread, void *arg)
 static void
 ensure_valid_thread (void)
 {
-  if (ptid_equal (inferior_ptid, null_ptid)
+  if (inferior_ptid == null_ptid
       || is_exited (inferior_ptid))
     error (_("Cannot execute this command without a live selected thread."));
 }
@@ -1351,7 +1351,7 @@ signal_command (const char *signum_exp, int from_tty)
 
       ALL_NON_EXITED_THREADS (tp)
 	{
-	  if (ptid_equal (tp->ptid, inferior_ptid))
+	  if (tp->ptid == inferior_ptid)
 	    continue;
 	  if (!tp->ptid.matches (resume_ptid))
 	    continue;
@@ -2094,7 +2094,7 @@ info_program_command (const char *args, int from_tty)
       get_last_target_status (&ptid, &ws);
     }
 
-  if (ptid_equal (ptid, null_ptid) || is_exited (ptid))
+  if (ptid == null_ptid || is_exited (ptid))
     error (_("Invalid selected thread."));
   else if (is_running (ptid))
     error (_("Selected thread is running."));
@@ -2591,7 +2591,7 @@ kill_command (const char *arg, int from_tty)
      It should be a distinct flag that indicates that a target is active, cuz
      some targets don't have processes!  */
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     error (_("The program is not being run."));
   if (!query (_("Kill the program being debugged? ")))
     error (_("Not confirmed."));
@@ -2998,7 +2998,7 @@ detach_command (const char *args, int from_tty)
 {
   dont_repeat ();		/* Not for the faint of heart.  */
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     error (_("The program is not being run."));
 
   query_if_trace_running (from_tty);
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 7bcefdcdc6..a3b5ba8abe 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -718,7 +718,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
       return;
     }
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return;
 
   inf = current_inferior ();
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6e47fbd07e..0211df1412 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -689,8 +689,8 @@ follow_fork (void)
 
       /* Check if we switched over from WAIT_PTID, since the event was
 	 reported.  */
-      if (!ptid_equal (wait_ptid, minus_one_ptid)
-	  && !ptid_equal (inferior_ptid, wait_ptid))
+      if (wait_ptid != minus_one_ptid
+	  && inferior_ptid != wait_ptid)
 	{
 	  /* We did.  Switch back to WAIT_PTID thread, to tell the
 	     target to follow it (in either direction).  We'll
@@ -1129,7 +1129,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
      stop provides a nicer sequence of events for user and MI
      notifications.  */
   ALL_THREADS_SAFE (th, tmp)
-    if (th->ptid.pid () == pid && !ptid_equal (th->ptid, ptid))
+    if (th->ptid.pid () == pid && th->ptid != ptid)
       delete_thread (th->ptid);
 
   /* We also need to clear any left over stale state for the
@@ -1542,7 +1542,7 @@ displaced_step_in_progress_any_inferior (void)
   for (state = displaced_step_inferior_states;
        state != NULL;
        state = state->next)
-    if (!ptid_equal (state->step_ptid, null_ptid))
+    if (state->step_ptid != null_ptid)
       return 1;
 
   return 0;
@@ -1556,11 +1556,11 @@ displaced_step_in_progress_thread (ptid_t ptid)
 {
   struct displaced_step_inferior_state *displaced;
 
-  gdb_assert (!ptid_equal (ptid, null_ptid));
+  gdb_assert (ptid != null_ptid);
 
   displaced = get_displaced_stepping_state (ptid.pid ());
 
-  return (displaced != NULL && ptid_equal (displaced->step_ptid, ptid));
+  return (displaced != NULL && displaced->step_ptid == ptid);
 }
 
 /* Return true if process PID has a thread doing a displaced step.  */
@@ -1571,7 +1571,7 @@ displaced_step_in_progress (int pid)
   struct displaced_step_inferior_state *displaced;
 
   displaced = get_displaced_stepping_state (pid);
-  if (displaced != NULL && !ptid_equal (displaced->step_ptid, null_ptid))
+  if (displaced != NULL && displaced->step_ptid != null_ptid)
     return 1;
 
   return 0;
@@ -1611,7 +1611,7 @@ get_displaced_step_closure_by_addr (CORE_ADDR addr)
     = get_displaced_stepping_state (inferior_ptid.pid ());
 
   /* If checking the mode of displaced instruction in copy area.  */
-  if (displaced && !ptid_equal (displaced->step_ptid, null_ptid)
+  if (displaced && displaced->step_ptid != null_ptid
      && (displaced->step_copy == addr))
     return displaced->step_closure;
 
@@ -1777,7 +1777,7 @@ displaced_step_prepare_throw (ptid_t ptid)
 
   displaced = add_displaced_stepping_state (ptid.pid ());
 
-  if (!ptid_equal (displaced->step_ptid, null_ptid))
+  if (displaced->step_ptid != null_ptid)
     {
       /* Already waiting for a displaced step to finish.  Defer this
 	 request and place in queue.  */
@@ -1972,8 +1972,8 @@ displaced_step_fixup (ptid_t event_ptid, enum gdb_signal signal)
     return 0;
 
   /* Was this event for the pid we displaced?  */
-  if (ptid_equal (displaced->step_ptid, null_ptid)
-      || ! ptid_equal (displaced->step_ptid, event_ptid))
+  if (displaced->step_ptid == null_ptid
+      || displaced->step_ptid != event_ptid)
     return 0;
 
   old_cleanups = make_cleanup (displaced_step_clear_cleanup, displaced);
@@ -2177,14 +2177,14 @@ infrun_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
 {
   struct displaced_step_inferior_state *displaced;
 
-  if (ptid_equal (inferior_ptid, old_ptid))
+  if (inferior_ptid == old_ptid)
     inferior_ptid = new_ptid;
 
   for (displaced = displaced_step_inferior_states;
        displaced;
        displaced = displaced->next)
     {
-      if (ptid_equal (displaced->step_ptid, old_ptid))
+      if (displaced->step_ptid == old_ptid)
 	displaced->step_ptid = new_ptid;
     }
 }
@@ -2892,7 +2892,7 @@ clear_proceed_status (int step)
 	}
     }
 
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       struct inferior *inferior;
 
@@ -3345,7 +3345,7 @@ infrun_thread_stop_requested (ptid_t ptid)
 static void
 infrun_thread_thread_exit (struct thread_info *tp, int silent)
 {
-  if (ptid_equal (target_last_wait_ptid, tp->ptid))
+  if (target_last_wait_ptid == tp->ptid)
     nullify_last_target_wait_ptid ();
 }
 
@@ -3370,7 +3370,7 @@ typedef void (*for_each_just_stopped_thread_callback_func)
 static void
 for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func)
 {
-  if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid))
+  if (!target_has_execution || inferior_ptid == null_ptid)
     return;
 
   if (target_is_non_stop_p ())
@@ -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 ())
+  if (ptid == minus_one_ptid || ptid.is_pid ())
     {
       tp = random_pending_event_thread (ptid);
     }
@@ -3637,7 +3637,7 @@ prepare_for_detach (void)
 
   /* Is any thread of this process displaced stepping?  If not,
      there's nothing else to do.  */
-  if (displaced == NULL || ptid_equal (displaced->step_ptid, null_ptid))
+  if (displaced == NULL || displaced->step_ptid == null_ptid)
     return;
 
   if (debug_infrun)
@@ -3646,7 +3646,7 @@ prepare_for_detach (void)
 
   scoped_restore restore_detaching = make_scoped_restore (&inf->detaching, true);
 
-  while (!ptid_equal (displaced->step_ptid, null_ptid))
+  while (displaced->step_ptid != null_ptid)
     {
       struct execution_control_state ecss;
       struct execution_control_state *ecs;
@@ -3990,7 +3990,7 @@ fetch_inferior_event (void *client_data)
 
   if (cmd_done
       && exec_done_display_p
-      && (ptid_equal (inferior_ptid, null_ptid)
+      && (inferior_ptid == null_ptid
 	  || !is_running (inferior_ptid)))
     printf_unfiltered (_("completed.\n"));
 }
@@ -4051,7 +4051,7 @@ nullify_last_target_wait_ptid (void)
 static void
 context_switch (ptid_t ptid)
 {
-  if (debug_infrun && !ptid_equal (ptid, inferior_ptid))
+  if (debug_infrun && ptid != inferior_ptid)
     {
       fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ",
 			  target_pid_to_str (inferior_ptid));
@@ -4253,7 +4253,7 @@ handle_syscall_event (struct execution_control_state *ecs)
   struct regcache *regcache;
   int syscall_number;
 
-  if (!ptid_equal (ecs->ptid, inferior_ptid))
+  if (ecs->ptid != inferior_ptid)
     context_switch (ecs->ptid);
 
   regcache = get_thread_regcache (ecs->ptid);
@@ -4940,7 +4940,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
     case TARGET_WAITKIND_LOADED:
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_LOADED\n");
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
       /* Ignore gracefully during startup of the inferior, as it might
          be the shell which has just loaded some objects, otherwise
@@ -5021,7 +5021,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
         fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SPURIOUS\n");
       if (handle_stop_requested (ecs))
 	return;
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
       resume (GDB_SIGNAL_0);
       prepare_to_wait (ecs);
@@ -5032,7 +5032,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
         fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_CREATED\n");
       if (handle_stop_requested (ecs))
 	return;
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
       if (!switch_back_to_stepped_thread (ecs))
 	keep_going (ecs);
@@ -5181,7 +5181,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
 	  }
       }
 
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
 
       /* Immediately detach breakpoints from the child before there's
@@ -5288,7 +5288,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
 	fprintf_unfiltered (gdb_stdlog,
 			    "infrun: TARGET_WAITKIND_VFORK_DONE\n");
 
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
 
       current_inferior ()->waiting_for_vfork_done = 0;
@@ -5309,7 +5309,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
       /* Note we can't read registers yet (the stop_pc), because we
 	 don't yet know the inferior's post-exec architecture.
 	 'stop_pc' is explicitly read below instead.  */
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	switch_to_thread_no_regs (ecs->event_thread);
 
       /* Do whatever is necessary to the parent branch of the vfork.  */
@@ -5385,7 +5385,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
       /* Reverse execution: target ran out of history info.  */
 
       /* Switch to the stopped thread.  */
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: stopped\n");
@@ -5716,7 +5716,7 @@ handle_signal_stop (struct execution_control_state *ecs)
   stop_soon = get_inferior_stop_soon (ecs->ptid);
   if (stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_REMOTE)
     {
-      if (!ptid_equal (ecs->ptid, inferior_ptid))
+      if (ecs->ptid != inferior_ptid)
 	context_switch (ecs->ptid);
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n");
@@ -5758,7 +5758,7 @@ handle_signal_stop (struct execution_control_state *ecs)
 
   /* See if something interesting happened to the non-current thread.  If
      so, then switch to that thread.  */
-  if (!ptid_equal (ecs->ptid, inferior_ptid))
+  if (ecs->ptid != inferior_ptid)
     {
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: context switch\n");
@@ -7680,7 +7680,7 @@ stop_waiting (struct execution_control_state *ecs)
 static void
 keep_going_pass_signal (struct execution_control_state *ecs)
 {
-  gdb_assert (ptid_equal (ecs->event_thread->ptid, inferior_ptid));
+  gdb_assert (ecs->event_thread->ptid == inferior_ptid);
   gdb_assert (!ecs->event_thread->resumed);
 
   /* Save the pc before execution, to compare with pc after stop.  */
@@ -8131,7 +8131,7 @@ save_stop_context (void)
   sc->ptid = inferior_ptid;
   sc->inf_num = current_inferior ()->num;
 
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       /* Take a strong reference so that the thread can't be deleted
 	 yet.  */
@@ -8163,7 +8163,7 @@ release_stop_context_cleanup (void *arg)
 static int
 stop_context_changed (struct stop_context *prev)
 {
-  if (!ptid_equal (prev->ptid, inferior_ptid))
+  if (prev->ptid != inferior_ptid)
     return 1;
   if (prev->inf_num != current_inferior ()->num)
     return 1;
@@ -8344,7 +8344,7 @@ normal_stop (void)
 
   /* Notify observers about the stop.  This is where the interpreters
      print the stop event.  */
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     gdb::observers::normal_stop.notify (inferior_thread ()->control.stop_bpstat,
 				 stop_print_frame);
   else
@@ -8796,7 +8796,7 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
 		    void *ignore)
 {
   if (target_has_stack
-      && !ptid_equal (inferior_ptid, null_ptid)
+      && inferior_ptid != null_ptid
       && gdbarch_get_siginfo_type_p (gdbarch))
     {
       struct type *type = gdbarch_get_siginfo_type (gdbarch);
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 4049021d26..25c716bb53 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -144,7 +144,7 @@ delete_fork (ptid_t ptid)
   linux_target->low_forget_process (ptid.pid ());
 
   for (fp = fork_list; fp; fpprev = fp, fp = fp->next)
-    if (ptid_equal (fp->ptid, ptid))
+    if (fp->ptid == ptid)
       break;
 
   if (!fp)
@@ -162,7 +162,7 @@ delete_fork (ptid_t ptid)
      remove it, leaving the list empty -- we're now down to the
      default case of debugging a single process.  */
   if (fork_list != NULL && fork_list->next == NULL &&
-      ptid_equal (fork_list->ptid, inferior_ptid))
+      fork_list->ptid == inferior_ptid)
     {
       /* Last fork -- delete from list and handle as solo process
 	 (should be a safe recursion).  */
@@ -177,7 +177,7 @@ find_fork_ptid (ptid_t ptid)
   struct fork_info *fp;
 
   for (fp = fork_list; fp; fp = fp->next)
-    if (ptid_equal (fp->ptid, ptid))
+    if (fp->ptid == ptid)
       return fp;
 
   return NULL;
@@ -461,7 +461,7 @@ inferior_call_waitpid (ptid_t pptid, int pid)
   struct cleanup *old_cleanup;
   int ret = -1;
 
-  if (!ptid_equal (pptid, inferior_ptid))
+  if (pptid != inferior_ptid)
     {
       /* Switch to pptid.  */
       oldfp = find_fork_ptid (inferior_ptid);
@@ -514,10 +514,10 @@ delete_checkpoint_command (const char *args, int from_tty)
     error (_("Requires argument (checkpoint id to delete)"));
 
   ptid = fork_id_to_ptid (parse_and_eval_long (args));
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     error (_("No such checkpoint id, %s"), args);
 
-  if (ptid_equal (ptid, inferior_ptid))
+  if (ptid == inferior_ptid)
     error (_("\
 Please switch to another checkpoint before deleting the current one"));
 
@@ -554,10 +554,10 @@ detach_checkpoint_command (const char *args, int from_tty)
     error (_("Requires argument (checkpoint id to detach)"));
 
   ptid = fork_id_to_ptid (parse_and_eval_long (args));
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     error (_("No such checkpoint id, %s"), args);
 
-  if (ptid_equal (ptid, inferior_ptid))
+  if (ptid == inferior_ptid)
     error (_("\
 Please switch to another checkpoint before detaching the current one"));
 
@@ -591,7 +591,7 @@ info_checkpoints_command (const char *arg, int from_tty)
 	continue;
 
       printed = fp;
-      if (ptid_equal (fp->ptid, inferior_ptid))
+      if (fp->ptid == inferior_ptid)
 	printf_filtered ("* ");
       else
 	printf_filtered ("  ");
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 29a8612f12..57611bd7e0 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)
 			target_pid_to_str (inferior_ptid));
 
   /* A specific PTID means `step only this process id'.  */
-  resume_many = (ptid_equal (minus_one_ptid, ptid)
+  resume_many = (minus_one_ptid == ptid
 		 || ptid.is_pid ());
 
   /* Mark the lwps we're resuming as resumed.  */
@@ -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 ())
+  if (ptid == minus_one_ptid || ptid.is_pid ())
     select_event_lwp (ptid, &lp, &status);
 
   gdb_assert (lp != NULL);
@@ -3577,7 +3577,7 @@ linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
   if (target_is_async_p ()
       && ((ourstatus->kind != TARGET_WAITKIND_IGNORE
 	   && ourstatus->kind != TARGET_WAITKIND_NO_RESUMED)
-	  || !ptid_equal (ptid, minus_one_ptid)))
+	  || ptid != minus_one_ptid))
     async_file_mark ();
 
   return event_ptid;
@@ -3851,7 +3851,7 @@ linux_nat_target::xfer_partial (enum target_object object,
   /* The target is connected but no live inferior is selected.  Pass
      this request down to a lower stratum (e.g., the executable
      file).  */
-  if (object == TARGET_OBJECT_MEMORY && ptid_equal (inferior_ptid, null_ptid))
+  if (object == TARGET_OBJECT_MEMORY && inferior_ptid == null_ptid)
     return TARGET_XFER_EOF;
 
   if (object == TARGET_OBJECT_AUXV)
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 20fe6c95a0..593ff1f322 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1788,7 +1788,7 @@ thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 {
   struct thread_db_info *info;
 
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     info = get_thread_db_info (inferior_ptid.pid ());
   else
     info = get_thread_db_info (ptid.pid ());
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 38c59c7e66..670b5e59aa 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -605,7 +605,7 @@ mi_cmd_var_update_iter (struct varobj *var, void *data_pointer)
   thread_id = varobj_get_thread_id (var);
 
   if (thread_id == -1
-      && (ptid_equal (inferior_ptid, null_ptid)
+      && (inferior_ptid == null_ptid
 	  || is_stopped (inferior_ptid)))
     thread_stopped = 1;
   else
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index dcfee30907..d58d1a4527 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -688,7 +688,7 @@ mi_about_to_proceed (void)
 {
   /* Suppress output while calling an inferior function.  */
 
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       struct thread_info *tp = inferior_thread ();
 
@@ -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 ())
+  if (ptid == minus_one_ptid || ptid.is_pid ())
     tp = inferior_thread ();
   else
     tp = find_thread_ptid (ptid);
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 10d886ced9..da26e65df6 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -571,7 +571,7 @@ mi_cmd_thread_select (const char *command, char **argv, int argc)
 			       USER_SELECTED_THREAD | USER_SELECTED_FRAME);
 
   /* Notify if the thread has effectively changed.  */
-  if (!ptid_equal (inferior_ptid, previous_ptid))
+  if (inferior_ptid != previous_ptid)
     {
       gdb::observers::user_selected_context_changed.notify
 	(USER_SELECTED_THREAD | USER_SELECTED_FRAME);
@@ -2006,11 +2006,11 @@ mi_execute_command (const char *cmd, int from_tty)
 
 	  if (command->thread == -1)
 	    {
-	      report_change = (!ptid_equal (previous_ptid, null_ptid)
-			       && !ptid_equal (inferior_ptid, previous_ptid)
-			       && !ptid_equal (inferior_ptid, null_ptid));
+	      report_change = (previous_ptid != null_ptid
+			       && inferior_ptid != previous_ptid
+			       && inferior_ptid != null_ptid);
 	    }
-	  else if (!ptid_equal (inferior_ptid, null_ptid))
+	  else if (inferior_ptid != null_ptid)
 	    {
 	      struct thread_info *ti = inferior_thread ();
 
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index d140068c05..117edb161c 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -810,7 +810,7 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
   ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     {
       ourstatus->kind = TARGET_WAITKIND_STOPPED;
       ourstatus->value.sig = GDB_SIGNAL_0;
@@ -1079,10 +1079,10 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
   procfs_status status;
   sigset_t *run_fault = (sigset_t *) (void *) &run.fault;
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return;
 
-  procfs_set_thread (ptid_equal (ptid, minus_one_ptid) ? inferior_ptid :
+  procfs_set_thread (ptid == minus_one_ptid ? inferior_ptid :
 		     ptid);
 
   run.flags = _DEBUG_RUN_FAULT | _DEBUG_RUN_TRACE;
@@ -1135,7 +1135,7 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 void
 nto_procfs_target::mourn_inferior ()
 {
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0);
       close (ctl_fd);
@@ -1395,7 +1395,7 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
   char *data;
   ptid_t ptid = regcache->ptid ();
 
-  if (ptid_equal (ptid, null_ptid))
+  if (ptid == null_ptid)
     return;
   procfs_set_thread (ptid);
 
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index f26882fe3c..82fed3f0eb 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1269,7 +1269,7 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
     return 0;
 
   /* Look up cached address of thread-local variable.  */
-  if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
+  if (spe_context_cache_ptid != inferior_ptid)
     {
       struct target_ops *target = current_top_target ();
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index aa4498af90..d799f5c2a1 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1336,7 +1336,7 @@ proc_set_current_signal (procinfo *pi, int signo)
 
   /* The pointer is just a type alias.  */
   get_last_target_status (&wait_ptid, &wait_status);
-  if (ptid_equal (wait_ptid, inferior_ptid)
+  if (wait_ptid == inferior_ptid
       && wait_status.kind == TARGET_WAITKIND_STOPPED
       && wait_status.value.sig == gdb_signal_from_host (signo)
       && proc_get_status (pi)
@@ -2525,7 +2525,7 @@ wait_again:
 	      /* Got this far without error: If retval isn't in the
 		 threads database, add it.  */
 	      if (retval.pid () > 0 &&
-		  !ptid_equal (retval, inferior_ptid) &&
+		  retval != inferior_ptid &&
 		  !in_thread_list (retval))
 		{
 		  /* We have a new thread.  We need to add it both to
@@ -2852,7 +2852,7 @@ unconditionally_kill_inferior (procinfo *pi)
 void
 procfs_target::kill ()
 {
-  if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */
+  if (inferior_ptid != null_ptid) /* ? */
     {
       /* Find procinfo for main process.  */
       procinfo *pi = find_procinfo (inferior_ptid.pid (), 0);
@@ -2870,7 +2870,7 @@ procfs_target::mourn_inferior ()
 {
   procinfo *pi;
 
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       /* Find procinfo for main process.  */
       pi = find_procinfo (inferior_ptid.pid (), 0);
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index c3aa62d350..95c8c13461 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -319,7 +319,7 @@ find_thread_object (ptid_t ptid)
 
   for (thread = ((inferior_object *)(inf_obj.get ()))->threads; thread;
        thread = thread->next)
-    if (ptid_equal (thread->thread_obj->thread->ptid, ptid))
+    if (thread->thread_obj->thread->ptid == ptid)
       return thread->thread_obj;
 
   return NULL;
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index d78df7f790..b5dc78ba6b 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -524,7 +524,7 @@ btpy_list_position (PyObject *self, PyObject *value)
   if (list_obj->element_type != Py_TYPE (value))
     return -1;
 
-  if (!ptid_equal (list_obj->ptid, obj->ptid))
+  if (list_obj->ptid != obj->ptid)
     return -1;
 
   if (index < list_obj->first || index > list_obj->last)
@@ -590,7 +590,7 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op)
   switch (op)
   {
     case Py_EQ:
-      if (ptid_equal (obj1->ptid, obj2->ptid)
+      if (obj1->ptid == obj2->ptid
 	  && obj1->element_type == obj2->element_type
 	  && obj1->first == obj2->first
 	  && obj1->last == obj2->last
@@ -600,7 +600,7 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op)
 	Py_RETURN_FALSE;
 
     case Py_NE:
-      if (!ptid_equal (obj1->ptid, obj2->ptid)
+      if (obj1->ptid != obj2->ptid
 	  || obj1->element_type != obj2->element_type
 	  || obj1->first != obj2->first
 	  || obj1->last != obj2->last
diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c
index 9437cfb12c..6815d72f43 100644
--- a/gdb/python/py-record.c
+++ b/gdb/python/py-record.c
@@ -405,7 +405,7 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op)
   switch (op)
   {
     case Py_EQ:
-      if (ptid_equal (obj1->ptid, obj2->ptid)
+      if (obj1->ptid == obj2->ptid
 	  && obj1->method == obj2->method
 	  && obj1->number == obj2->number)
 	Py_RETURN_TRUE;
@@ -413,7 +413,7 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op)
 	Py_RETURN_FALSE;
 
     case Py_NE:
-      if (!ptid_equal (obj1->ptid, obj2->ptid)
+      if (obj1->ptid != obj2->ptid
 	  || obj1->method != obj2->method
 	  || obj1->number != obj2->number)
 	Py_RETURN_TRUE;
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 0e6b9eb88c..8bd31a5a72 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -193,7 +193,7 @@ ravenscar_task_is_currently_active (ptid_t ptid)
   ptid_t active_task_ptid
     = ravenscar_active_task (ravenscar_get_thread_base_cpu (ptid));
 
-  return ptid_equal (ptid, active_task_ptid);
+  return ptid == active_task_ptid;
 }
 
 /* Return the CPU thread (as a ptid_t) on which the given ravenscar
@@ -235,7 +235,7 @@ ravenscar_update_inferior_ptid (void)
   /* Make sure we set base_ptid before calling ravenscar_active_task
      as the latter relies on it.  */
   inferior_ptid = ravenscar_active_task (base_cpu);
-  gdb_assert (!ptid_equal (inferior_ptid, null_ptid));
+  gdb_assert (inferior_ptid != null_ptid);
 
   /* The running thread may not have been added to
      system.tasking.debug's list yet; so ravenscar_update_thread_list
@@ -291,7 +291,7 @@ has_ravenscar_runtime (void)
 static int
 ravenscar_runtime_initialized (void)
 {
-  return (!(ptid_equal (ravenscar_active_task (1), null_ptid)));
+  return (!(ravenscar_active_task (1) == null_ptid));
 }
 
 /* Return the ID of the thread that is currently running.
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f1f2e9e176..03e7ae48d2 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -361,7 +361,7 @@ get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
 				 struct address_space *aspace)
 {
   for (const auto &regcache : regcache::current_regcache)
-    if (ptid_equal (regcache->ptid (), ptid) && regcache->arch () == gdbarch)
+    if (regcache->ptid () == ptid && regcache->arch () == gdbarch)
       return regcache;
 
   regcache *new_regcache = new regcache (gdbarch, aspace);
@@ -386,7 +386,7 @@ static struct gdbarch *current_thread_arch;
 struct regcache *
 get_thread_regcache (ptid_t ptid)
 {
-  if (!current_thread_arch || !ptid_equal (current_thread_ptid, ptid))
+  if (!current_thread_arch || current_thread_ptid != ptid)
     {
       current_thread_ptid = ptid;
       current_thread_arch = target_thread_architecture (ptid);
@@ -424,7 +424,7 @@ regcache::regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
 {
   for (auto &regcache : regcache::current_regcache)
     {
-      if (ptid_equal (regcache->ptid (), old_ptid))
+      if (regcache->ptid () == old_ptid)
 	regcache->set_ptid (new_ptid);
     }
 }
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index def1bd5830..6923024e68 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -660,7 +660,7 @@ gdbsim_target::create_inferior (const char *exec_file,
 			(exec_file ? exec_file : "(NULL)"),
 			args);
 
-  if (ptid_equal (inferior_ptid, sim_data->remote_sim_ptid))
+  if (inferior_ptid == sim_data->remote_sim_ptid)
     kill ();
   remove_breakpoints ();
   init_wait_for_inferior ();
@@ -925,7 +925,7 @@ gdbsim_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
 
   if (sim_data)
     gdbsim_resume_inferior (find_inferior_ptid (ptid), &rd);
-  else if (ptid_equal (ptid, minus_one_ptid))
+  else if (ptid == minus_one_ptid)
     iterate_over_inferiors (gdbsim_resume_inferior, &rd);
   else
     error (_("The program is not being run."));
@@ -1001,7 +1001,7 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options)
   /* This target isn't able to (yet) resume more than one inferior at a time.
      When ptid is minus_one_ptid, just use the current inferior.  If we're
      given an explicit pid, we'll try to find it and use that instead.  */
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     sim_data = get_sim_inferior_data (current_inferior (),
 				      SIM_INSTANCE_NEEDED);
   else
@@ -1296,7 +1296,7 @@ gdbsim_target::thread_alive (ptid_t ptid)
   if (sim_data == NULL)
     return false;
 
-  if (ptid_equal (ptid, sim_data->remote_sim_ptid))
+  if (ptid == sim_data->remote_sim_ptid)
     /* The simulators' task is always alive.  */
     return true;
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 2d748c7268..625bcf84ab 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2449,7 +2449,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing)
 	  return;
 	}
 
-      if (ptid_equal (magic_null_ptid, inferior_ptid))
+      if (magic_null_ptid == inferior_ptid)
 	{
 	  /* inferior_ptid is not set yet.  This can happen with the
 	     vRun -> remote_wait,"TAAthread:" path if the stub
@@ -2712,16 +2712,16 @@ remote_target::set_thread (ptid_t ptid, int gen)
   char *buf = rs->buf;
   char *endbuf = rs->buf + get_remote_packet_size ();
 
-  if (ptid_equal (state, ptid))
+  if (state == ptid)
     return;
 
   *buf++ = 'H';
   *buf++ = gen ? 'g' : 'c';
-  if (ptid_equal (ptid, magic_null_ptid))
+  if (ptid == magic_null_ptid)
     xsnprintf (buf, endbuf - buf, "0");
-  else if (ptid_equal (ptid, any_thread_ptid))
+  else if (ptid == any_thread_ptid)
     xsnprintf (buf, endbuf - buf, "0");
-  else if (ptid_equal (ptid, minus_one_ptid))
+  else if (ptid == minus_one_ptid)
     xsnprintf (buf, endbuf - buf, "-1");
   else
     write_ptid (buf, endbuf, ptid);
@@ -2776,7 +2776,7 @@ remote_target::set_general_process ()
 static int
 remote_thread_always_alive (ptid_t ptid)
 {
-  if (ptid_equal (ptid, magic_null_ptid))
+  if (ptid == magic_null_ptid)
     /* The main thread is always alive.  */
     return 1;
 
@@ -2971,7 +2971,7 @@ read_ptid (const char *buf, const char **obuf)
      what's in inferior_ptid, unless it's null at this point.  If so,
      then since there's no way to know the pid of the reported
      threads, use the magic number.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     pid = magic_null_ptid.pid ();
   else
     pid = inferior_ptid.pid ();
@@ -3838,7 +3838,7 @@ remote_target::extra_thread_info (thread_info *tp)
     internal_error (__FILE__, __LINE__,
 		    _("remote_threads_extra_info"));
 
-  if (ptid_equal (tp->ptid, magic_null_ptid)
+  if (tp->ptid == magic_null_ptid
       || (tp->ptid.pid () != 0 && tp->ptid.lwp () == 0))
     /* This is the main thread which was added by GDB.  The remote
        server doesn't know about it.  */
@@ -4269,7 +4269,7 @@ remote_target::get_current_thread (char *wait_status)
      this point.  */
   if (wait_status != NULL)
     ptid = stop_reply_extract_thread (wait_status);
-  if (ptid_equal (ptid, null_ptid))
+  if (ptid == null_ptid)
     ptid = remote_current_thread (inferior_ptid);
 
   return ptid;
@@ -4689,7 +4689,7 @@ remote_target::start_remote (int from_tty, int extended_p)
 	     multi-threaded program, this will ideally be the thread
 	     that last reported an event before GDB disconnected.  */
 	  inferior_ptid = get_current_thread (wait_status);
-	  if (ptid_equal (inferior_ptid, null_ptid))
+	  if (inferior_ptid == null_ptid)
 	    {
 	      /* Odd... The target was able to list threads, but not
 		 tell us which thread was current (no "thread"
@@ -6004,7 +6004,7 @@ remote_target::append_resumption (char *p, char *endp,
     {
       struct thread_info *tp;
 
-      if (ptid_equal (ptid, minus_one_ptid))
+      if (ptid == minus_one_ptid)
 	{
 	  /* If we don't know about the target thread's tid, then
 	     we're resuming magic_null_ptid (see caller).  */
@@ -6044,7 +6044,7 @@ remote_target::append_resumption (char *p, char *endp,
       p += xsnprintf (p, endp - p, ":");
       p = write_ptid (p, endp, nptid);
     }
-  else if (!ptid_equal (ptid, minus_one_ptid))
+  else if (ptid != minus_one_ptid)
     {
       p += xsnprintf (p, endp - p, ":");
       p = write_ptid (p, endp, ptid);
@@ -6078,7 +6078,7 @@ remote_target::append_pending_thread_resumptions (char *p, char *endp,
 
   ALL_NON_EXITED_THREADS (thread)
     if (thread->ptid.matches (ptid)
-	&& !ptid_equal (inferior_ptid, thread->ptid)
+	&& inferior_ptid != thread->ptid
 	&& thread->suspend.stop_signal != GDB_SIGNAL_0)
       {
 	p = append_resumption (p, endp, thread->ptid,
@@ -6106,7 +6106,7 @@ remote_target::remote_resume_with_hc (ptid_t ptid, int step,
 
   /* The c/s/C/S resume packets use Hc, so set the continue
      thread.  */
-  if (ptid_equal (ptid, minus_one_ptid))
+  if (ptid == minus_one_ptid)
     set_continue_thread (any_thread_ptid);
   else
     set_continue_thread (ptid);
@@ -6179,7 +6179,7 @@ remote_target::remote_resume_with_vcont (ptid_t ptid, int step,
 
   p += xsnprintf (p, endp - p, "vCont");
 
-  if (ptid_equal (ptid, magic_null_ptid))
+  if (ptid == magic_null_ptid)
     {
       /* MAGIC_NULL_PTID means that we don't have any active threads,
 	 so we don't have any TID numbers the inferior will
@@ -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 ())
+  else if (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 ())
+      if (minus_one_ptid == ptid || ptid.is_pid ())
 	remote_thr = get_remote_thread_info (inferior_ptid);
       else
 	remote_thr = get_remote_thread_info (ptid);
@@ -6606,7 +6606,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
   if (!rs->supports_vCont.t)
     error (_("Remote server does not support stopping threads"));
 
-  if (ptid_equal (ptid, minus_one_ptid)
+  if (ptid == minus_one_ptid
       || (!remote_multi_process_p (rs) && ptid.is_pid ()))
     p += xsnprintf (p, endp - p, "vCont;t");
   else
@@ -7541,7 +7541,7 @@ Packet: '%s'\n"),
       break;
     }
 
-  if (target_is_non_stop_p () && ptid_equal (event->ptid, null_ptid))
+  if (target_is_non_stop_p () && event->ptid == null_ptid)
     error (_("No process or thread specified in stop reply: %s"), buf);
 }
 
@@ -7645,7 +7645,7 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply,
 
   /* If no thread/process was reported by the stub, assume the current
      inferior.  */
-  if (ptid_equal (ptid, null_ptid))
+  if (ptid == null_ptid)
     ptid = inferior_ptid;
 
   if (status->kind != TARGET_WAITKIND_EXITED
@@ -7877,7 +7877,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status, int options)
   else if (status->kind != TARGET_WAITKIND_EXITED
 	   && status->kind != TARGET_WAITKIND_SIGNALLED)
     {
-      if (!ptid_equal (event_ptid, null_ptid))
+      if (event_ptid != null_ptid)
 	record_currthread (rs, event_ptid);
       else
 	event_ptid = inferior_ptid;
@@ -11442,7 +11442,7 @@ remote_target::pid_to_str (ptid_t ptid)
   static char buf[64];
   struct remote_state *rs = get_remote_state ();
 
-  if (ptid_equal (ptid, null_ptid))
+  if (ptid == null_ptid)
     return normal_pid_to_str (ptid);
   else if (ptid.is_pid ())
     {
@@ -11467,7 +11467,7 @@ remote_target::pid_to_str (ptid_t ptid)
     }
   else
     {
-      if (ptid_equal (magic_null_ptid, ptid))
+      if (magic_null_ptid == ptid)
 	xsnprintf (buf, sizeof buf, "Thread <main>");
       else if (remote_multi_process_p (rs))
 	if (ptid.lwp () == 0)
@@ -11649,7 +11649,7 @@ remote_target::read_description ()
 
   /* Do not try this during initial connection, when we do not know
      whether there is a running but stopped thread.  */
-  if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid))
+  if (!target_has_execution || inferior_ptid == null_ptid)
     return beneath ()->read_description ();
 
   if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 4bb9b34ae5..a5980f199e 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -461,7 +461,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
       /* See if we have a new thread.  */
       if (rtnval.tid_p ()
-	  && !ptid_equal (rtnval, save_ptid)
+	  && rtnval != save_ptid
 	  && (!in_thread_list (rtnval)
 	      || is_exited (rtnval)))
 	add_thread (rtnval);
diff --git a/gdb/solib.c b/gdb/solib.c
index 8f3a12cddb..e1d237e5a4 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -735,7 +735,7 @@ update_solib_list (int from_tty)
 
   /* We can reach here due to changing solib-search-path or the
      sysroot, before having any inferior.  */
-  if (target_has_execution && !ptid_equal (inferior_ptid, null_ptid))
+  if (target_has_execution && inferior_ptid != null_ptid)
     {
       struct inferior *inf = current_inferior ();
 
diff --git a/gdb/target.c b/gdb/target.c
index 278e9aa4b6..45cf6316f3 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -219,7 +219,7 @@ int
 default_child_has_all_memory ()
 {
   /* If no inferior selected, then we can't read memory here.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return 0;
 
   return 1;
@@ -229,7 +229,7 @@ int
 default_child_has_memory ()
 {
   /* If no inferior selected, then we can't read memory here.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return 0;
 
   return 1;
@@ -239,7 +239,7 @@ int
 default_child_has_stack ()
 {
   /* If no inferior selected, there's no stack.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return 0;
 
   return 1;
@@ -249,7 +249,7 @@ int
 default_child_has_registers ()
 {
   /* Can't read registers from no inferior.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     return 0;
 
   return 1;
@@ -260,7 +260,7 @@ default_child_has_execution (ptid_t the_ptid)
 {
   /* If there's no thread selected, then we can't make it run through
      hoops.  */
-  if (ptid_equal (the_ptid, null_ptid))
+  if (the_ptid == null_ptid)
     return 0;
 
   return 1;
@@ -1052,7 +1052,7 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
      first, so that if it fails, we don't write to the cache contents
      that never made it to the target.  */
   if (writebuf != NULL
-      && !ptid_equal (inferior_ptid, null_ptid)
+      && inferior_ptid != null_ptid
       && target_dcache_init_p ()
       && (stack_cache_enabled_p () || code_cache_enabled_p ()))
     {
@@ -1127,7 +1127,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
 				 &region))
     return TARGET_XFER_E_IO;
 
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     inf = find_inferior_ptid (inferior_ptid);
   else
     inf = NULL;
@@ -2230,7 +2230,7 @@ default_mourn_inferior (struct target_ops *self)
 void
 target_mourn_inferior (ptid_t ptid)
 {
-  gdb_assert (ptid_equal (ptid, inferior_ptid));
+  gdb_assert (ptid == inferior_ptid);
   current_top_target ()->mourn_inferior ();
 
   /* We no longer need to keep handles on any of the object files.
@@ -3262,7 +3262,7 @@ generic_mourn_inferior (void)
      fail, since the inferior is long gone).  */
   mark_breakpoints_out ();
 
-  if (!ptid_equal (ptid, null_ptid))
+  if (ptid != null_ptid)
     {
       int pid = ptid.pid ();
       exit_inferior (pid);
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 3667e40208..07767bbb82 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -72,7 +72,7 @@ tui_make_status_line (struct tui_locator_element *loc)
   int pid_width;
   int line_width;
 
-  if (ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid == null_ptid)
     pid_name = "No process";
   else
     pid_name = target_pid_to_str (inferior_ptid);
diff --git a/gdb/varobj.c b/gdb/varobj.c
index a0df485ae9..1ee11051ef 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2124,7 +2124,7 @@ value_of_root_1 (struct varobj **var_handle)
     {
       ptid_t ptid = global_thread_id_to_ptid (var->root->thread_id);
 
-      if (!ptid_equal (minus_one_ptid, ptid))
+      if (minus_one_ptid != ptid)
 	{
 	  switch_to_thread (ptid);
 	  within_scope = check_scope (var);
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 08652a6754..9f594d806c 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1364,7 +1364,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
   DWORD continue_status = DBG_CONTINUE;
 
   /* A specific PTID means `step only this thread id'.  */
-  int resume_all = ptid_equal (ptid, minus_one_ptid);
+  int resume_all = ptid == minus_one_ptid;
 
   /* If we're continuing all threads, it's the current inferior that
      should be handled specially.  */
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 430d44b2ed..41b9948f6d 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -279,7 +279,7 @@ static const struct lval_funcs tlb_value_funcs =
 static struct value *
 tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
 {
-  if (target_has_stack && !ptid_equal (inferior_ptid, null_ptid))
+  if (target_has_stack && inferior_ptid != null_ptid)
     {
       struct type *type = windows_get_tlb_type (gdbarch);
       return allocate_computed_value (type, &tlb_value_funcs, NULL);
@@ -367,7 +367,7 @@ display_one_tib (ptid_t ptid)
 static void
 display_tib (const char * args, int from_tty)
 {
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     display_one_tib (inferior_ptid);
 }
 
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 08/10] Remove ptid_tid_p
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
  2018-06-13 21:51 ` [RFA 07/10] Remove ptid_lwp_p Tom Tromey
  2018-06-13 21:51 ` [RFA 10/10] Remove ptid_equal Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 09/10] Remove ptid_match Tom Tromey
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_tid_p in favor of the ptid_t::tid_p method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_tid_p): Remove.
	* common/ptid.h (ptid_tid_p): Don't declare.
	* sol-thread.c: Update.
---
 gdb/ChangeLog     |  6 ++++++
 gdb/common/ptid.c |  8 --------
 gdb/common/ptid.h |  4 ----
 gdb/sol-thread.c  | 16 ++++++++--------
 4 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ea3bb2c467..243d74fd9c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (ptid_tid_p): Remove.
+	* common/ptid.h (ptid_tid_p): Don't declare.
+	* sol-thread.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.c (ptid_lwp_p): Remove.
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 9bf6e2d9a9..e0f62b10f1 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_tid_p (const ptid_t &ptid)
-{
-  return ptid.tid_p ();
-}
-
-/* See ptid.h.  */
-
 int
 ptid_match (const ptid_t &ptid, const ptid_t &filter)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 8830dce2dc..86878de905 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::tid_p.  */
-
-extern int ptid_tid_p (const ptid_t &ptid);
-
 /* See ptid_t::matches.  */
 
 extern int ptid_match (const ptid_t &ptid, const ptid_t &filter);
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index bb73c4a031..4bb9b34ae5 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -340,7 +340,7 @@ lwp_to_thread (ptid_t lwp)
   td_thrhandle_t th;
   td_err_e val;
 
-  if (ptid_tid_p (lwp))
+  if (lwp.tid_p ())
     return lwp;			/* It's already a thread ID.  */
 
   /* It's an LWP.  Convert it to a thread ID.  */
@@ -460,7 +460,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	rtnval = save_ptid;
 
       /* See if we have a new thread.  */
-      if (ptid_tid_p (rtnval)
+      if (rtnval.tid_p ()
 	  && !ptid_equal (rtnval, save_ptid)
 	  && (!in_thread_list (rtnval)
 	      || is_exited (rtnval)))
@@ -486,7 +486,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
   gdb_fpregset_t *fpregset_p = &fpregset;
   ptid_t ptid = regcache->ptid ();
 
-  if (!ptid_tid_p (ptid))
+  if (!ptid.tid_p ())
     {
       /* It's an LWP; pass the request on to the layer beneath.  */
       beneath ()->fetch_registers (regcache, regnum);
@@ -538,7 +538,7 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
   prfpregset_t fpregset;
   ptid_t ptid = regcache->ptid ();
 
-  if (!ptid_tid_p (ptid))
+  if (!ptid.tid_p ())
     {
       /* It's an LWP; pass the request on to the layer beneath.  */
       beneath ()->store_registers (regcache, regnum);
@@ -591,7 +591,7 @@ sol_thread_target::xfer_partial (enum target_object object,
 {
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
-  if (ptid_tid_p (inferior_ptid) || !target_thread_alive (inferior_ptid))
+  if (inferior_ptid.tid_p () || !target_thread_alive (inferior_ptid))
     {
       /* It's either a thread or an LWP that isn't alive.  Any live
          LWP will do so use the first available.
@@ -697,7 +697,7 @@ sol_thread_target::mourn_inferior ()
 bool
 sol_thread_target::thread_alive (ptid_t ptid)
 {
-  if (ptid_tid_p (ptid))
+  if (ptid.tid_p ())
     {
       /* It's a (user-level) thread.  */
       td_err_e val;
@@ -785,7 +785,7 @@ rw_common (int dowrite, const struct ps_prochandle *ph, psaddr_t addr,
 
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
-  if (ptid_tid_p (inferior_ptid) || !target_thread_alive (inferior_ptid))
+  if (inferior_ptid.tid_p () || !target_thread_alive (inferior_ptid))
     {
       /* It's either a thread or an LWP that isn't alive.  Any live
          LWP will do so use the first available.
@@ -1003,7 +1003,7 @@ sol_thread_target::pid_to_str (ptid_t ptid)
 {
   static char buf[100];
 
-  if (ptid_tid_p (ptid))
+  if (ptid.tid_p ())
     {
       ptid_t lwp;
 
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 06/10] Remove ptid_is_pid
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (3 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 09/10] Remove ptid_match Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 03/10] Remove ptid_get_pid Tom Tromey
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_is_pid in favor of the ptid_t::is_pid method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* 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  <tom@tromey.com>

	* 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  <tom@tromey.com>
+
+	* 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  <tom@tromey.com>
 
 	* 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  <tom@tromey.com>
+
+	* linux-low.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* 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)
 	{
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFA 03/10] Remove ptid_get_pid
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (4 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 06/10] Remove ptid_is_pid Tom Tromey
@ 2018-06-13 21:51 ` Tom Tromey
  2018-06-13 21:51 ` [RFA 05/10] Remove ptid_get_tid Tom Tromey
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-06-13 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This removes ptid_get_pid in favor of calling the ptid_t::pid method.

ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_get_pid): Remove.
	* common/ptid.h (ptid_get_pid): Don't declare.
	* aarch64-linux-nat.c: Update.
	* ada-lang.c: Update.
	* aix-thread.c: Update.
	* alpha-bsd-nat.c: Update.
	* amd64-fbsd-nat.c: Update.
	* amd64-linux-nat.c: Update.
	* arm-linux-nat.c: Update.
	* arm-nbsd-nat.c: Update.
	* auxv.c: Update.
	* break-catch-syscall.c: Update.
	* breakpoint.c: Update.
	* bsd-uthread.c: Update.
	* corelow.c: Update.
	* ctf.c: Update.
	* darwin-nat.c: Update.
	* fbsd-nat.c: Update.
	* fbsd-tdep.c: Update.
	* gcore.c: Update.
	* gnu-nat.c: Update.
	* hppa-nbsd-nat.c: Update.
	* hppa-obsd-nat.c: Update.
	* i386-fbsd-nat.c: Update.
	* ia64-linux-nat.c: Update.
	* inf-ptrace.c: Update.
	* infcmd.c: Update.
	* inferior.c: Update.
	* inferior.h: Update.
	* inflow.c: Update.
	* infrun.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-tdep.c: Update.
	* linux-thread-db.c: Update.
	* m68k-bsd-nat.c: Update.
	* mi/mi-interp.c: Update.
	* mi/mi-main.c: Update.
	* mips-linux-nat.c: Update.
	* mips-nbsd-nat.c: Update.
	* mips64-obsd-nat.c: Update.
	* nat/aarch64-linux-hw-point.c: Update.
	* nat/aarch64-linux.c: Update.
	* nat/linux-btrace.c: Update.
	* nat/linux-osdata.c: Update.
	* nat/linux-procfs.c: Update.
	* nat/x86-linux-dregs.c: Update.
	* nto-procfs.c: Update.
	* obsd-nat.c: Update.
	* ppc-linux-nat.c: Update.
	* ppc-nbsd-nat.c: Update.
	* ppc-obsd-nat.c: Update.
	* proc-service.c: Update.
	* procfs.c: Update.
	* python/py-inferior.c: Update.
	* python/py-infthread.c: Update.
	* ravenscar-thread.c: Update.
	* record.c: Update.
	* remote-sim.c: Update.
	* remote.c: Update.
	* rs6000-nat.c: Update.
	* s390-linux-nat.c: Update.
	* sh-nbsd-nat.c: Update.
	* sol-thread.c: Update.
	* sparc-nat.c: Update.
	* sparc64-tdep.c: Update.
	* spu-linux-nat.c: Update.
	* spu-tdep.c: Update.
	* target-debug.h: Update.
	* target.c: Update.
	* thread.c: Update.
	* tid-parse.c: Update.
	* tracefile-tfile.c: Update.
	* vax-bsd-nat.c: Update.
	* windows-nat.c: Update.
	* x86-linux-nat.c: Update.
	* x86-nat.c: Update.

gdbserver/ChangeLog
2018-06-13  Tom Tromey  <tom@tromey.com>

	* linux-low.c: Update.
	* linux-mips-low.c: Update.
	* lynx-low.c: Update.
	* mem-break.c: Update.
	* nto-low.c: Update.
	* remote-utils.c: Update.
	* server.c: Update.
	* spu-low.c: Update.
	* target.c: Update.
	* tracepoint.c: Update.
---
 gdb/ChangeLog                    | 80 ++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-linux-nat.c          | 16 ++++----
 gdb/ada-lang.c                   |  2 +-
 gdb/aix-thread.c                 | 20 +++++-----
 gdb/alpha-bsd-nat.c              | 12 +++---
 gdb/amd64-fbsd-nat.c             |  4 +-
 gdb/amd64-linux-nat.c            |  4 +-
 gdb/arm-linux-nat.c              | 10 ++---
 gdb/arm-nbsd-nat.c               | 20 +++++-----
 gdb/auxv.c                       |  2 +-
 gdb/break-catch-syscall.c        |  4 +-
 gdb/breakpoint.c                 | 22 +++++------
 gdb/bsd-uthread.c                |  6 +--
 gdb/common/ptid.c                |  8 ----
 gdb/common/ptid.h                |  4 --
 gdb/corelow.c                    |  2 +-
 gdb/ctf.c                        |  2 +-
 gdb/darwin-nat.c                 | 12 +++---
 gdb/fbsd-nat.c                   | 30 +++++++--------
 gdb/fbsd-tdep.c                  |  4 +-
 gdb/gcore.c                      |  2 +-
 gdb/gdbserver/ChangeLog          | 13 +++++++
 gdb/gdbserver/linux-low.c        |  8 ++--
 gdb/gdbserver/linux-mips-low.c   |  2 +-
 gdb/gdbserver/lynx-low.c         |  4 +-
 gdb/gdbserver/mem-break.c        |  2 +-
 gdb/gdbserver/nto-low.c          |  8 ++--
 gdb/gdbserver/remote-utils.c     |  6 +--
 gdb/gdbserver/server.c           |  8 ++--
 gdb/gdbserver/spu-low.c          |  2 +-
 gdb/gdbserver/target.c           |  8 ++--
 gdb/gdbserver/tracepoint.c       |  2 +-
 gdb/gnu-nat.c                    |  2 +-
 gdb/hppa-nbsd-nat.c              |  4 +-
 gdb/hppa-obsd-nat.c              |  2 +-
 gdb/i386-fbsd-nat.c              |  6 +--
 gdb/ia64-linux-nat.c             |  2 +-
 gdb/inf-ptrace.c                 | 22 +++++------
 gdb/infcmd.c                     | 10 ++---
 gdb/inferior.c                   |  8 ++--
 gdb/inferior.h                   |  2 +-
 gdb/inflow.c                     |  2 +-
 gdb/infrun.c                     | 52 +++++++++++++-------------
 gdb/linux-fork.c                 | 28 +++++++-------
 gdb/linux-nat.c                  | 64 ++++++++++++++++----------------
 gdb/linux-tdep.c                 |  6 +--
 gdb/linux-thread-db.c            | 36 +++++++++---------
 gdb/m68k-bsd-nat.c               |  4 +-
 gdb/mi/mi-interp.c               |  4 +-
 gdb/mi/mi-main.c                 | 10 ++---
 gdb/mips-linux-nat.c             |  2 +-
 gdb/mips-nbsd-nat.c              |  4 +-
 gdb/mips64-obsd-nat.c            |  4 +-
 gdb/nat/aarch64-linux-hw-point.c |  2 +-
 gdb/nat/aarch64-linux.c          |  2 +-
 gdb/nat/linux-btrace.c           |  4 +-
 gdb/nat/linux-osdata.c           |  2 +-
 gdb/nat/linux-procfs.c           |  4 +-
 gdb/nat/x86-linux-dregs.c        |  6 +--
 gdb/nto-procfs.c                 | 22 +++++------
 gdb/obsd-nat.c                   |  8 ++--
 gdb/ppc-linux-nat.c              |  8 ++--
 gdb/ppc-nbsd-nat.c               |  4 +-
 gdb/ppc-obsd-nat.c               |  4 +-
 gdb/proc-service.c               | 10 ++---
 gdb/procfs.c                     | 74 ++++++++++++++++++-------------------
 gdb/python/py-inferior.c         |  4 +-
 gdb/python/py-infthread.c        |  4 +-
 gdb/ravenscar-thread.c           |  6 +--
 gdb/record.c                     |  2 +-
 gdb/remote-sim.c                 |  6 +--
 gdb/remote.c                     | 44 +++++++++++-----------
 gdb/rs6000-nat.c                 | 12 +++---
 gdb/s390-linux-nat.c             | 18 ++++-----
 gdb/sh-nbsd-nat.c                |  4 +-
 gdb/sol-thread.c                 | 50 ++++++++++++-------------
 gdb/sparc-nat.c                  |  2 +-
 gdb/sparc64-tdep.c               | 22 +++++------
 gdb/spu-linux-nat.c              | 16 ++++----
 gdb/spu-tdep.c                   |  4 +-
 gdb/target-debug.h               |  2 +-
 gdb/target.c                     | 10 ++---
 gdb/thread.c                     | 24 ++++++------
 gdb/tid-parse.c                  |  2 +-
 gdb/tracefile-tfile.c            |  2 +-
 gdb/vax-bsd-nat.c                |  4 +-
 gdb/windows-nat.c                |  8 ++--
 gdb/x86-linux-nat.c              |  4 +-
 gdb/x86-nat.c                    | 18 ++++-----
 89 files changed, 551 insertions(+), 470 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 43061b54c7..5b51879476 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,83 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* common/ptid.c (ptid_get_pid): Remove.
+	* common/ptid.h (ptid_get_pid): Don't declare.
+	* aarch64-linux-nat.c: Update.
+	* ada-lang.c: Update.
+	* aix-thread.c: Update.
+	* alpha-bsd-nat.c: Update.
+	* amd64-fbsd-nat.c: Update.
+	* amd64-linux-nat.c: Update.
+	* arm-linux-nat.c: Update.
+	* arm-nbsd-nat.c: Update.
+	* auxv.c: Update.
+	* break-catch-syscall.c: Update.
+	* breakpoint.c: Update.
+	* bsd-uthread.c: Update.
+	* corelow.c: Update.
+	* ctf.c: Update.
+	* darwin-nat.c: Update.
+	* fbsd-nat.c: Update.
+	* fbsd-tdep.c: Update.
+	* gcore.c: Update.
+	* gnu-nat.c: Update.
+	* hppa-nbsd-nat.c: Update.
+	* hppa-obsd-nat.c: Update.
+	* i386-fbsd-nat.c: Update.
+	* ia64-linux-nat.c: Update.
+	* inf-ptrace.c: Update.
+	* infcmd.c: Update.
+	* inferior.c: Update.
+	* inferior.h: Update.
+	* inflow.c: Update.
+	* infrun.c: Update.
+	* linux-fork.c: Update.
+	* linux-nat.c: Update.
+	* linux-tdep.c: Update.
+	* linux-thread-db.c: Update.
+	* m68k-bsd-nat.c: Update.
+	* mi/mi-interp.c: Update.
+	* mi/mi-main.c: Update.
+	* mips-linux-nat.c: Update.
+	* mips-nbsd-nat.c: Update.
+	* mips64-obsd-nat.c: Update.
+	* nat/aarch64-linux-hw-point.c: Update.
+	* nat/aarch64-linux.c: Update.
+	* nat/linux-btrace.c: Update.
+	* nat/linux-osdata.c: Update.
+	* nat/linux-procfs.c: Update.
+	* nat/x86-linux-dregs.c: Update.
+	* nto-procfs.c: Update.
+	* obsd-nat.c: Update.
+	* ppc-linux-nat.c: Update.
+	* ppc-nbsd-nat.c: Update.
+	* ppc-obsd-nat.c: Update.
+	* proc-service.c: Update.
+	* procfs.c: Update.
+	* python/py-inferior.c: Update.
+	* python/py-infthread.c: Update.
+	* ravenscar-thread.c: Update.
+	* record.c: Update.
+	* remote-sim.c: Update.
+	* remote.c: Update.
+	* rs6000-nat.c: Update.
+	* s390-linux-nat.c: Update.
+	* sh-nbsd-nat.c: Update.
+	* sol-thread.c: Update.
+	* sparc-nat.c: Update.
+	* sparc64-tdep.c: Update.
+	* spu-linux-nat.c: Update.
+	* spu-tdep.c: Update.
+	* target-debug.h: Update.
+	* target.c: Update.
+	* thread.c: Update.
+	* tid-parse.c: Update.
+	* tracefile-tfile.c: Update.
+	* vax-bsd-nat.c: Update.
+	* windows-nat.c: Update.
+	* x86-linux-nat.c: Update.
+	* x86-nat.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* common/ptid.c (pid_to_ptid): Remove.
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 1e4f937dc9..ab3e19a1c5 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -487,7 +487,7 @@ aarch64_linux_nat_target::low_new_fork (struct lwp_info *parent,
      new process so that all breakpoints and watchpoints can be
      removed together.  */
 
-  parent_pid = ptid_get_pid (parent->ptid);
+  parent_pid = parent->ptid.pid ();
   parent_state = aarch64_get_debug_reg_state (parent_pid);
   child_state = aarch64_get_debug_reg_state (child_pid);
   *child_state = *parent_state;
@@ -513,8 +513,8 @@ ps_get_thread_area (struct ps_prochandle *ph,
 void
 aarch64_linux_nat_target::post_startup_inferior (ptid_t ptid)
 {
-  low_forget_process (ptid_get_pid (ptid));
-  aarch64_linux_get_debug_reg_capacity (ptid_get_pid (ptid));
+  low_forget_process (ptid.pid ());
+  aarch64_linux_get_debug_reg_capacity (ptid.pid ());
   linux_nat_target::post_startup_inferior (ptid);
 }
 
@@ -619,7 +619,7 @@ aarch64_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
   int len;
   const enum target_hw_bp_type type = hw_execute;
   struct aarch64_debug_reg_state *state
-    = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = aarch64_get_debug_reg_state (inferior_ptid.pid ());
 
   gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
 
@@ -652,7 +652,7 @@ aarch64_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
   int len = 4;
   const enum target_hw_bp_type type = hw_execute;
   struct aarch64_debug_reg_state *state
-    = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = aarch64_get_debug_reg_state (inferior_ptid.pid ());
 
   gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
 
@@ -685,7 +685,7 @@ aarch64_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
 {
   int ret;
   struct aarch64_debug_reg_state *state
-    = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = aarch64_get_debug_reg_state (inferior_ptid.pid ());
 
   if (show_debug_regs)
     fprintf_unfiltered (gdb_stdlog,
@@ -717,7 +717,7 @@ aarch64_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
 {
   int ret;
   struct aarch64_debug_reg_state *state
-    = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = aarch64_get_debug_reg_state (inferior_ptid.pid ());
 
   if (show_debug_regs)
     fprintf_unfiltered (gdb_stdlog,
@@ -763,7 +763,7 @@ aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
     return false;
 
   /* Check if the address matches any watched address.  */
-  state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+  state = aarch64_get_debug_reg_state (inferior_ptid.pid ());
   for (i = aarch64_num_wp_regs - 1; i >= 0; --i)
     {
       const unsigned int offset
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b34efa919e..12acc82143 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12108,7 +12108,7 @@ ada_exception_support_info_sniffer (void)
      loaded.  If it is not started, this may mean that the symbol is
      in a shared library.  */
 
-  if (ptid_get_pid (inferior_ptid) == 0)
+  if (inferior_ptid.pid () == 0)
     error (_("Unable to insert catchpoint. Try to start the program first."));
 
   /* At this point, we know that we are debugging an Ada program and
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index bd66889e9d..c5bb839fb8 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -325,7 +325,7 @@ pid_to_prc (ptid_t *ptidp)
 
   ptid = *ptidp;
   if (PD_TID (ptid))
-    *ptidp = ptid_t (ptid_get_pid (ptid));
+    *ptidp = ptid_t (ptid.pid ());
 }
 
 /* pthdb callback: for <i> from 0 to COUNT, set SYMBOLS[<i>].addr to
@@ -673,9 +673,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2)
 {
   int pid1, pid2;
 
-  if (ptid_get_pid (ptid1) < ptid_get_pid (ptid2))
+  if (ptid1.pid () < ptid2.pid ())
     return -1;
-  else if (ptid_get_pid (ptid1) > ptid_get_pid (ptid2))
+  else if (ptid1.pid () > ptid2.pid ())
     return 1;
   else if (ptid_get_tid (ptid1) < ptid_get_tid (ptid2))
     return -1;
@@ -712,7 +712,7 @@ get_signaled_thread (void)
 
   while (1)
   {
-    if (getthrds (ptid_get_pid (inferior_ptid), &thrinf, 
+    if (getthrds (inferior_ptid.pid (), &thrinf, 
           	  sizeof (thrinf), &ktid, 1) != 1)
       break;
 
@@ -795,7 +795,7 @@ sync_threadlists (void)
 
   /* Apply differences between the two arrays to GDB's thread list.  */
 
-  infpid = ptid_get_pid (inferior_ptid);
+  infpid = inferior_ptid.pid ();
   for (pi = gi = 0; pi < pcount || gi < gcount;)
     {
       if (pi == pcount)
@@ -1042,7 +1042,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
     {
       scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
       
-      inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+      inferior_ptid = ptid_t (inferior_ptid.pid ());
       beneath ()->resume (ptid, step, sig);
     }
   else
@@ -1082,11 +1082,11 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
 
     pid_to_prc (&ptid);
 
-    inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+    inferior_ptid = ptid_t (inferior_ptid.pid ());
     ptid = beneath ()->wait (ptid, status, options);
   }
 
-  if (ptid_get_pid (ptid) == -1)
+  if (ptid.pid () == -1)
     return ptid_t (-1);
 
   /* Check whether libpthdebug might be ready to be initialized.  */
@@ -1722,7 +1722,7 @@ aix_thread_target::xfer_partial (enum target_object object,
 {
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
-  inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+  inferior_ptid = ptid_t (inferior_ptid.pid ());
   return beneath ()->xfer_partial (object, annex, readbuf,
 				   writebuf, offset, len, xfered_len);
 }
@@ -1832,7 +1832,7 @@ aix_thread_target::extra_thread_info (struct thread_info *thread)
 ptid_t
 aix_thread_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_t (ptid_get_pid (inferior_ptid), 0, thread);
+  return ptid_t (inferior_ptid.pid (), 0, thread);
 }
 
 
diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c
index 7a3fe9bb25..11550cc547 100644
--- a/gdb/alpha-bsd-nat.c
+++ b/gdb/alpha-bsd-nat.c
@@ -98,7 +98,7 @@ alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
     {
       struct reg gregs;
 
-      if (ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+      if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
 		  (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
@@ -112,7 +112,7 @@ alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
     {
       struct fpreg fpregs;
 
-      if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+      if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
 		  (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
@@ -129,13 +129,13 @@ alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno)
   if (regno == -1 || getregs_supplies (regno))
     {
       struct reg gregs;
-      if (ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+      if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
                   (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
         perror_with_name (_("Couldn't get registers"));
 
       alphabsd_fill_reg (regcache, (char *) &gregs, regno);
 
-      if (ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()),
+      if (ptrace (PT_SETREGS, regcache->ptid ().pid (),
                   (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
         perror_with_name (_("Couldn't write registers"));
 
@@ -148,13 +148,13 @@ alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno)
     {
       struct fpreg fpregs;
 
-      if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+      if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
 		  (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
       alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
 
-      if (ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()),
+      if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
 		  (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
 	perror_with_name (_("Couldn't write floating point status"));
     }
diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c
index 6b0367b5d6..14ab468054 100644
--- a/gdb/amd64-fbsd-nat.c
+++ b/gdb/amd64-fbsd-nat.c
@@ -167,7 +167,7 @@ amd64_fbsd_nat_target::read_description ()
   struct reg regs;
   int is64;
 
-  if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+  if (ptrace (PT_GETREGS, inferior_ptid.pid (),
 	      (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
   is64 = (regs.r_cs == GSEL (GUCODE_SEL, SEL_UPL));
@@ -176,7 +176,7 @@ amd64_fbsd_nat_target::read_description ()
     {
       struct ptrace_xstate_info info;
 
-      if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid),
+      if (ptrace (PT_GETXSTATE_INFO, inferior_ptid.pid (),
 		  (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0)
 	{
 	  x86bsd_xsave_len = info.xsave_len;
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 5a39fa8774..588c9b50eb 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -150,7 +150,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
   /* GNU/Linux LWP ID's are process ID's.  */
   tid = ptid_get_lwp (regcache->ptid ());
   if (tid == 0)
-    tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program.  */
+    tid = regcache->ptid ().pid (); /* Not a threaded program.  */
 
   if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
     {
@@ -228,7 +228,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
   /* GNU/Linux LWP ID's are process ID's.  */
   tid = ptid_get_lwp (regcache->ptid ());
   if (tid == 0)
-    tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program.  */
+    tid = regcache->ptid ().pid (); /* Not a threaded program.  */
 
   if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
     {
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index b5ee3a9063..8f9416e668 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -993,7 +993,7 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
   struct arm_linux_hw_breakpoint* bpts;
   struct update_registers_data data;
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   pid_ptid = ptid_t (pid);
 
   if (watchpoint)
@@ -1032,7 +1032,7 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
   struct arm_linux_hw_breakpoint* bpts;
   struct update_registers_data data;
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   pid_ptid = ptid_t (pid);
 
   if (watchpoint)
@@ -1251,8 +1251,8 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
   struct arch_lwp_info *arm_lwp_info = lwp->arch_private;
 
   pid = ptid_get_lwp (lwp->ptid);
-  bpts = arm_linux_get_debug_reg_state (ptid_get_pid (lwp->ptid))->bpts;
-  wpts = arm_linux_get_debug_reg_state (ptid_get_pid (lwp->ptid))->wpts;
+  bpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->bpts;
+  wpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->wpts;
 
   /* NULL means this is the main thread still going through the shell,
      or, no watchpoint has been set yet.  In that case, there's
@@ -1315,7 +1315,7 @@ arm_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
      new process so that all breakpoints and watchpoints can be
      removed together.  */
 
-  parent_pid = ptid_get_pid (parent->ptid);
+  parent_pid = parent->ptid.pid ();
   parent_state = arm_linux_get_debug_reg_state (parent_pid);
   child_state = arm_linux_get_debug_reg_state (child_pid);
   *child_state = *parent_state;
diff --git a/gdb/arm-nbsd-nat.c b/gdb/arm-nbsd-nat.c
index 2a298eea0a..85811c7e4b 100644
--- a/gdb/arm-nbsd-nat.c
+++ b/gdb/arm-nbsd-nat.c
@@ -82,7 +82,7 @@ fetch_register (struct regcache *regcache, int regno)
   struct reg inferior_registers;
   int ret;
 
-  ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -131,7 +131,7 @@ fetch_regs (struct regcache *regcache)
   int ret;
   int regno;
 
-  ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -149,7 +149,7 @@ fetch_fp_register (struct regcache *regcache, int regno)
   struct fpreg inferior_fp_registers;
   int ret;
 
-  ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
@@ -179,7 +179,7 @@ fetch_fp_regs (struct regcache *regcache)
   int ret;
   int regno;
 
-  ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
@@ -216,7 +216,7 @@ store_register (const struct regcache *regcache, int regno)
   struct reg inferior_registers;
   int ret;
 
-  ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -274,7 +274,7 @@ store_register (const struct regcache *regcache, int regno)
       break;
     }
 
-  ret = ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -316,7 +316,7 @@ store_regs (const struct regcache *regcache)
       inferior_registers.r_pc = pc_val | psr_val;
     }
 
-  ret = ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -329,7 +329,7 @@ store_fp_register (const struct regcache *regcache, int regno)
   struct fpreg inferior_fp_registers;
   int ret;
 
-  ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
@@ -351,7 +351,7 @@ store_fp_register (const struct regcache *regcache, int regno)
       break;
     }
 
-  ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
@@ -373,7 +373,7 @@ store_fp_regs (const struct regcache *regcache)
   regcache->raw_collect (ARM_FPS_REGNUM,
 			 (char *) &inferior_fp_registers.fpr_fpsr);
 
-  ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()),
+  ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
 		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 2afa136efe..dda14f2cae 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -50,7 +50,7 @@ procfs_xfer_auxv (gdb_byte *readbuf,
   int fd;
   ssize_t l;
 
-  pathname = xstrprintf ("/proc/%d/auxv", ptid_get_pid (inferior_ptid));
+  pathname = xstrprintf ("/proc/%d/auxv", inferior_ptid.pid ());
   fd = gdb_open_cloexec (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY, 0);
   xfree (pathname);
   if (fd < 0)
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 2fb5e6157b..93ef74c249 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -110,7 +110,7 @@ insert_catch_syscall (struct bp_location *bl)
 	}
     }
 
-  return target_set_syscall_catchpoint (ptid_get_pid (inferior_ptid),
+  return target_set_syscall_catchpoint (inferior_ptid.pid (),
 					inf_data->total_syscalls_count != 0,
 					inf_data->any_syscall_count,
 					inf_data->syscalls_counts);
@@ -141,7 +141,7 @@ remove_catch_syscall (struct bp_location *bl, enum remove_bp_reason reason)
         }
     }
 
-  return target_set_syscall_catchpoint (ptid_get_pid (inferior_ptid),
+  return target_set_syscall_catchpoint (inferior_ptid.pid (),
 					inf_data->total_syscalls_count != 0,
 					inf_data->any_syscall_count,
 					inf_data->syscalls_counts);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f20bc500f5..85da620b40 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3638,7 +3638,7 @@ detach_breakpoints (ptid_t ptid)
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
   struct inferior *inf = current_inferior ();
 
-  if (ptid_get_pid (ptid) == ptid_get_pid (inferior_ptid))
+  if (ptid.pid () == inferior_ptid.pid ())
     error (_("Cannot detach breakpoints of inferior_ptid"));
 
   /* Set inferior_ptid; remove_breakpoint_1 uses this global.  */
@@ -7703,7 +7703,7 @@ struct fork_catchpoint : public breakpoint
 static int
 insert_catch_fork (struct bp_location *bl)
 {
-  return target_insert_fork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_insert_fork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "remove" breakpoint_ops method for fork
@@ -7712,7 +7712,7 @@ insert_catch_fork (struct bp_location *bl)
 static int
 remove_catch_fork (struct bp_location *bl, enum remove_bp_reason reason)
 {
-  return target_remove_fork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_remove_fork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "breakpoint_hit" breakpoint_ops method for fork
@@ -7755,7 +7755,7 @@ print_it_catch_fork (bpstat bs)
     }
   uiout->field_int ("bkptno", b->number);
   uiout->text (" (forked process ");
-  uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+  uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
   uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
@@ -7782,7 +7782,7 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
   if (!ptid_equal (c->forked_inferior_pid, null_ptid))
     {
       uiout->text (", process ");
-      uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+      uiout->field_int ("what", c->forked_inferior_pid.pid ());
       uiout->spaces (1);
     }
 
@@ -7819,7 +7819,7 @@ static struct breakpoint_ops catch_fork_breakpoint_ops;
 static int
 insert_catch_vfork (struct bp_location *bl)
 {
-  return target_insert_vfork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_insert_vfork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "remove" breakpoint_ops method for vfork
@@ -7828,7 +7828,7 @@ insert_catch_vfork (struct bp_location *bl)
 static int
 remove_catch_vfork (struct bp_location *bl, enum remove_bp_reason reason)
 {
-  return target_remove_vfork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_remove_vfork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "breakpoint_hit" breakpoint_ops method for vfork
@@ -7871,7 +7871,7 @@ print_it_catch_vfork (bpstat bs)
     }
   uiout->field_int ("bkptno", b->number);
   uiout->text (" (vforked process ");
-  uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+  uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
   uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
@@ -7897,7 +7897,7 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc)
   if (!ptid_equal (c->forked_inferior_pid, null_ptid))
     {
       uiout->text (", process ");
-      uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+      uiout->field_int ("what", c->forked_inferior_pid.pid ());
       uiout->spaces (1);
     }
 
@@ -8248,13 +8248,13 @@ exec_catchpoint::~exec_catchpoint ()
 static int
 insert_catch_exec (struct bp_location *bl)
 {
-  return target_insert_exec_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_insert_exec_catchpoint (inferior_ptid.pid ());
 }
 
 static int
 remove_catch_exec (struct bp_location *bl, enum remove_bp_reason reason)
 {
-  return target_remove_exec_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_remove_exec_catchpoint (inferior_ptid.pid ());
 }
 
 static int
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 4eeb787153..c7fb671ec6 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -407,7 +407,7 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
 	{
 	  ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
 	  if (magic == BSD_UTHREAD_PTHREAD_MAGIC)
-	    ptid = ptid_t (ptid_get_pid (ptid), 0, addr);
+	    ptid = ptid_t (ptid.pid (), 0, addr);
 	}
     }
 
@@ -456,7 +456,7 @@ bsd_uthread_target::thread_alive (ptid_t ptid)
 void
 bsd_uthread_target::update_thread_list ()
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   int offset = bsd_uthread_thread_next_offset;
   CORE_ADDR addr;
 
@@ -537,7 +537,7 @@ bsd_uthread_target::pid_to_str (ptid_t ptid)
       static char buf[64];
 
       xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx",
-		 ptid_get_pid (ptid), ptid_get_tid (ptid));
+		 ptid.pid (), ptid_get_tid (ptid));
       return buf;
     }
 
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 42e51d2624..0b0a703f08 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
 
 /* See ptid.h.  */
 
-int
-ptid_get_pid (const ptid_t &ptid)
-{
-  return ptid.pid ();
-}
-
-/* See ptid.h.  */
-
 long
 ptid_get_lwp (const ptid_t &ptid)
 {
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 5591690437..6747e7ac38 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
 /* The following functions are kept for backwards compatibility.  The use of
    the ptid_t methods is preferred.  */
 
-/* See ptid_t::pid.  */
-
-extern int ptid_get_pid (const ptid_t &ptid);
-
 /* See ptid_t::lwp.  */
 
 extern long ptid_get_lwp (const ptid_t &ptid);
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 9c92095e05..b326278ec5 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -260,7 +260,7 @@ core_target::close ()
 {
   if (core_bfd)
     {
-      int pid = ptid_get_pid (inferior_ptid);
+      int pid = inferior_ptid.pid ();
       inferior_ptid = null_ptid;    /* Avoid confusion from thread
 				       stuff.  */
       if (pid != 0)
diff --git a/gdb/ctf.c b/gdb/ctf.c
index ebc01a5b97..7731662d67 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1181,7 +1181,7 @@ ctf_target::close ()
   xfree (trace_dirname);
   trace_dirname = NULL;
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   inferior_ptid = null_ptid;	/* Avoid confusion from thread stuff.  */
   exit_inferior_silent (pid);
 
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 682a62f1d3..4337b51a02 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -928,7 +928,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
 
   inferior_debug
     (2, _("darwin_resume: pid=%d, tid=0x%lx, step=%d, signal=%d\n"),
-     ptid_get_pid (ptid), ptid_get_tid (ptid), step, signal);
+     ptid.pid (), ptid_get_tid (ptid), step, signal);
 
   if (signal == GDB_SIGNAL_0)
     nsignal = 0;
@@ -1197,7 +1197,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 
   inferior_debug
     (2, _("darwin_wait: waiting for a message pid=%d thread=%lx\n"),
-     ptid_get_pid (ptid), ptid_get_tid (ptid));
+     ptid.pid (), ptid_get_tid (ptid));
 
   /* Handle fake stop events at first.  */
   if (darwin_inf_fake_stop != NULL)
@@ -1907,7 +1907,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
 void
 darwin_nat_target::detach (inferior *inf, int from_tty)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   darwin_inferior *priv = get_darwin_inferior (inf);
   kern_return_t kret;
   int res;
@@ -1950,7 +1950,7 @@ darwin_nat_target::pid_to_str (ptid_t ptid)
   if (tid != 0)
     {
       snprintf (buf, sizeof (buf), _("Thread 0x%lx of process %u"),
-		tid, ptid_get_pid (ptid));
+		tid, ptid.pid ());
       return buf;
     }
 
@@ -2255,7 +2255,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
   for (darwin_thread_t *t : priv->threads)
     {
       if (t->inf_port == lwp)
-	return ptid_t (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
+	return ptid_t (inferior_ptid.pid (), 0, t->gdb_port);
     }
 
   /* Maybe the port was never extract.  Do it now.  */
@@ -2299,7 +2299,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
                  names_count * sizeof (mach_port_t));
 
   if (res)
-    return ptid_t (ptid_get_pid (inferior_ptid), 0, res);
+    return ptid_t (inferior_ptid.pid (), 0, res);
   else
     return null_ptid;
 }
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 27fee703e0..0ceb8d876f 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -92,7 +92,7 @@ int
 fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
 				      void *obfd)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   struct kinfo_vmentry *kve;
   uint64_t size;
   int i, nitems;
@@ -166,7 +166,7 @@ int
 fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
 				      void *obfd)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   unsigned long start, end, size;
   char protection[4];
   int read, write, exec;
@@ -312,7 +312,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
   gdb_argv built_argv (args);
   if (built_argv.count () == 0)
     {
-      pid = ptid_get_pid (inferior_ptid);
+      pid = inferior_ptid.pid ();
       if (pid == 0)
 	error (_("No current process: you must name one."));
     }
@@ -674,7 +674,7 @@ fbsd_nat_target::xfer_partial (enum target_object object,
 			       ULONGEST offset, ULONGEST len,
 			       ULONGEST *xfered_len)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
 
   switch (object)
     {
@@ -838,7 +838,7 @@ fbsd_nat_target::pid_to_str (ptid_t ptid)
   if (lwp != 0)
     {
       static char buf[64];
-      int pid = ptid_get_pid (ptid);
+      int pid = ptid.pid ();
 
       xsnprintf (buf, sizeof buf, "LWP %d of process %d", lwp, pid);
       return buf;
@@ -856,7 +856,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
 {
   struct ptrace_lwpinfo pl;
   struct kinfo_proc kp;
-  int pid = ptid_get_pid (thr->ptid);
+  int pid = thr->ptid.pid ();
   long lwp = ptid_get_lwp (thr->ptid);
   static char buf[sizeof pl.pl_tdname + 1];
 
@@ -974,7 +974,7 @@ fbsd_nat_target::update_thread_list ()
 #else
   prune_threads ();
 
-  fbsd_add_threads (ptid_get_pid (inferior_ptid));
+  fbsd_add_threads (inferior_ptid.pid ());
 #endif
 }
 
@@ -1090,9 +1090,9 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 
   /* Don't PT_CONTINUE a process which has a pending vfork done event.  */
   if (ptid_equal (minus_one_ptid, ptid))
-    pid = ptid_get_pid (inferior_ptid);
+    pid = inferior_ptid.pid ();
   else
-    pid = ptid_get_pid (ptid);
+    pid = ptid.pid ();
   if (fbsd_is_vfork_done_pending (pid))
     return;
 #endif
@@ -1100,7 +1100,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
   if (debug_fbsd_lwp)
     fprintf_unfiltered (gdb_stdlog,
 			"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
-			ptid_get_pid (ptid), ptid_get_lwp (ptid),
+			ptid.pid (), ptid_get_lwp (ptid),
 			ptid_get_tid (ptid));
   if (ptid_lwp_p (ptid))
     {
@@ -1110,7 +1110,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 
       ALL_NON_EXITED_THREADS (tp)
         {
-	  if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid))
+	  if (tp->ptid.pid () != ptid.pid ())
 	    continue;
 
 	  if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid))
@@ -1249,7 +1249,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	  pid_t pid;
 	  int status;
 
-	  pid = ptid_get_pid (wptid);
+	  pid = wptid.pid ();
 	  if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
 	    perror_with_name (("ptrace"));
 
@@ -1360,7 +1360,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 		}
 
 	      /* Enable additional events on the child process.  */
-	      fbsd_enable_proc_events (ptid_get_pid (child_ptid));
+	      fbsd_enable_proc_events (child_ptid.pid ());
 
 #ifndef PTRACE_VFORK
 	      /* For vfork, the child process will have the P_PPWAIT
@@ -1486,7 +1486,7 @@ fbsd_nat_target::follow_fork (int follow_child, int detach_fork)
   if (!follow_child && detach_fork)
     {
       struct thread_info *tp = inferior_thread ();
-      pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid);
+      pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
 
       /* Breakpoints have already been detached from the child by
 	 infrun.c.  */
@@ -1557,7 +1557,7 @@ fbsd_nat_target::remove_vfork_catchpoint (int pid)
 void
 fbsd_nat_target::post_startup_inferior (ptid_t pid)
 {
-  fbsd_enable_proc_events (ptid_get_pid (pid));
+  fbsd_enable_proc_events (pid.pid ());
 }
 
 /* Implement the "post_attach" target_ops method.  */
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index e49a9aff09..a3f8a070a2 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -406,7 +406,7 @@ static int
 find_signalled_thread (struct thread_info *info, void *data)
 {
   if (info->suspend.stop_signal != GDB_SIGNAL_0
-      && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
+      && info->ptid.pid () == inferior_ptid.pid ())
     return 1;
 
   return 0;
@@ -578,7 +578,7 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
     {
       if (thr == signalled_thr)
 	continue;
-      if (ptid_get_pid (thr->ptid) != ptid_get_pid (inferior_ptid))
+      if (thr->ptid.pid () != inferior_ptid.pid ())
 	continue;
 
       fbsd_corefile_thread (thr, &thread_args);
diff --git a/gdb/gcore.c b/gdb/gcore.c
index c53810049c..fbebb6af18 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -151,7 +151,7 @@ gcore_command (const char *args, int from_tty)
   else
     {
       /* Default corefile name is "core.PID".  */
-      corefilename.reset (xstrprintf ("core.%d", ptid_get_pid (inferior_ptid)));
+      corefilename.reset (xstrprintf ("core.%d", inferior_ptid.pid ()));
     }
 
   if (info_verbose)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index ca4a82bdb3..14b1c6629a 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,16 @@
+2018-06-13  Tom Tromey  <tom@tromey.com>
+
+	* linux-low.c: Update.
+	* linux-mips-low.c: Update.
+	* lynx-low.c: Update.
+	* mem-break.c: Update.
+	* nto-low.c: Update.
+	* remote-utils.c: Update.
+	* server.c: Update.
+	* spu-low.c: Update.
+	* target.c: Update.
+	* tracepoint.c: Update.
+
 2018-06-13  Tom Tromey  <tom@tromey.com>
 
 	* linux-low.c: Update.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index a5e0d5beb6..99a7e162d2 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -530,7 +530,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 	      debug_printf ("HEW: Got fork event from LWP %ld, "
 			    "new child is %d\n",
 			    ptid_get_lwp (ptid_of (event_thr)),
-			    ptid_get_pid (ptid));
+			    ptid.pid ());
 	    }
 
 	  /* Add the new process to the tables and clone the breakpoint
@@ -699,7 +699,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 
       /* Get the event ptid.  */
       event_ptid = ptid_of (event_thr);
-      event_pid = ptid_get_pid (event_ptid);
+      event_pid = event_ptid.pid ();
 
       /* Save the syscall list from the execing process.  */
       proc = get_thread_process (event_thr);
@@ -1323,7 +1323,7 @@ static void
 kill_wait_lwp (struct lwp_info *lwp)
 {
   struct thread_info *thr = get_lwp_thread (lwp);
-  int pid = ptid_get_pid (ptid_of (thr));
+  int pid = ptid_of (thr).pid ();
   int lwpid = ptid_get_lwp (ptid_of (thr));
   int wstat;
   int res;
@@ -4546,7 +4546,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
 	  || ptid == thread->id
 	  /* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads
 	     of PID'.  */
-	  || (ptid_get_pid (ptid) == pid_of (thread)
+	  || (ptid.pid () == pid_of (thread)
 	      && (ptid_is_pid (ptid)
 		  || ptid_get_lwp (ptid) == -1)))
 	{
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 17fb897d6d..f61c294401 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -440,7 +440,7 @@ static void
 mips_linux_prepare_to_resume (struct lwp_info *lwp)
 {
   ptid_t ptid = ptid_of (get_lwp_thread (lwp));
-  struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
+  struct process_info *proc = find_process_pid (ptid.pid ());
   struct arch_process_info *priv = proc->priv->arch_private;
 
   if (lwp->arch_private->watch_registers_changed)
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index b19ea62172..b637ef96fe 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -83,7 +83,7 @@ lynx_ptid_t (int pid, long tid)
 static int
 lynx_ptid_get_pid (ptid_t ptid)
 {
-  return ptid_get_pid (ptid);
+  return ptid.pid ();
 }
 
 /* Return the LynxOS tid of the given PTID.  */
@@ -352,7 +352,7 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
   if (ptid_equal (ptid, minus_one_ptid))
     ptid = ptid_of (current_thread);
 
-  regcache_invalidate_pid (ptid_get_pid (ptid));
+  regcache_invalidate_pid (ptid.pid ());
 
   errno = 0;
   lynx_ptrace (request, ptid, 1, signal, 0);
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 4c10fbba2c..7ad8c48d62 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -1482,7 +1482,7 @@ set_single_step_breakpoint (CORE_ADDR stop_at, ptid_t ptid)
 {
   struct single_step_breakpoint *bp;
 
-  gdb_assert (ptid_get_pid (current_ptid) == ptid_get_pid (ptid));
+  gdb_assert (current_ptid.pid () == ptid.pid ());
 
   bp = (struct single_step_breakpoint *) set_breakpoint_type_at (single_step_breakpoint,
 								stop_at, NULL);
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index ed28426542..6a05d2b0be 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -91,7 +91,7 @@ nto_set_thread (ptid_t ptid)
 {
   int res = 0;
 
-  TRACE ("%s pid: %d tid: %ld\n", __func__, ptid_get_pid (ptid),
+  TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (),
 	 ptid_get_lwp (ptid));
   if (nto_inferior.ctl_fd != -1
       && !ptid_equal (ptid, null_ptid)
@@ -430,9 +430,9 @@ nto_thread_alive (ptid_t ptid)
 {
   int res;
 
-  TRACE ("%s pid:%d tid:%d\n", __func__, ptid_get_pid (ptid),
+  TRACE ("%s pid:%d tid:%d\n", __func__, ptid.pid (),
 	 ptid_get_lwp (ptid));
-  if (SignalKill (0, ptid_get_pid (ptid), ptid_get_lwp (ptid),
+  if (SignalKill (0, ptid.pid (), ptid_get_lwp (ptid),
 		  0, 0, 0) == -1)
     res = 0;
   else
@@ -582,7 +582,7 @@ nto_wait (ptid_t ptid,
 	    int waitval = 0;
 
 	    TRACE ("  TERMINATED\n");
-	    waitpid (ptid_get_pid (ptid), &waitval, WNOHANG);
+	    waitpid (ptid.pid (), &waitval, WNOHANG);
 	    if (nto_inferior.exit_signo)
 	      {
 		/* Abnormal death.  */
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index a1a06dcdf5..400c2be9f8 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -486,7 +486,7 @@ write_ptid (char *buf, ptid_t ptid)
 
   if (cs.multi_process)
     {
-      pid = ptid_get_pid (ptid);
+      pid = ptid.pid ();
       if (pid < 0)
 	buf += sprintf (buf, "p-%x.", -pid);
       else
@@ -1261,14 +1261,14 @@ prepare_resume_reply (char *buf, ptid_t ptid,
     case TARGET_WAITKIND_EXITED:
       if (cs.multi_process)
 	sprintf (buf, "W%x;process:%x",
-		 status->value.integer, ptid_get_pid (ptid));
+		 status->value.integer, ptid.pid ());
       else
 	sprintf (buf, "W%02x", status->value.integer);
       break;
     case TARGET_WAITKIND_SIGNALLED:
       if (cs.multi_process)
 	sprintf (buf, "X%x;process:%x",
-		 status->value.sig, ptid_get_pid (ptid));
+		 status->value.sig, ptid.pid ());
       else
 	sprintf (buf, "X%02x", status->value.sig);
       break;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index c2f7287a94..28bc9def37 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1205,7 +1205,7 @@ handle_detach (char *own_buf)
       pid = strtol (&own_buf[2], NULL, 16);
     }
   else
-    pid = ptid_get_pid (current_ptid);
+    pid = current_ptid.pid ();
 
   if ((tracing && disconnected_tracing) || any_persistent_commands ())
     {
@@ -2180,7 +2180,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       if (current_thread == NULL)
 	{
 	  current_thread
-	    = find_any_thread_of_pid (ptid_get_pid (cs.general_thread));
+	    = find_any_thread_of_pid (cs.general_thread.pid ());
 
 	  /* Just in case, if we didn't find a thread, then bail out
 	     instead of crashing.  */
@@ -2698,7 +2698,7 @@ visit_actioned_threads (thread_info *thread,
 
       if (ptid_equal (action->thread, minus_one_ptid)
 	  || ptid_equal (action->thread, thread->id)
-	  || ((ptid_get_pid (action->thread)
+	  || ((action->thread.pid ()
 	       == thread->id.pid ())
 	      && ptid_get_lwp (action->thread) == -1))
 	{
@@ -4427,7 +4427,7 @@ handle_target_event (int err, gdb_client_data client_data)
     }
   else if (cs.last_status.kind != TARGET_WAITKIND_IGNORE)
     {
-      int pid = ptid_get_pid (cs.last_ptid);
+      int pid = cs.last_ptid.pid ();
       struct process_info *process = find_process_pid (pid);
       int forward_event = !gdb_connected () || process->gdb_detached;
 
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 8a221a2c6c..3436d39118 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -418,7 +418,7 @@ spu_resume (struct thread_resume *resume_info, size_t n)
 static ptid_t
 spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
 {
-  int pid = ptid_get_pid (ptid);
+  int pid = ptid.pid ();
   int w;
   int ret;
 
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index c2763294af..400d458ea9 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -248,7 +248,7 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 void
 target_mourn_inferior (ptid_t ptid)
 {
-  (*the_target->mourn) (find_process_pid (ptid_get_pid (ptid)));
+  (*the_target->mourn) (find_process_pid (ptid.pid ()));
 }
 
 /* See target/target.h.  */
@@ -320,13 +320,13 @@ target_pid_to_str (ptid_t ptid)
     xsnprintf (buf, sizeof (buf), "<null thread>");
   else if (ptid_get_tid (ptid) != 0)
     xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
-	       ptid_get_pid (ptid), ptid_get_tid (ptid));
+	       ptid.pid (), ptid_get_tid (ptid));
   else if (ptid_get_lwp (ptid) != 0)
     xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
-	       ptid_get_pid (ptid), ptid_get_lwp (ptid));
+	       ptid.pid (), ptid_get_lwp (ptid));
   else
     xsnprintf (buf, sizeof (buf), "Process %d",
-	       ptid_get_pid (ptid));
+	       ptid.pid ());
 
   return buf;
 }
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index c203080dff..ad2a80185a 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -6835,7 +6835,7 @@ static int
 run_inferior_command (char *cmd, int len)
 {
   int err = -1;
-  int pid = ptid_get_pid (current_ptid);
+  int pid = current_ptid.pid ();
 
   trace_debug ("run_inferior_command: running: %s", cmd);
 
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 78276a71df..c7c7e893ca 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2042,7 +2042,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
     /* Allow all threads to run, except perhaps single-stepping one.  */
     {
       inf_debug (inf, "running all threads; tid = %d",
-		 ptid_get_pid (inferior_ptid));
+		 inferior_ptid.pid ());
       ptid = inferior_ptid;	/* What to step.  */
       inf_set_threads_resume_sc (inf, 0, 1);
     }
diff --git a/gdb/hppa-nbsd-nat.c b/gdb/hppa-nbsd-nat.c
index 40a08b7987..2a1149086f 100644
--- a/gdb/hppa-nbsd-nat.c
+++ b/gdb/hppa-nbsd-nat.c
@@ -170,7 +170,7 @@ void
 hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
     {
@@ -199,7 +199,7 @@ hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 void
 hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
     {
diff --git a/gdb/hppa-obsd-nat.c b/gdb/hppa-obsd-nat.c
index eb056e37fd..9237deec1a 100644
--- a/gdb/hppa-obsd-nat.c
+++ b/gdb/hppa-obsd-nat.c
@@ -196,7 +196,7 @@ hppaobsd_collect_fpregset (struct regcache *regcache,
 void
 hppa_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum))
     {
diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c
index 46f9a86006..ced369e690 100644
--- a/gdb/i386-fbsd-nat.c
+++ b/gdb/i386-fbsd-nat.c
@@ -58,14 +58,14 @@ static i386_fbsd_nat_target the_i386_fbsd_nat_target;
 void
 i386_fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
 {
-  pid_t pid = ptid_get_pid (ptid);
+  pid_t pid = ptid.pid ();
   int request = PT_STEP;
 
   if (pid == -1)
     /* Resume all threads.  This only gets used in the non-threaded
        case, where "resume all threads" and "resume inferior_ptid" are
        the same.  */
-    pid = ptid_get_pid (inferior_ptid);
+    pid = inferior_ptid.pid ();
 
   if (!step)
     {
@@ -148,7 +148,7 @@ i386_fbsd_nat_target::read_description ()
     {
       struct ptrace_xstate_info info;
 
-      if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid),
+      if (ptrace (PT_GETXSTATE_INFO, inferior_ptid.pid (),
 		  (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0)
 	{
 	  x86bsd_xsave_len = info.xsave_len;
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index ef70da5a97..49ae702682 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -555,7 +555,7 @@ store_debug_register (ptid_t ptid, int idx, long val)
 
   tid = ptid_get_lwp (ptid);
   if (tid == 0)
-    tid = ptid_get_pid (ptid);
+    tid = ptid.pid ();
 
   (void) ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) (PT_DBR + 8 * idx), val);
 }
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 3b32b678ee..bdea7f1815 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -66,7 +66,7 @@ inf_ptrace_target::follow_fork (int follow_child, int detach_fork)
   if (!follow_child)
     {
       struct thread_info *tp = inferior_thread ();
-      pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid);
+      pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
 
       /* Breakpoints have already been detached from the child by
 	 infrun.c.  */
@@ -156,7 +156,7 @@ inf_ptrace_target::post_startup_inferior (ptid_t pid)
   /* Set the initial event mask.  */
   memset (&pe, 0, sizeof pe);
   pe.pe_set_event |= PTRACE_FORK;
-  if (ptrace (PT_SET_EVENT_MASK, ptid_get_pid (pid),
+  if (ptrace (PT_SET_EVENT_MASK, pid.pid (),
 	      (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
     perror_with_name (("ptrace"));
 }
@@ -174,7 +174,7 @@ inf_ptrace_target::mourn_inferior ()
      Do not check whether this succeeds though, since we may be
      dealing with a process that we attached to.  Such a process will
      only report its exit status to its original parent.  */
-  waitpid (ptid_get_pid (inferior_ptid), &status, 0);
+  waitpid (inferior_ptid.pid (), &status, 0);
 
   inf_child_target::mourn_inferior ();
 }
@@ -267,7 +267,7 @@ inf_ptrace_target::post_attach (int pid)
 void
 inf_ptrace_target::detach (inferior *inf, int from_tty)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
 
   target_announce_detach (from_tty);
 
@@ -303,7 +303,7 @@ inf_ptrace_target::detach_success (inferior *inf)
 void
 inf_ptrace_target::kill ()
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   int status;
 
   if (pid == 0)
@@ -327,7 +327,7 @@ get_ptrace_pid (ptid_t ptid)
      dealing with a non-threaded program/target.  */
   pid = ptid_get_lwp (ptid);
   if (pid == 0)
-    pid = ptid_get_pid (ptid);
+    pid = ptid.pid ();
   return pid;
 }
 
@@ -344,7 +344,7 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
   if (ptid_equal (minus_one_ptid, ptid))
     /* Resume all threads.  Traditionally ptrace() only supports
        single-threaded processes, so simply resume the inferior.  */
-    pid = ptid_get_pid (inferior_ptid);
+    pid = inferior_ptid.pid ();
   else
     pid = get_ptrace_pid (ptid);
 
@@ -389,7 +389,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
       do
 	{
-	  pid = waitpid (ptid_get_pid (ptid), &status, 0);
+	  pid = waitpid (ptid.pid (), &status, 0);
 	  save_errno = errno;
 	}
       while (pid == -1 && errno == EINTR);
@@ -409,7 +409,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	}
 
       /* Ignore terminated detached child processes.  */
-      if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
+      if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
 	pid = -1;
     }
   while (pid == -1);
@@ -441,7 +441,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
 	  gdb_assert (pe.pe_report_event == PTRACE_FORK);
 	  gdb_assert (pe.pe_other_pid == pid);
-	  if (fpid == ptid_get_pid (inferior_ptid))
+	  if (fpid == inferior_ptid.pid ())
 	    {
 	      ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
 	      return ptid_t (fpid);
@@ -614,7 +614,7 @@ bool
 inf_ptrace_target::thread_alive (ptid_t ptid)
 {
   /* ??? Is kill the right way to do this?  */
-  return (::kill (ptid_get_pid (ptid), 0) != -1);
+  return (::kill (ptid.pid (), 0) != -1);
 }
 
 /* Print status information about what we're accessing.  */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 07c893663a..3c42a3aef4 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2637,7 +2637,7 @@ proceed_after_attach_callback (struct thread_info *thread,
 {
   int pid = * (int *) arg;
 
-  if (ptid_get_pid (thread->ptid) == pid
+  if (thread->ptid.pid () == pid
       && !is_exited (thread->ptid)
       && !is_executing (thread->ptid)
       && !thread->stop_requested
@@ -2676,7 +2676,7 @@ setup_inferior (int from_tty)
   /* If no exec file is yet known, try to determine it from the
      process itself.  */
   if (get_exec_file (0) == NULL)
-    exec_file_locate_attach (ptid_get_pid (inferior_ptid), 1, from_tty);
+    exec_file_locate_attach (inferior_ptid.pid (), 1, from_tty);
   else
     {
       reopen_exec_file ();
@@ -2684,7 +2684,7 @@ setup_inferior (int from_tty)
     }
 
   /* Take any necessary post-attaching actions for this platform.  */
-  target_post_attach (ptid_get_pid (inferior_ptid));
+  target_post_attach (inferior_ptid.pid ());
 
   post_create_inferior (current_top_target (), from_tty);
 }
@@ -2765,7 +2765,7 @@ attach_post_wait (const char *args, int from_tty, enum attach_post_wait_mode mod
 	     still exists.  */
 	  ALL_NON_EXITED_THREADS (thread)
 	    {
-	      if (ptid_get_pid (thread->ptid) == pid)
+	      if (thread->ptid.pid () == pid)
 		{
 		  if (thread->inf->num < lowest->inf->num
 		      || thread->per_inf_num < lowest->per_inf_num)
@@ -2896,7 +2896,7 @@ attach_command (const char *args, int from_tty)
       else
 	/* The user requested an `attach', so stop all threads of this
 	   inferior.  */
-	target_stop (ptid_t (ptid_get_pid (inferior_ptid)));
+	target_stop (ptid_t (inferior_ptid.pid ()));
     }
 
   mode = async_exec ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_STOP;
diff --git a/gdb/inferior.c b/gdb/inferior.c
index c08893607a..0ccbd8aa73 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -141,7 +141,7 @@ delete_thread_of_inferior (struct thread_info *tp, void *data)
   struct delete_thread_of_inferior_arg *arg
     = (struct delete_thread_of_inferior_arg *) data;
 
-  if (ptid_get_pid (tp->ptid) == arg->pid)
+  if (tp->ptid.pid () == arg->pid)
     {
       if (arg->silent)
 	delete_thread_silent (tp->ptid);
@@ -333,7 +333,7 @@ find_inferior_pid (int pid)
 struct inferior *
 find_inferior_ptid (ptid_t ptid)
 {
-  return find_inferior_pid (ptid_get_pid (ptid));
+  return find_inferior_pid (ptid.pid ());
 }
 
 /* See inferior.h.  */
@@ -445,7 +445,7 @@ number_of_live_inferiors (void)
 	struct thread_info *tp;
 
 	ALL_NON_EXITED_THREADS (tp)
-	 if (tp && ptid_get_pid (tp->ptid) == inf->pid)
+	 if (tp && tp->ptid.pid () == inf->pid)
 	   if (target_has_execution_1 (tp->ptid))
 	     {
 	       /* Found a live thread in this inferior, go to the next
@@ -702,7 +702,7 @@ inferior_command (const char *args, int from_tty)
 
   if (inf->pid != 0)
     {
-      if (inf->pid != ptid_get_pid (inferior_ptid))
+      if (inf->pid != inferior_ptid.pid ())
 	{
 	  struct thread_info *tp;
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index bd26c8a86d..7b38e5fc9f 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -83,7 +83,7 @@ extern void set_inferior_io_terminal (const char *terminal_name);
 extern const char *get_inferior_io_terminal (void);
 
 /* Collected pid, tid, etc. of the debugged inferior.  When there's
-   no inferior, ptid_get_pid (inferior_ptid) will be 0.  */
+   no inferior, inferior_ptid.pid () will be 0.  */
 
 extern ptid_t inferior_ptid;
 
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 08e47d65cb..7bcefdcdc6 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -908,7 +908,7 @@ static void
 pass_signal (int signo)
 {
 #ifndef _WIN32
-  kill (ptid_get_pid (inferior_ptid), SIGINT);
+  kill (inferior_ptid.pid (), SIGINT);
 #endif
 }
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1488bb16e4..9d3854d9e5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -458,13 +458,13 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  if (has_vforked)
 	    {
 	      /* Keep breakpoints list in sync.  */
-	      remove_breakpoints_pid (ptid_get_pid (inferior_ptid));
+	      remove_breakpoints_pid (inferior_ptid.pid ());
 	    }
 
 	  if (print_inferior_events)
 	    {
 	      /* Ensure that we have a process ptid.  */
-	      ptid_t process_ptid = ptid_t (ptid_get_pid (child_ptid));
+	      ptid_t process_ptid = ptid_t (child_ptid.pid ());
 
 	      target_terminal::ours_for_output ();
 	      fprintf_filtered (gdb_stdlog,
@@ -478,7 +478,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  struct inferior *parent_inf, *child_inf;
 
 	  /* Add process to GDB's tables.  */
-	  child_inf = add_inferior (ptid_get_pid (child_ptid));
+	  child_inf = add_inferior (child_ptid.pid ());
 
 	  parent_inf = current_inferior ();
 	  child_inf->attach_flag = parent_inf->attach_flag;
@@ -565,7 +565,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
       /* Add the new inferior first, so that the target_detach below
 	 doesn't unpush the target.  */
 
-      child_inf = add_inferior (ptid_get_pid (child_ptid));
+      child_inf = add_inferior (child_ptid.pid ());
 
       parent_inf = current_inferior ();
       child_inf->attach_flag = parent_inf->attach_flag;
@@ -600,7 +600,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  if (print_inferior_events)
 	    {
 	      /* Ensure that we have a process ptid.  */
-	      ptid_t process_ptid = ptid_t (ptid_get_pid (parent_ptid));
+	      ptid_t process_ptid = ptid_t (parent_ptid.pid ());
 
 	      target_terminal::ours_for_output ();
 	      fprintf_filtered (gdb_stdlog,
@@ -865,7 +865,7 @@ proceed_after_vfork_done (struct thread_info *thread,
 {
   int pid = * (int *) arg;
 
-  if (ptid_get_pid (thread->ptid) == pid
+  if (thread->ptid.pid () == pid
       && is_running (thread->ptid)
       && !is_executing (thread->ptid)
       && !thread->stop_requested
@@ -1083,7 +1083,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
 {
   struct thread_info *th, *tmp;
   struct inferior *inf = current_inferior ();
-  int pid = ptid_get_pid (ptid);
+  int pid = ptid.pid ();
   ptid_t process_ptid;
 
   /* This is an exec event that we actually wish to pay attention to.
@@ -1129,7 +1129,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
      stop provides a nicer sequence of events for user and MI
      notifications.  */
   ALL_THREADS_SAFE (th, tmp)
-    if (ptid_get_pid (th->ptid) == pid && !ptid_equal (th->ptid, ptid))
+    if (th->ptid.pid () == pid && !ptid_equal (th->ptid, ptid))
       delete_thread (th->ptid);
 
   /* We also need to clear any left over stale state for the
@@ -1558,7 +1558,7 @@ displaced_step_in_progress_thread (ptid_t ptid)
 
   gdb_assert (!ptid_equal (ptid, null_ptid));
 
-  displaced = get_displaced_stepping_state (ptid_get_pid (ptid));
+  displaced = get_displaced_stepping_state (ptid.pid ());
 
   return (displaced != NULL && ptid_equal (displaced->step_ptid, ptid));
 }
@@ -1608,7 +1608,7 @@ struct displaced_step_closure*
 get_displaced_step_closure_by_addr (CORE_ADDR addr)
 {
   struct displaced_step_inferior_state *displaced
-    = get_displaced_stepping_state (ptid_get_pid (inferior_ptid));
+    = get_displaced_stepping_state (inferior_ptid.pid ());
 
   /* If checking the mode of displaced instruction in copy area.  */
   if (displaced && !ptid_equal (displaced->step_ptid, null_ptid)
@@ -1685,7 +1685,7 @@ use_displaced_stepping (struct thread_info *tp)
   struct gdbarch *gdbarch = regcache->arch ();
   struct displaced_step_inferior_state *displaced_state;
 
-  displaced_state = get_displaced_stepping_state (ptid_get_pid (tp->ptid));
+  displaced_state = get_displaced_stepping_state (tp->ptid.pid ());
 
   return (((can_use_displaced_stepping == AUTO_BOOLEAN_AUTO
 	    && target_is_non_stop_p ())
@@ -1775,7 +1775,7 @@ displaced_step_prepare_throw (ptid_t ptid)
   /* We have to displaced step one thread at a time, as we only have
      access to a single scratch space per inferior.  */
 
-  displaced = add_displaced_stepping_state (ptid_get_pid (ptid));
+  displaced = add_displaced_stepping_state (ptid.pid ());
 
   if (!ptid_equal (displaced->step_ptid, null_ptid))
     {
@@ -1918,7 +1918,7 @@ displaced_step_prepare (ptid_t ptid)
 
       /* Disable further displaced stepping attempts.  */
       displaced_state
-	= get_displaced_stepping_state (ptid_get_pid (ptid));
+	= get_displaced_stepping_state (ptid.pid ());
       displaced_state->failed_before = 1;
     }
   END_CATCH
@@ -1964,7 +1964,7 @@ displaced_step_fixup (ptid_t event_ptid, enum gdb_signal signal)
 {
   struct cleanup *old_cleanups;
   struct displaced_step_inferior_state *displaced
-    = get_displaced_stepping_state (ptid_get_pid (event_ptid));
+    = get_displaced_stepping_state (event_ptid.pid ());
   int ret;
 
   /* Was any thread of this process doing a displaced step?  */
@@ -2082,7 +2082,7 @@ start_step_over (void)
 
       /* If this inferior already has a displaced step in process,
 	 don't start a new one.  */
-      if (displaced_step_in_progress (ptid_get_pid (tp->ptid)))
+      if (displaced_step_in_progress (tp->ptid.pid ()))
 	continue;
 
       step_what = thread_still_needs_step_over (tp);
@@ -2277,7 +2277,7 @@ user_visible_resume_ptid (int step)
     {
       /* Resume all threads of the current process (and none of other
 	 processes).  */
-      resume_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+      resume_ptid = ptid_t (inferior_ptid.pid ());
     }
   else
     {
@@ -2344,7 +2344,7 @@ do_target_resume (ptid_t resume_ptid, int step, enum gdb_signal sig)
        return to the scratch pad area, which would no longer be
        valid.  */
   if (step_over_info_valid_p ()
-      || displaced_step_in_progress (ptid_get_pid (tp->ptid)))
+      || displaced_step_in_progress (tp->ptid.pid ()))
     target_pass_signals (0, NULL);
   else
     target_pass_signals ((int) GDB_SIGNAL_LAST, signal_pass);
@@ -2582,7 +2582,7 @@ resume_1 (enum gdb_signal sig)
 	     execute instructions due to displaced stepping.  */
 	  pc = regcache_read_pc (get_thread_regcache (inferior_ptid));
 
-	  displaced = get_displaced_stepping_state (ptid_get_pid (inferior_ptid));
+	  displaced = get_displaced_stepping_state (inferior_ptid.pid ());
 	  step = gdbarch_displaced_step_hw_singlestep (gdbarch,
 						       displaced->step_closure);
 	}
@@ -3431,14 +3431,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
      is set.  */
 
   stb.printf ("infrun: target_wait (%d.%ld.%ld",
-	      ptid_get_pid (waiton_ptid),
+	      waiton_ptid.pid (),
 	      ptid_get_lwp (waiton_ptid),
 	      ptid_get_tid (waiton_ptid));
-  if (ptid_get_pid (waiton_ptid) != -1)
+  if (waiton_ptid.pid () != -1)
     stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
   stb.printf (", status) =\n");
   stb.printf ("infrun:   %d.%ld.%ld [%s],\n",
-	      ptid_get_pid (result_ptid),
+	      result_ptid.pid (),
 	      ptid_get_lwp (result_ptid),
 	      ptid_get_tid (result_ptid),
 	      target_pid_to_str (result_ptid));
@@ -4395,7 +4395,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
       fprintf_unfiltered (gdb_stdlog,
 			  "infrun: saving status %s for %d.%ld.%ld\n",
 			  statstr.c_str (),
-			  ptid_get_pid (tp->ptid),
+			  tp->ptid.pid (),
 			  ptid_get_lwp (tp->ptid),
 			  ptid_get_tid (tp->ptid));
     }
@@ -4633,7 +4633,7 @@ stop_all_threads (void)
 					  "infrun: target_wait %s, saving "
 					  "status for %d.%ld.%ld\n",
 					  statstr.c_str (),
-					  ptid_get_pid (t->ptid),
+					  t->ptid.pid (),
 					  ptid_get_lwp (t->ptid),
 					  ptid_get_tid (t->ptid));
 		    }
@@ -4924,7 +4924,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
 	   process as not-executing so that finish_thread_state marks
 	   them stopped (in the user's perspective) if/when we present
 	   the stop to the user.  */
-	mark_ptid = ptid_t (ptid_get_pid (ecs->ptid));
+	mark_ptid = ptid_t (ecs->ptid.pid ());
       }
     else
       mark_ptid = ecs->ptid;
@@ -5150,7 +5150,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
 	    if (ecs->ws.kind == TARGET_WAITKIND_FORKED)
 	      {
 		struct displaced_step_inferior_state *displaced
-		  = get_displaced_stepping_state (ptid_get_pid (ecs->ptid));
+		  = get_displaced_stepping_state (ecs->ptid.pid ());
 
 		/* Restore scratch pad for child process.  */
 		displaced_step_restore (displaced, ecs->ws.value.related_pid);
@@ -7113,7 +7113,7 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
 	  /* Ignore threads of processes the caller is not
 	     resuming.  */
 	  if (!sched_multi
-	      && ptid_get_pid (tp->ptid) != ptid_get_pid (ecs->ptid))
+	      && tp->ptid.pid () != ecs->ptid.pid ())
 	    continue;
 
 	  /* When stepping over a breakpoint, we lock all threads
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index a0e16df553..aaf6466a15 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -83,14 +83,14 @@ add_fork (pid_t pid)
 {
   struct fork_info *fp;
 
-  if (fork_list == NULL && pid != ptid_get_pid (inferior_ptid))
+  if (fork_list == NULL && pid != inferior_ptid.pid ())
     {
       /* Special case -- if this is the first fork in the list
 	 (the list is hitherto empty), and if this new fork is
 	 NOT the current inferior_ptid, then add inferior_ptid
 	 first, as a special zeroeth fork id.  */
       highest_fork_num = -1;
-      add_fork (ptid_get_pid (inferior_ptid));	/* safe recursion */
+      add_fork (inferior_ptid.pid ());	/* safe recursion */
     }
 
   fp = XCNEW (struct fork_info);
@@ -141,7 +141,7 @@ delete_fork (ptid_t ptid)
 
   fpprev = NULL;
 
-  linux_target->low_forget_process (ptid_get_pid (ptid));
+  linux_target->low_forget_process (ptid.pid ());
 
   for (fp = fork_list; fp; fpprev = fp, fp = fp->next)
     if (ptid_equal (fp->ptid, ptid))
@@ -203,7 +203,7 @@ find_fork_pid (pid_t pid)
   struct fork_info *fp;
 
   for (fp = fork_list; fp; fp = fp->next)
-    if (pid == ptid_get_pid (fp->ptid))
+    if (pid == fp->ptid.pid ())
       return fp;
 
   return NULL;
@@ -304,7 +304,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
       /* Now save the 'state' (file position) of all open file descriptors.
 	 Unfortunately fork does not take care of that for us...  */
       snprintf (path, PATH_MAX, "/proc/%ld/fd",
-		(long) ptid_get_pid (fp->ptid));
+		(long) fp->ptid.pid ());
       if ((d = opendir (path)) != NULL)
 	{
 	  long tmp;
@@ -354,7 +354,7 @@ linux_fork_killall (void)
 
   for (fp = fork_list; fp; fp = fp->next)
     {
-      pid = ptid_get_pid (fp->ptid);
+      pid = fp->ptid.pid ();
       do {
 	/* Use SIGKILL instead of PTRACE_KILL because the former works even
 	   if the thread is running, while the later doesn't.  */
@@ -382,7 +382,7 @@ linux_fork_mourn_inferior (void)
      Do not check whether this succeeds though, since we may be
      dealing with a process that we attached to.  Such a process will
      only report its exit status to its original parent.  */
-  waitpid (ptid_get_pid (inferior_ptid), &status, 0);
+  waitpid (inferior_ptid.pid (), &status, 0);
 
   /* OK, presumably inferior_ptid is the one who has exited.
      We need to delete that one from the fork_list, and switch
@@ -415,7 +415,7 @@ linux_fork_detach (int from_tty)
      delete it from the fork_list, and switch to the next available
      fork.  */
 
-  if (ptrace (PTRACE_DETACH, ptid_get_pid (inferior_ptid), 0, 0))
+  if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0))
     error (_("Unable to detach %s"), target_pid_to_str (inferior_ptid));
 
   delete_fork (inferior_ptid);
@@ -521,7 +521,7 @@ delete_checkpoint_command (const char *args, int from_tty)
     error (_("\
 Please switch to another checkpoint before deleting the current one"));
 
-  if (ptrace (PTRACE_KILL, ptid_get_pid (ptid), 0, 0))
+  if (ptrace (PTRACE_KILL, ptid.pid (), 0, 0))
     error (_("Unable to kill pid %s"), target_pid_to_str (ptid));
 
   fi = find_fork_ptid (ptid);
@@ -540,7 +540,7 @@ Please switch to another checkpoint before deleting the current one"));
   if ((!find_thread_ptid (pptid) && find_fork_ptid (pptid))
       || (find_thread_ptid (pptid) && is_stopped (pptid)))
     {
-      if (inferior_call_waitpid (pptid, ptid_get_pid (ptid)))
+      if (inferior_call_waitpid (pptid, ptid.pid ()))
         warning (_("Unable to wait pid %s"), target_pid_to_str (ptid));
     }
 }
@@ -561,7 +561,7 @@ detach_checkpoint_command (const char *args, int from_tty)
     error (_("\
 Please switch to another checkpoint before detaching the current one"));
 
-  if (ptrace (PTRACE_DETACH, ptid_get_pid (ptid), 0, 0))
+  if (ptrace (PTRACE_DETACH, ptid.pid (), 0, 0))
     error (_("Unable to detach %s"), target_pid_to_str (ptid));
 
   if (from_tty)
@@ -647,7 +647,7 @@ inf_has_multiple_thread_cb (struct thread_info *tp, void *data)
 {
   int *count_p = (int *) data;
   
-  if (current_inferior ()->pid == ptid_get_pid (tp->ptid))
+  if (current_inferior ()->pid == tp->ptid.pid ())
     (*count_p)++;
   
   /* Stop the iteration if multiple threads have been detected.  */
@@ -700,7 +700,7 @@ checkpoint_command (const char *args, int from_tty)
   /* Tell linux-nat.c that we're checkpointing this inferior.  */
   {
     scoped_restore save_pid
-      = make_scoped_restore (&checkpointing_pid, ptid_get_pid (inferior_ptid));
+      = make_scoped_restore (&checkpointing_pid, inferior_ptid.pid ());
 
     ret = call_function_by_hand (fork_fn, NULL, 0, &ret);
   }
@@ -723,7 +723,7 @@ checkpoint_command (const char *args, int from_tty)
 	{
 	  parent_pid = ptid_get_lwp (last_target_ptid);
 	  if (parent_pid == 0)
-	    parent_pid = ptid_get_pid (last_target_ptid);
+	    parent_pid = last_target_ptid.pid ();
 	  printf_filtered (_("   gdb says parent = %ld.\n"),
 			   (long) parent_pid);
 	}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c17f541591..d3dfd13bfa 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -410,7 +410,7 @@ linux_nat_target::post_attach (int pid)
 void
 linux_nat_target::post_startup_inferior (ptid_t ptid)
 {
-  linux_init_ptrace (ptid_get_pid (ptid), 0);
+  linux_init_ptrace (ptid.pid (), 0);
 }
 
 /* Return the number of known LWPs in the tgid given by PID.  */
@@ -422,7 +422,7 @@ num_lwps (int pid)
   struct lwp_info *lp;
 
   for (lp = lwp_list; lp; lp = lp->next)
-    if (ptid_get_pid (lp->ptid) == pid)
+    if (lp->ptid.pid () == pid)
       count++;
 
   return count;
@@ -821,7 +821,7 @@ lwp_lwpid_htab_remove_pid (void **slot, void *info)
   struct lwp_info *lp = (struct lwp_info *) *slot;
   int pid = *(int *) info;
 
-  if (ptid_get_pid (lp->ptid) == pid)
+  if (lp->ptid.pid () == pid)
     {
       htab_clear_slot (lwp_lwpid_htab, slot);
       lwp_list_remove (lp);
@@ -938,7 +938,7 @@ find_lwp_pid (ptid_t ptid)
   if (ptid_lwp_p (ptid))
     lwp = ptid_get_lwp (ptid);
   else
-    lwp = ptid_get_pid (ptid);
+    lwp = ptid.pid ();
 
   dummy.ptid = ptid_t (0, lwp, 0);
   lp = (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
@@ -978,7 +978,7 @@ linux_nat_switch_fork (ptid_t new_ptid)
 {
   struct lwp_info *lp;
 
-  purge_lwp_list (ptid_get_pid (inferior_ptid));
+  purge_lwp_list (inferior_ptid.pid ());
 
   lp = add_lwp (new_ptid);
   lp->stopped = 1;
@@ -1196,8 +1196,8 @@ linux_nat_target::attach (const char *args, int from_tty)
 
   /* The ptrace base target adds the main thread with (pid,0,0)
      format.  Decorate it with lwp info.  */
-  ptid = ptid_t (ptid_get_pid (inferior_ptid),
-		 ptid_get_pid (inferior_ptid),
+  ptid = ptid_t (inferior_ptid.pid (),
+		 inferior_ptid.pid (),
 		 0);
   thread_change_ptid (inferior_ptid, ptid);
 
@@ -1245,7 +1245,7 @@ linux_nat_target::attach (const char *args, int from_tty)
   if (debug_linux_nat)
     fprintf_unfiltered (gdb_stdlog,
 			"LNA: waitpid %ld, saving status %s\n",
-			(long) ptid_get_pid (lp->ptid), status_to_str (status));
+			(long) lp->ptid.pid (), status_to_str (status));
 
   lp->status = status;
 
@@ -1256,7 +1256,7 @@ linux_nat_target::attach (const char *args, int from_tty)
      of threads/LWPs, and those structures may well be corrupted.
      Note that once thread_db is loaded, we'll still use it to list
      threads and associate pthread info with each LWP.  */
-  linux_proc_attach_tgid_threads (ptid_get_pid (lp->ptid),
+  linux_proc_attach_tgid_threads (lp->ptid.pid (),
 				  attach_proc_task_lwp_callback);
 
   if (target_can_async_p ())
@@ -1451,7 +1451,7 @@ detach_callback (struct lwp_info *lp, void *data)
   /* We don't actually detach from the thread group leader just yet.
      If the thread group exits, we must reap the zombie clone lwps
      before we're able to reap the leader.  */
-  if (ptid_get_lwp (lp->ptid) != ptid_get_pid (lp->ptid))
+  if (ptid_get_lwp (lp->ptid) != lp->ptid.pid ())
     detach_one_lwp (lp, NULL);
   return 0;
 }
@@ -1969,7 +1969,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	}
 
       if (event == PTRACE_EVENT_FORK
-	  && linux_fork_checkpointing_p (ptid_get_pid (lp->ptid)))
+	  && linux_fork_checkpointing_p (lp->ptid.pid ()))
 	{
 	  /* Handle checkpointing by linux-fork.c here as a special
 	     case.  We don't want the follow-fork-mode or 'catch fork'
@@ -2008,7 +2008,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 				"from LWP %d, new child is LWP %ld\n",
 				pid, new_pid);
 
-	  new_lp = add_lwp (ptid_t (ptid_get_pid (lp->ptid), new_pid, 0));
+	  new_lp = add_lwp (ptid_t (lp->ptid.pid (), new_pid, 0));
 	  new_lp->stopped = 1;
 	  new_lp->resumed = 1;
 
@@ -2181,7 +2181,7 @@ wait_lwp (struct lwp_info *lp)
 	 Therefore always use WNOHANG with sigsuspend - it is equivalent to
 	 waiting waitpid but linux_proc_pid_is_zombie is safe this way.  */
 
-      if (ptid_get_pid (lp->ptid) == ptid_get_lwp (lp->ptid)
+      if (lp->ptid.pid () == ptid_get_lwp (lp->ptid)
 	  && linux_proc_pid_is_zombie (ptid_get_lwp (lp->ptid)))
 	{
 	  thread_dead = 1;
@@ -2219,11 +2219,11 @@ wait_lwp (struct lwp_info *lp)
       if (WIFEXITED (status) || WIFSIGNALED (status))
 	{
 	  if (report_thread_events
-	      || ptid_get_pid (lp->ptid) == ptid_get_lwp (lp->ptid))
+	      || lp->ptid.pid () == ptid_get_lwp (lp->ptid))
 	    {
 	      if (debug_linux_nat)
 		fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n",
-				    ptid_get_pid (lp->ptid));
+				    lp->ptid.pid ());
 
 	      /* If this is the leader exiting, it means the whole
 		 process is gone.  Store the status to report to the
@@ -2251,7 +2251,7 @@ wait_lwp (struct lwp_info *lp)
 
   if (lp->must_set_ptrace_flags)
     {
-      struct inferior *inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+      struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
       int options = linux_nat_ptrace_options (inf->attach_flag);
 
       linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
@@ -2967,7 +2967,7 @@ linux_nat_filter_event (int lwpid, int status)
 
   if (WIFSTOPPED (status) && lp->must_set_ptrace_flags)
     {
-      struct inferior *inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+      struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
       int options = linux_nat_ptrace_options (inf->attach_flag);
 
       linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
@@ -3008,7 +3008,7 @@ linux_nat_filter_event (int lwpid, int status)
   if (WIFEXITED (status) || WIFSIGNALED (status))
     {
       if (!report_thread_events
-	  && num_lwps (ptid_get_pid (lp->ptid)) > 1)
+	  && num_lwps (lp->ptid.pid ()) > 1)
 	{
 	  if (debug_linux_nat)
 	    fprintf_unfiltered (gdb_stdlog,
@@ -3119,7 +3119,7 @@ linux_nat_filter_event (int lwpid, int status)
 		 will receive it - unless they're using CLONE_THREAD to
 		 share signals.  Since we only want to report it once, we
 		 mark it as ignored for all LWPs except this one.  */
-	      iterate_over_lwps (ptid_t (ptid_get_pid (lp->ptid)),
+	      iterate_over_lwps (ptid_t (lp->ptid.pid ()),
 					      set_ignore_sigint, NULL);
 	      lp->ignore_sigint = 0;
 	    }
@@ -3221,7 +3221,7 @@ filter_exit_event (struct lwp_info *event_child,
 {
   ptid_t ptid = event_child->ptid;
 
-  if (num_lwps (ptid_get_pid (ptid)) > 1)
+  if (num_lwps (ptid.pid ()) > 1)
     {
       if (report_thread_events)
 	ourstatus->kind = TARGET_WAITKIND_THREAD_EXITED;
@@ -3253,8 +3253,8 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
     {
       /* Upgrade the main thread's ptid.  */
       thread_change_ptid (inferior_ptid,
-			  ptid_t (ptid_get_pid (inferior_ptid),
-				  ptid_get_pid (inferior_ptid), 0));
+			  ptid_t (inferior_ptid.pid (),
+				  inferior_ptid.pid (), 0));
 
       lp = add_initial_lwp (inferior_ptid);
       lp->resumed = 1;
@@ -3682,7 +3682,7 @@ kill_unfollowed_fork_children (struct inferior *inf)
 	    || ws->kind == TARGET_WAITKIND_VFORKED)
 	  {
 	    ptid_t child_ptid = ws->value.related_pid;
-	    int child_pid = ptid_get_pid (child_ptid);
+	    int child_pid = child_ptid.pid ();
 	    int child_lwp = ptid_get_lwp (child_ptid);
 
 	    kill_one_lwp (child_lwp);
@@ -3707,7 +3707,7 @@ linux_nat_target::kill ()
     linux_fork_killall ();
   else
     {
-      ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid));
+      ptid_t ptid = ptid_t (inferior_ptid.pid ());
 
       /* Stop all threads before killing them, since ptrace requires
 	 that the thread is stopped to sucessfully PTRACE_KILL.  */
@@ -3729,7 +3729,7 @@ linux_nat_target::kill ()
 void
 linux_nat_target::mourn_inferior ()
 {
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
 
   purge_lwp_list (pid);
 
@@ -3778,7 +3778,7 @@ linux_xfer_siginfo (enum target_object object,
 
   pid = ptid_get_lwp (inferior_ptid);
   if (pid == 0)
-    pid = ptid_get_pid (inferior_ptid);
+    pid = inferior_ptid.pid ();
 
   if (offset > sizeof (siginfo))
     return TARGET_XFER_E_IO;
@@ -3928,8 +3928,8 @@ linux_nat_target::pid_to_str (ptid_t ptid)
   static char buf[64];
 
   if (ptid_lwp_p (ptid)
-      && (ptid_get_pid (ptid) != ptid_get_lwp (ptid)
-	  || num_lwps (ptid_get_pid (ptid)) > 1))
+      && (ptid.pid () != ptid_get_lwp (ptid)
+	  || num_lwps (ptid.pid ()) > 1))
     {
       snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
       return buf;
@@ -4232,7 +4232,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
 {
   char s[IPA_CMD_BUF_SIZE];
   struct cleanup *old_chain;
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
   std::vector<static_tracepoint_marker> markers;
   const char *p = s;
   ptid_t ptid = ptid_t (pid, 0, 0);
@@ -4497,12 +4497,12 @@ linux_nat_target::thread_address_space (ptid_t ptid)
       /* An (lwpid,0,0) ptid.  Look up the lwp object to get at the
 	 tgid.  */
       lwp = find_lwp_pid (ptid);
-      pid = ptid_get_pid (lwp->ptid);
+      pid = lwp->ptid.pid ();
     }
   else
     {
       /* A (pid,lwpid,0) ptid.  */
-      pid = ptid_get_pid (ptid);
+      pid = ptid.pid ();
     }
 
   inf = find_inferior_pid (pid);
@@ -4640,7 +4640,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
 
   pid = ptid_get_lwp (ptid);
   if (pid == 0)
-    pid = ptid_get_pid (ptid);
+    pid = ptid.pid ();
 
   errno = 0;
   ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 5a40a6802a..da8a1f07f7 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1386,7 +1386,7 @@ static int
 find_signalled_thread (struct thread_info *info, void *data)
 {
   if (info->suspend.stop_signal != GDB_SIGNAL_0
-      && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
+      && info->ptid.pid () == inferior_ptid.pid ())
     return 1;
 
   return 0;
@@ -1745,7 +1745,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
   gdb_assert (p != NULL);
 
   /* Obtaining PID and filename.  */
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   xsnprintf (filename, sizeof (filename), "/proc/%d/cmdline", (int) pid);
   /* The full name of the program which generated the corefile.  */
   gdb::unique_xmalloc_ptr<char> fname
@@ -1959,7 +1959,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
     {
       if (thr == signalled_thr)
 	continue;
-      if (ptid_get_pid (thr->ptid) != ptid_get_pid (inferior_ptid))
+      if (thr->ptid.pid () != inferior_ptid.pid ())
 	continue;
 
       linux_corefile_thread (thr, &thread_args);
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 3a15b78b92..c2c9a6253c 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -229,7 +229,7 @@ add_thread_db_info (void *handle)
 {
   struct thread_db_info *info = XCNEW (struct thread_db_info);
 
-  info->pid = ptid_get_pid (inferior_ptid);
+  info->pid = inferior_ptid.pid ();
   info->handle = handle;
 
   /* The workaround works by reading from /proc/pid/status, so it is
@@ -394,7 +394,7 @@ thread_from_lwp (ptid_t ptid)
      LWP.  */
   gdb_assert (ptid_get_lwp (ptid) != 0);
 
-  info = get_thread_db_info (ptid_get_pid (ptid));
+  info = get_thread_db_info (ptid.pid ());
 
   /* Access an lwp we know is stopped.  */
   info->proc_handle.ptid = ptid;
@@ -422,7 +422,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child)
 {
   struct thread_db_info *info;
 
-  info = get_thread_db_info (ptid_get_pid (child));
+  info = get_thread_db_info (child.pid ());
 
   if (info == NULL)
     return 0;
@@ -867,7 +867,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
      td_ta_map_lwp2thr uses ps_get_thread_area, but we can't use that
      currently on core targets, as it uses ptrace directly.  */
   if (target_has_execution
-      && linux_proc_task_list_dir_exists (ptid_get_pid (inferior_ptid)))
+      && linux_proc_task_list_dir_exists (inferior_ptid.pid ()))
     info->td_ta_thr_iter_p = NULL;
   else
     CHK (TDB_VERBOSE_DLSYM (info, td_ta_thr_iter));
@@ -886,12 +886,12 @@ try_thread_db_load_1 (struct thread_db_info *info)
   if (info->td_ta_thr_iter_p == NULL)
     {
       struct lwp_info *lp;
-      int pid = ptid_get_pid (inferior_ptid);
+      int pid = inferior_ptid.pid ();
 
       linux_stop_and_wait_all_lwps ();
 
       ALL_LWPS (lp)
-	if (ptid_get_pid (lp->ptid) == pid)
+	if (lp->ptid.pid () == pid)
 	  thread_from_lwp (lp->ptid);
 
       linux_unstop_all_lwps ();
@@ -998,7 +998,7 @@ try_thread_db_load (const char *library, int check_auto_load_safe)
     return 1;
 
   /* This library "refused" to work on current inferior.  */
-  delete_thread_db_info (ptid_get_pid (inferior_ptid));
+  delete_thread_db_info (inferior_ptid.pid ());
   return 0;
 }
 
@@ -1170,7 +1170,7 @@ thread_db_load (void)
 {
   struct thread_db_info *info;
 
-  info = get_thread_db_info (ptid_get_pid (inferior_ptid));
+  info = get_thread_db_info (inferior_ptid.pid ());
 
   if (info != NULL)
     return 1;
@@ -1279,7 +1279,7 @@ check_pid_namespace_match (void)
 	 child's thread list, we'll mistakenly think it has no threads
 	 since the thread PID fields won't match the PID we give to
 	 libthread_db.  */
-      if (!linux_ns_same (ptid_get_pid (inferior_ptid), LINUX_NS_PID))
+      if (!linux_ns_same (inferior_ptid.pid (), LINUX_NS_PID))
 	{
 	  warning (_ ("Target and debugger are in different PID "
 		      "namespaces; thread lists and other data are "
@@ -1379,7 +1379,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
       return ptid;
     }
 
-  info = get_thread_db_info (ptid_get_pid (ptid));
+  info = get_thread_db_info (ptid.pid ());
 
   /* If this process isn't using thread_db, we're done.  */
   if (info == NULL)
@@ -1389,7 +1389,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
     {
       /* New image, it may or may not end up using thread_db.  Assume
 	 not unless we find otherwise.  */
-      delete_thread_db_info (ptid_get_pid (ptid));
+      delete_thread_db_info (ptid.pid ());
       if (!thread_db_list)
 	unpush_target (&the_thread_db_target);
 
@@ -1405,7 +1405,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 void
 thread_db_target::mourn_inferior ()
 {
-  delete_thread_db_info (ptid_get_pid (inferior_ptid));
+  delete_thread_db_info (inferior_ptid.pid ());
 
   beneath ()->mourn_inferior ();
 
@@ -1545,7 +1545,7 @@ thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new)
   struct thread_db_info *info;
   int i, loop;
 
-  info = get_thread_db_info (ptid_get_pid (ptid));
+  info = get_thread_db_info (ptid.pid ());
 
   /* Access an lwp we know is stopped.  */
   info->proc_handle.ptid = ptid;
@@ -1712,7 +1712,7 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
     {
       td_err_e err;
       psaddr_t address;
-      thread_db_info *info = get_thread_db_info (ptid_get_pid (ptid));
+      thread_db_info *info = get_thread_db_info (ptid.pid ());
       thread_db_thread_info *priv = get_thread_db_thread_info (thread_info);
 
       /* Finally, get the address of the variable.  */
@@ -1780,7 +1780,7 @@ ptid_t
 thread_db_target::get_ada_task_ptid (long lwp, long thread)
 {
   /* NPTL uses a 1:1 model, so the LWP id suffices.  */
-  return ptid_t (ptid_get_pid (inferior_ptid), lwp, 0);
+  return ptid_t (inferior_ptid.pid (), lwp, 0);
 }
 
 void
@@ -1789,9 +1789,9 @@ thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
   struct thread_db_info *info;
 
   if (ptid_equal (ptid, minus_one_ptid))
-    info = get_thread_db_info (ptid_get_pid (inferior_ptid));
+    info = get_thread_db_info (inferior_ptid.pid ());
   else
-    info = get_thread_db_info (ptid_get_pid (ptid));
+    info = get_thread_db_info (ptid.pid ());
 
   /* This workaround is only needed for child fork lwps stopped in a
      PTRACE_O_TRACEFORK event.  When the inferior is resumed, the
@@ -1919,7 +1919,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
 static void
 maintenance_check_libthread_db (const char *args, int from_tty)
 {
-  int inferior_pid = ptid_get_pid (inferior_ptid);
+  int inferior_pid = inferior_ptid.pid ();
   struct thread_db_info *info;
 
   if (inferior_pid == 0)
diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c
index 2111c27d82..120d4c1601 100644
--- a/gdb/m68k-bsd-nat.c
+++ b/gdb/m68k-bsd-nat.c
@@ -117,7 +117,7 @@ m68kbsd_collect_fpregset (struct regcache *regcache,
 void
 m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
     {
@@ -146,7 +146,7 @@ m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 void
 m68k_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
     {
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index ebc899f631..0e10d89019 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -951,7 +951,7 @@ mi_output_running_pid (struct thread_info *info, void *arg)
       if (mi == NULL)
 	continue;
 
-      if (ptid_get_pid (*ptid) == ptid_get_pid (info->ptid))
+      if (ptid->pid () == info->ptid.pid ())
 	fprintf_unfiltered (mi->raw_stdout,
 			    "*running,thread-id=\"%d\"\n",
 			    info->global_num);
@@ -989,7 +989,7 @@ mi_on_resume_1 (struct mi_interp *mi, ptid_t ptid)
 			  current_token ? current_token : "");
     }
 
-  if (ptid_get_pid (ptid) == -1)
+  if (ptid.pid () == -1)
     fprintf_unfiltered (mi->raw_stdout, "*running,thread-id=\"all\"\n");
   else if (ptid_is_pid (ptid))
     {
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 14b3e6853a..10d886ced9 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -246,7 +246,7 @@ proceed_thread (struct thread_info *thread, int pid)
   if (!is_stopped (thread->ptid))
     return;
 
-  if (pid != 0 && ptid_get_pid (thread->ptid) != pid)
+  if (pid != 0 && thread->ptid.pid () != pid)
     return;
 
   switch_to_thread (thread->ptid);
@@ -348,7 +348,7 @@ interrupt_thread_callback (struct thread_info *thread, void *arg)
   if (!is_running (thread->ptid))
     return 0;
 
-  if (ptid_get_pid (thread->ptid) != pid)
+  if (thread->ptid.pid () != pid)
     return 0;
 
   target_stop (thread->ptid);
@@ -409,7 +409,7 @@ run_one_inferior (struct inferior *inf, void *arg)
 
   if (inf->pid != 0)
     {
-      if (inf->pid != ptid_get_pid (inferior_ptid))
+      if (inf->pid != inferior_ptid.pid ())
 	{
 	  struct thread_info *tp;
 
@@ -492,7 +492,7 @@ find_thread_of_process (struct thread_info *ti, void *p)
 {
   int pid = *(int *)p;
 
-  if (ptid_get_pid (ti->ptid) == pid && !is_exited (ti->ptid))
+  if (ti->ptid.pid () == pid && !is_exited (ti->ptid))
     return 1;
 
   return 0;
@@ -628,7 +628,7 @@ collect_cores (struct thread_info *ti, void *xdata)
 {
   struct collect_cores_data *data = (struct collect_cores_data *) xdata;
 
-  if (ptid_get_pid (ti->ptid) == data->pid)
+  if (ti->ptid.pid () == data->pid)
     {
       int core = target_core_of_thread (ti->ptid);
 
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index beb0ea0a26..8d87dc82fb 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -462,7 +462,7 @@ mips_linux_nat_target::read_description ()
 
       tid = ptid_get_lwp (inferior_ptid);
       if (tid == 0)
-	tid = ptid_get_pid (inferior_ptid);
+	tid = inferior_ptid.pid ();
 
       errno = 0;
       ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);
diff --git a/gdb/mips-nbsd-nat.c b/gdb/mips-nbsd-nat.c
index 4c61081a38..b14828f5f5 100644
--- a/gdb/mips-nbsd-nat.c
+++ b/gdb/mips-nbsd-nat.c
@@ -49,7 +49,7 @@ getregs_supplies (struct gdbarch *gdbarch, int regno)
 void
 mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   struct gdbarch *gdbarch = regcache->arch ();
   if (regno == -1 || getregs_supplies (gdbarch, regno))
@@ -79,7 +79,7 @@ mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
 void
 mips_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   struct gdbarch *gdbarch = regcache->arch ();
   if (regno == -1 || getregs_supplies (gdbarch, regno))
diff --git a/gdb/mips64-obsd-nat.c b/gdb/mips64-obsd-nat.c
index 4627cbe0a9..620945e692 100644
--- a/gdb/mips64-obsd-nat.c
+++ b/gdb/mips64-obsd-nat.c
@@ -89,7 +89,7 @@ void
 mips64_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
@@ -104,7 +104,7 @@ static void
 mips64_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index 22b265eaf0..3de3e5bec1 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -357,7 +357,7 @@ aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
 				 int is_watchpoint, unsigned int idx)
 {
   struct aarch64_dr_update_callback_param param;
-  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
 
   param.is_watchpoint = is_watchpoint;
   param.idx = idx;
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
index 35ecdc210d..c3c29a0665 100644
--- a/gdb/nat/aarch64-linux.c
+++ b/gdb/nat/aarch64-linux.c
@@ -47,7 +47,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       ptid_t ptid = ptid_of_lwp (lwp);
       int tid = ptid_get_lwp (ptid);
       struct aarch64_debug_reg_state *state
-	= aarch64_get_debug_reg_state (ptid_get_pid (ptid));
+	= aarch64_get_debug_reg_state (ptid.pid ());
 
       if (show_debug_regs)
 	debug_printf ("prepare_to_resume thread %d\n", tid);
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 8eadf7a506..b2c30b3e47 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -471,7 +471,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
 
   pid = ptid_get_lwp (ptid);
   if (pid == 0)
-    pid = ptid_get_pid (ptid);
+    pid = ptid.pid ();
 
   errno = 0;
   scoped_fd fd (syscall (SYS_perf_event_open, &bts->attr, pid, -1, -1, 0));
@@ -587,7 +587,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
 
   pid = ptid_get_lwp (ptid);
   if (pid == 0)
-    pid = ptid_get_pid (ptid);
+    pid = ptid.pid ();
 
   gdb::unique_xmalloc_ptr<btrace_target_info> tinfo
     (XCNEW (btrace_target_info));
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 1f3a911473..358a89eb5e 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -70,7 +70,7 @@ linux_common_core_of_thread (ptid_t ptid)
   int core;
 
   sprintf (filename, "/proc/%lld/task/%lld/stat",
-	   (PID_T) ptid_get_pid (ptid), (PID_T) ptid_get_lwp (ptid));
+	   (PID_T) ptid.pid (), (PID_T) ptid_get_lwp (ptid));
   gdb_file_up f = gdb_fopen_cloexec (filename, "r");
   if (!f)
     return -1;
diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index 5a9464195d..a672cdfc3a 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -239,8 +239,8 @@ linux_proc_tid_get_name (ptid_t ptid)
   static char comm_buf[TASK_COMM_LEN];
   char comm_path[100];
   const char *comm_val;
-  pid_t pid = ptid_get_pid (ptid);
-  pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : ptid_get_pid (ptid);
+  pid_t pid = ptid.pid ();
+  pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : ptid.pid ();
 
   xsnprintf (comm_path, sizeof (comm_path),
 	     "/proc/%ld/task/%ld/comm", (long) pid, (long) tid);
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index 9865ac63b1..d362c3008e 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -102,7 +102,7 @@ x86_linux_dr_get_addr (int regnum)
 void
 x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
 {
-  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
 
   gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
 
@@ -122,7 +122,7 @@ x86_linux_dr_get_control (void)
 void
 x86_linux_dr_set_control (unsigned long control)
 {
-  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
 
   iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
 }
@@ -148,7 +148,7 @@ x86_linux_update_debug_registers (struct lwp_info *lwp)
   if (lwp_debug_registers_changed (lwp))
     {
       struct x86_debug_reg_state *state
-	= x86_debug_reg_state (ptid_get_pid (ptid));
+	= x86_debug_reg_state (ptid.pid ());
       int i;
 
       /* Prior to Linux kernel 2.6.33 commit
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 7591a608d7..53797c8981 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -311,7 +311,7 @@ nto_procfs_target::thread_alive (ptid_t ptid)
   int err;
 
   tid = ptid_get_tid (ptid);
-  pid = ptid_get_pid (ptid);
+  pid = ptid.pid ();
 
   if (kill (pid, 0) == -1)
     return false;
@@ -398,7 +398,7 @@ nto_procfs_target::update_thread_list ()
 
   prune_threads ();
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
 
   status.tid = 1;
 
@@ -746,7 +746,7 @@ do_attach (ptid_t ptid)
   char path[PATH_MAX];
 
   snprintf (path, PATH_MAX - 1, "%s%s/%d/as",
-	    (nodestr != NULL) ? nodestr : "", "/proc", ptid_get_pid (ptid));
+	    (nodestr != NULL) ? nodestr : "", "/proc", ptid.pid ());
   ctl_fd = open (path, O_RDWR);
   if (ctl_fd == -1)
     error (_("Couldn't open proc file %s, error %d (%s)"), path, errno,
@@ -764,9 +764,9 @@ do_attach (ptid_t ptid)
 
   if (devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0) == EOK
       && status.flags & _DEBUG_FLAG_STOPPED)
-    SignalKill (nto_node (), ptid_get_pid (ptid), 0, SIGCONT, 0, 0);
+    SignalKill (nto_node (), ptid.pid (), 0, SIGCONT, 0, 0);
   nto_init_solib_absolute_prefix ();
-  return ptid_t (ptid_get_pid (ptid), 0, status.tid);
+  return ptid_t (ptid.pid (), 0, status.tid);
 }
 
 /* Ask the user what to do when an interrupt is received.  */
@@ -873,7 +873,7 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	  {
 	    int waitval = 0;
 
-	    waitpid (ptid_get_pid (inferior_ptid), &waitval, WNOHANG);
+	    waitpid (inferior_ptid.pid (), &waitval, WNOHANG);
 	    if (exit_signo)
 	      {
 		/* Abnormal death.  */
@@ -1013,12 +1013,12 @@ nto_procfs_target::detach (inferior *inf, int from_tty)
   target_announce_detach ();
 
   if (siggnal)
-    SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0, 0, 0, 0);
+    SignalKill (nto_node (), inferior_ptid.pid (), 0, 0, 0, 0);
 
   close (ctl_fd);
   ctl_fd = -1;
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   inferior_ptid = null_ptid;
   detach_inferior (pid);
   init_thread_list ();
@@ -1113,7 +1113,7 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 	{
 	  if (signal_to_pass != status.info.si_signo)
 	    {
-	      SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0,
+	      SignalKill (nto_node (), inferior_ptid.pid (), 0,
 			  signal_to_pass, 0, 0);
 	      run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG;
 	    }
@@ -1137,7 +1137,7 @@ nto_procfs_target::mourn_inferior ()
 {
   if (!ptid_equal (inferior_ptid, null_ptid))
     {
-      SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0, SIGKILL, 0, 0);
+      SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0);
       close (ctl_fd);
     }
   inferior_ptid = null_ptid;
@@ -1468,7 +1468,7 @@ nto_procfs_target::pid_to_str (ptid_t ptid)
   int pid, tid, n;
   struct tidinfo *tip;
 
-  pid = ptid_get_pid (ptid);
+  pid = ptid.pid ();
   tid = ptid_get_tid (ptid);
 
   n = snprintf (buf, 1023, "process %d", pid);
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index ac05fae9a1..a3058b00c3 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -52,7 +52,7 @@ obsd_nat_target::pid_to_str (ptid_t ptid)
 void
 obsd_nat_target::update_thread_list ()
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   struct ptrace_thread_state pts;
 
   prune_threads ();
@@ -90,7 +90,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
       do
 	{
-	  pid = waitpid (ptid_get_pid (ptid), &status, 0);
+	  pid = waitpid (ptid.pid (), &status, 0);
 	  save_errno = errno;
 	}
       while (pid == -1 && errno == EINTR);
@@ -110,7 +110,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	}
 
       /* Ignore terminated detached child processes.  */
-      if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
+      if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
 	pid = -1;
     }
   while (pid == -1);
@@ -142,7 +142,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
 	  gdb_assert (pe.pe_report_event == PTRACE_FORK);
 	  gdb_assert (pe.pe_other_pid == pid);
-	  if (fpid == ptid_get_pid (inferior_ptid))
+	  if (fpid == inferior_ptid.pid ())
 	    {
 	      ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
 	      return ptid_t (fpid);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index f9ec3176db..09cb247a7a 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1226,7 +1226,7 @@ have_ptrace_hwdebug_interface (void)
 
       tid = ptid_get_lwp (inferior_ptid);
       if (tid == 0)
-	tid = ptid_get_pid (inferior_ptid);
+	tid = inferior_ptid.pid ();
 
       /* Check for kernel support for PowerPC HWDEBUG ptrace interface.  */
       if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &hwdebug_info) >= 0)
@@ -1298,7 +1298,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
 	 ptrace call will return -1.  Fail in that case.  */
       tid = ptid_get_lwp (ptid);
       if (tid == 0)
-	tid = ptid_get_pid (ptid);
+	tid = ptid.pid ();
 
       if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0) == -1)
 	return 0;
@@ -2185,7 +2185,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
 {
   int tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid);
+    tid = inferior_ptid.pid ();
 
   int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
 
@@ -2212,7 +2212,7 @@ ppc_linux_nat_target::read_description ()
 {
   int tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid);
+    tid = inferior_ptid.pid ();
 
   if (have_ptrace_getsetevrregs)
     {
diff --git a/gdb/ppc-nbsd-nat.c b/gdb/ppc-nbsd-nat.c
index ea163f34d0..abdc0eea67 100644
--- a/gdb/ppc-nbsd-nat.c
+++ b/gdb/ppc-nbsd-nat.c
@@ -88,7 +88,7 @@ void
 ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
@@ -117,7 +117,7 @@ void
 ppc_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c
index ee71b7421c..af5f348a9e 100644
--- a/gdb/ppc-obsd-nat.c
+++ b/gdb/ppc-obsd-nat.c
@@ -82,7 +82,7 @@ void
 ppc_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
@@ -116,7 +116,7 @@ void
 ppc_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 7784f79438..0995f17120 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -131,7 +131,7 @@ ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr,
 ps_err_e
 ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ph->ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -147,7 +147,7 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
 ps_err_e
 ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ph->ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -163,7 +163,7 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
 ps_err_e
 ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, gdb_prfpregset_t *fpregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ph->ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -180,7 +180,7 @@ ps_err_e
 ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	       const gdb_prfpregset_t *fpregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (ph->ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (ph->ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -196,7 +196,7 @@ ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 pid_t
 ps_getpid (struct ps_prochandle *ph)
 {
-  return ptid_get_pid (ph->ptid);
+  return ph->ptid.pid ();
 }
 
 void
diff --git a/gdb/procfs.c b/gdb/procfs.c
index fc6568f956..07b13b80dc 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1635,17 +1635,17 @@ procfs_find_LDT_entry (ptid_t ptid)
   procinfo      *pi;
 
   /* Find procinfo for the lwp.  */
-  if ((pi = find_procinfo (ptid_get_pid (ptid), ptid_get_lwp (ptid))) == NULL)
+  if ((pi = find_procinfo (ptid.pid (), ptid_get_lwp (ptid))) == NULL)
     {
       warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
-	       ptid_get_pid (ptid), ptid_get_lwp (ptid));
+	       ptid.pid (), ptid_get_lwp (ptid));
       return NULL;
     }
   /* get its general registers.  */
   if ((gregs = proc_get_gregs (pi)) == NULL)
     {
       warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
-	       ptid_get_pid (ptid), ptid_get_lwp (ptid));
+	       ptid.pid (), ptid_get_lwp (ptid));
       return NULL;
     }
   /* Now extract the GS register's lower 16 bits.  */
@@ -1910,7 +1910,7 @@ procfs_target::attach (const char *args, int from_tty)
 void
 procfs_target::detach (inferior *inf, int from_tty)
 {
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
 
   if (from_tty)
     {
@@ -1940,14 +1940,14 @@ do_attach (ptid_t ptid)
   int fail;
   int lwpid;
 
-  if ((pi = create_procinfo (ptid_get_pid (ptid), 0)) == NULL)
+  if ((pi = create_procinfo (ptid.pid (), 0)) == NULL)
     perror (_("procfs: out of memory in 'attach'"));
 
   if (!open_procinfo_files (pi, FD_CTL))
     {
       fprintf_filtered (gdb_stderr, "procfs:%d -- ", __LINE__);
       sprintf (errmsg, "do_attach: couldn't open /proc file for process %d",
-	       ptid_get_pid (ptid));
+	       ptid.pid ());
       dead_procinfo (pi, errmsg, NOKILL);
     }
 
@@ -2008,7 +2008,7 @@ do_detach ()
   procinfo *pi;
 
   /* Find procinfo for the main process.  */
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid),
+  pi = find_procinfo_or_die (inferior_ptid.pid (),
 			     0); /* FIXME: threads */
 
   if (!proc_set_traced_signals (pi, &pi->saved_sigset))
@@ -2064,7 +2064,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
   gdb_gregset_t *gregs;
   procinfo *pi;
   ptid_t ptid = regcache->ptid ();
-  int pid = ptid_get_pid (ptid);
+  int pid = ptid.pid ();
   int tid = ptid_get_lwp (ptid);
   struct gdbarch *gdbarch = regcache->arch ();
 
@@ -2113,7 +2113,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum)
   gdb_gregset_t *gregs;
   procinfo *pi;
   ptid_t ptid = regcache->ptid ();
-  int pid = ptid_get_pid (ptid);
+  int pid = ptid.pid ();
   int tid = ptid_get_lwp (ptid);
   struct gdbarch *gdbarch = regcache->arch ();
 
@@ -2211,7 +2211,7 @@ wait_again:
   retval   = ptid_t (-1);
 
   /* Find procinfo for main process.  */
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   if (pi)
     {
       /* We must assume that the status is stale now...  */
@@ -2238,10 +2238,10 @@ wait_again:
 	      wait_retval = ::wait (&wstat); /* "wait" for the child's exit.  */
 
 	      /* Wrong child?  */
-	      if (wait_retval != ptid_get_pid (inferior_ptid))
+	      if (wait_retval != inferior_ptid.pid ())
 		error (_("procfs: couldn't stop "
 			 "process %d: wait returned %d."),
-		       ptid_get_pid (inferior_ptid), wait_retval);
+		       inferior_ptid.pid (), wait_retval);
 	      /* FIXME: might I not just use waitpid?
 		 Or try find_procinfo to see if I know about this child?  */
 	      retval = ptid_t (wait_retval);
@@ -2524,7 +2524,7 @@ wait_again:
 	      }
 	      /* Got this far without error: If retval isn't in the
 		 threads database, add it.  */
-	      if (ptid_get_pid (retval) > 0 &&
+	      if (retval.pid () > 0 &&
 		  !ptid_equal (retval, inferior_ptid) &&
 		  !in_thread_list (retval))
 		{
@@ -2532,9 +2532,9 @@ wait_again:
 		     GDB's list and to our own.  If we don't create a
 		     procinfo, resume may be unhappy later.  */
 		  add_thread (retval);
-		  if (find_procinfo (ptid_get_pid (retval),
+		  if (find_procinfo (retval.pid (),
 				     ptid_get_lwp (retval)) == NULL)
-		    create_procinfo (ptid_get_pid (retval),
+		    create_procinfo (retval.pid (),
 				     ptid_get_lwp (retval));
 		}
 	    }
@@ -2591,7 +2591,7 @@ procfs_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
   int nbytes;
 
   /* Find procinfo for main process.  */
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   if (pi->as_fd == 0 &&
       open_procinfo_files (pi, FD_AS) == 0)
     {
@@ -2728,7 +2728,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
      to proc_run_process (for use in the prrun struct by ioctl).  */
 
   /* Find procinfo for main process.  */
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
 
   /* First cut: ignore pid argument.  */
   errno = 0;
@@ -2748,11 +2748,11 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
   /* Void the process procinfo's caches.  */
   invalidate_cache (NULL, pi, NULL);
 
-  if (ptid_get_pid (ptid) != -1)
+  if (ptid.pid () != -1)
     {
       /* Resume a specific thread, presumably suppressing the
 	 others.  */
-      thread = find_procinfo (ptid_get_pid (ptid), ptid_get_lwp (ptid));
+      thread = find_procinfo (ptid.pid (), ptid_get_lwp (ptid));
       if (thread != NULL)
 	{
 	  if (thread->tid != 0)
@@ -2788,7 +2788,7 @@ void
 procfs_target::pass_signals (int numsigs, unsigned char *pass_signals)
 {
   sigset_t signals;
-  procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   int signo;
 
   prfillset (&signals);
@@ -2855,7 +2855,7 @@ procfs_target::kill ()
   if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */
     {
       /* Find procinfo for main process.  */
-      procinfo *pi = find_procinfo (ptid_get_pid (inferior_ptid), 0);
+      procinfo *pi = find_procinfo (inferior_ptid.pid (), 0);
 
       if (pi)
 	unconditionally_kill_inferior (pi);
@@ -2873,7 +2873,7 @@ procfs_target::mourn_inferior ()
   if (!ptid_equal (inferior_ptid, null_ptid))
     {
       /* Find procinfo for main process.  */
-      pi = find_procinfo (ptid_get_pid (inferior_ptid), 0);
+      pi = find_procinfo (inferior_ptid.pid (), 0);
       if (pi)
 	destroy_procinfo (pi);
     }
@@ -3162,7 +3162,7 @@ procfs_target::update_thread_list ()
   prune_threads ();
 
   /* Find procinfo for main process.  */
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   proc_update_threads (pi);
   proc_iterate_over_threads (pi, procfs_notice_thread, NULL);
 }
@@ -3177,7 +3177,7 @@ procfs_target::thread_alive (ptid_t ptid)
   int proc, thread;
   procinfo *pi;
 
-  proc    = ptid_get_pid (ptid);
+  proc    = ptid.pid ();
   thread  = ptid_get_lwp (ptid);
   /* If I don't know it, it ain't alive!  */
   if ((pi = find_procinfo (proc, thread)) == NULL)
@@ -3204,7 +3204,7 @@ procfs_target::pid_to_str (ptid_t ptid)
   static char buf[80];
 
   if (ptid_get_lwp (ptid) == 0)
-    sprintf (buf, "process %d", ptid_get_pid (ptid));
+    sprintf (buf, "process %d", ptid.pid ());
   else
     sprintf (buf, "LWP %ld", ptid_get_lwp (ptid));
 
@@ -3220,8 +3220,8 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
   int       pflags = 0;
   procinfo *pi;
 
-  pi = find_procinfo_or_die (ptid_get_pid (ptid) == -1 ?
-			     ptid_get_pid (inferior_ptid) : ptid_get_pid (ptid),
+  pi = find_procinfo_or_die (ptid.pid () == -1 ?
+			     inferior_ptid.pid () : ptid.pid (),
 			     0);
 
   /* Translate from GDB's flags to /proc's.  */
@@ -3298,7 +3298,7 @@ procfs_target::stopped_by_watchpoint ()
 {
   procinfo *pi;
 
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
 
   if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP))
     {
@@ -3322,7 +3322,7 @@ procfs_target::stopped_data_address (CORE_ADDR *addr)
 {
   procinfo *pi;
 
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   return proc_watchpoint_address (pi, addr);
 }
 
@@ -3455,7 +3455,7 @@ find_memory_regions_callback (struct prmap *map,
 int
 procfs_target::find_memory_regions (find_memory_region_ftype func, void *data)
 {
-  procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
 
   return iterate_over_mappings (pi, func, data,
 				find_memory_regions_callback);
@@ -3584,7 +3584,7 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
 	}
     }
   if (pid == 0)
-    pid = ptid_get_pid (inferior_ptid);
+    pid = inferior_ptid.pid ();
   if (pid == 0)
     error (_("No current process: you must name one."));
   else
@@ -3678,13 +3678,13 @@ proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit, int mode
 {
   procinfo *pi;
 
-  if (ptid_get_pid (inferior_ptid) <= 0)
+  if (inferior_ptid.pid () <= 0)
     error (_("you must be debugging a process to use this command."));
 
   if (args == NULL || args[0] == 0)
     error_no_arg (_("system call to trace"));
 
-  pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   if (isdigit (args[0]))
     {
       const int syscallnum = atoi (args);
@@ -3764,7 +3764,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
   gdb_fpregset_t fpregs;
   unsigned long merged_pid;
 
-  merged_pid = ptid_get_lwp (ptid) << 16 | ptid_get_pid (ptid);
+  merged_pid = ptid_get_lwp (ptid) << 16 | ptid.pid ();
 
   /* This part is the old method for fetching registers.
      It should be replaced by the newer one using regsets
@@ -3821,7 +3821,7 @@ static int
 find_signalled_thread (struct thread_info *info, void *data)
 {
   if (info->suspend.stop_signal != GDB_SIGNAL_0
-      && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
+      && info->ptid.pid () == inferior_ptid.pid ())
     return 1;
 
   return 0;
@@ -3847,7 +3847,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
   gdb_fpregset_t fpregs;
   char fname[16] = {'\0'};
   char psargs[80] = {'\0'};
-  procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+  procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   char *note_data = NULL;
   char *inf_args;
   struct procfs_corefile_thread_data thread_args;
@@ -3883,7 +3883,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
 
   fill_gregset (get_current_regcache (), &gregs, -1);
   note_data = elfcore_write_pstatus (obfd, note_data, note_size,
-				     ptid_get_pid (inferior_ptid),
+				     inferior_ptid.pid (),
 				     stop_signal, &gregs);
 
   thread_args.obfd = obfd;
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index d199aaa1f8..c3aa62d350 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -309,7 +309,7 @@ find_thread_object (ptid_t ptid)
   int pid;
   struct threadlist_entry *thread;
 
-  pid = ptid_get_pid (ptid);
+  pid = ptid.pid ();
   if (pid == 0)
     return NULL;
 
@@ -374,7 +374,7 @@ delete_thread_object (struct thread_info *tp, int ignore)
   gdbpy_enter enter_py (python_gdbarch, python_language);
 
   gdbpy_ref<inferior_object> inf_obj
-    ((inferior_object *) find_inferior_object (ptid_get_pid (tp->ptid)));
+    ((inferior_object *) find_inferior_object (tp->ptid.pid ()));
   if (inf_obj == NULL)
     return;
 
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 9ed18a3b82..67cf4c4641 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -46,7 +46,7 @@ create_thread_object (struct thread_info *tp)
     return NULL;
 
   thread_obj->thread = tp;
-  thread_obj->inf_obj = find_inferior_object (ptid_get_pid (tp->ptid));
+  thread_obj->inf_obj = find_inferior_object (tp->ptid.pid ());
 
   return thread_obj;
 }
@@ -266,7 +266,7 @@ gdbpy_create_ptid_object (ptid_t ptid)
   if (!ret)
     return NULL;
 
-  pid = ptid_get_pid (ptid);
+  pid = ptid.pid ();
   lwp = ptid_get_lwp (ptid);
   tid = ptid_get_tid (ptid);
 
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index d269f388f5..f748e87989 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -211,7 +211,7 @@ get_base_thread_from_ravenscar_task (ptid_t ptid)
     return ptid;
 
   base_cpu = ravenscar_get_thread_base_cpu (ptid);
-  return ptid_t (ptid_get_pid (ptid), base_cpu, 0);
+  return ptid_t (ptid.pid (), base_cpu, 0);
 }
 
 /* Fetch the ravenscar running thread from target memory and
@@ -384,7 +384,7 @@ ravenscar_active_task (int cpu)
   if (tid == 0)
     return null_ptid;
   else
-    return ptid_t (ptid_get_pid (base_ptid), 0, tid);
+    return ptid_t (base_ptid.pid (), 0, tid);
 }
 
 const char *
@@ -571,7 +571,7 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty)
 ptid_t
 ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_t (ptid_get_pid (base_ptid), 0, thread);
+  return ptid_t (base_ptid.pid (), 0, thread);
 }
 
 /* Command-list for the "set/show ravenscar" prefix command.  */
diff --git a/gdb/record.c b/gdb/record.c
index d4975d905d..2fd77824d4 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -366,7 +366,7 @@ cmd_record_save (const char *args, int from_tty)
     {
       /* Default recfile name is "gdb_record.PID".  */
       xsnprintf (recfilename_buffer, sizeof (recfilename_buffer),
-                "gdb_record.%d", ptid_get_pid (inferior_ptid));
+                "gdb_record.%d", inferior_ptid.pid ());
       recfilename = recfilename_buffer;
     }
 
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index cd69f72e23..def1bd5830 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -281,7 +281,7 @@ static struct sim_inferior_data *
 get_sim_inferior_data_by_ptid (ptid_t ptid, int sim_instance_needed)
 {
   struct inferior *inf;
-  int pid = ptid_get_pid (ptid);
+  int pid = ptid.pid ();
 
   if (pid <= 0)
     return NULL;
@@ -686,7 +686,7 @@ gdbsim_target::create_inferior (const char *exec_file,
     error (_("Unable to create sim inferior."));
 
   inferior_ptid = sim_data->remote_sim_ptid;
-  inferior_appeared (current_inferior (), ptid_get_pid (inferior_ptid));
+  inferior_appeared (current_inferior (), inferior_ptid.pid ());
   add_thread_silent (inferior_ptid);
 
   insert_breakpoints ();	/* Needed to get correct instruction
@@ -1009,7 +1009,7 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options)
       sim_data = get_sim_inferior_data_by_ptid (ptid, SIM_INSTANCE_NEEDED);
       if (sim_data == NULL)
 	error (_("Unable to wait for pid %d.  Inferior not found."),
-	       ptid_get_pid (ptid));
+	       ptid.pid ());
       inferior_ptid = ptid;
     }
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 0eea37a176..2d2d224783 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2429,10 +2429,10 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing)
   if (!in_thread_list (currthread))
     {
       struct inferior *inf = NULL;
-      int pid = ptid_get_pid (currthread);
+      int pid = currthread.pid ();
 
       if (ptid_is_pid (inferior_ptid)
-	  && pid == ptid_get_pid (inferior_ptid))
+	  && pid == inferior_ptid.pid ())
 	{
 	  /* inferior_ptid has no thread member yet.  This can happen
 	     with the vAttach -> remote_wait,"TAAthread:" path if the
@@ -2464,13 +2464,13 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing)
 	 extended-remote which already was debugging an inferior, we
 	 may not know about it yet.  Add it before adding its child
 	 thread, so notifications are emitted in a sensible order.  */
-      if (!in_inferior_list (ptid_get_pid (currthread)))
+      if (!in_inferior_list (currthread.pid ()))
 	{
 	  struct remote_state *rs = get_remote_state ();
 	  int fake_pid_p = !remote_multi_process_p (rs);
 
 	  inf = remote_add_inferior (fake_pid_p,
-				     ptid_get_pid (currthread), -1, 1);
+				     currthread.pid (), -1, 1);
 	}
 
       /* This is really a new thread.  Add it.  */
@@ -2765,7 +2765,7 @@ remote_target::set_general_process ()
 
   /* We only need to change the remote current thread if it's pointing
      at some other process.  */
-  if (ptid_get_pid (rs->general_thread) != ptid_get_pid (inferior_ptid))
+  if (rs->general_thread.pid () != inferior_ptid.pid ())
     set_general_thread (inferior_ptid);
 }
 
@@ -2780,7 +2780,7 @@ remote_thread_always_alive (ptid_t ptid)
     /* The main thread is always alive.  */
     return 1;
 
-  if (ptid_get_pid (ptid) != 0 && ptid_get_lwp (ptid) == 0)
+  if (ptid.pid () != 0 && ptid_get_lwp (ptid) == 0)
     /* The main thread is always alive.  This can happen after a
        vAttach, if the remote side doesn't support
        multi-threading.  */
@@ -2916,7 +2916,7 @@ remote_target::write_ptid (char *buf, const char *endbuf, ptid_t ptid)
 
   if (remote_multi_process_p (rs))
     {
-      pid = ptid_get_pid (ptid);
+      pid = ptid.pid ();
       if (pid < 0)
 	buf += xsnprintf (buf, endbuf - buf, "p-%x.", -pid);
       else
@@ -2972,9 +2972,9 @@ read_ptid (const char *buf, const char **obuf)
      then since there's no way to know the pid of the reported
      threads, use the magic number.  */
   if (ptid_equal (inferior_ptid, null_ptid))
-    pid = ptid_get_pid (magic_null_ptid);
+    pid = magic_null_ptid.pid ();
   else
-    pid = ptid_get_pid (inferior_ptid);
+    pid = inferior_ptid.pid ();
 
   if (obuf)
     *obuf = pp;
@@ -3839,7 +3839,7 @@ remote_target::extra_thread_info (thread_info *tp)
 		    _("remote_threads_extra_info"));
 
   if (ptid_equal (tp->ptid, magic_null_ptid)
-      || (ptid_get_pid (tp->ptid) != 0 && ptid_get_lwp (tp->ptid) == 0))
+      || (tp->ptid.pid () != 0 && ptid_get_lwp (tp->ptid) == 0))
     /* This is the main thread which was added by GDB.  The remote
        server doesn't know about it.  */
     return NULL;
@@ -3974,7 +3974,7 @@ remote_target::static_tracepoint_markers_by_strid (const char *strid)
 ptid_t
 remote_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_t (ptid_get_pid (inferior_ptid), lwp, 0);
+  return ptid_t (inferior_ptid.pid (), lwp, 0);
 }
 \f
 
@@ -4312,7 +4312,7 @@ remote_target::add_current_inferior_and_thread (char *wait_status)
       fake_pid_p = 1;
     }
 
-  remote_add_inferior (fake_pid_p, ptid_get_pid (curr_ptid), -1, 1);
+  remote_add_inferior (fake_pid_p, curr_ptid.pid (), -1, 1);
 
   /* Add the main thread and switch to it.  Don't try reading
      registers yet, since we haven't fetched the target description
@@ -5656,7 +5656,7 @@ remote_target::remote_detach_pid (int pid)
 void
 remote_target::remote_detach_1 (int from_tty, inferior *inf)
 {
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
   struct remote_state *rs = get_remote_state ();
   struct thread_info *tp = find_thread_ptid (inferior_ptid);
   int is_fork_parent;
@@ -5739,7 +5739,7 @@ remote_target::follow_fork (int follow_child, int detach_fork)
 	  pid_t child_pid;
 
 	  child_ptid = inferior_thread ()->pending_follow.value.related_pid;
-	  child_pid = ptid_get_pid (child_ptid);
+	  child_pid = child_ptid.pid ();
 
 	  remote_detach_pid (child_pid);
 	}
@@ -6039,7 +6039,7 @@ remote_target::append_resumption (char *p, char *endp,
       ptid_t nptid;
 
       /* All (-1) threads of process.  */
-      nptid = ptid_t (ptid_get_pid (ptid), -1, 0);
+      nptid = ptid_t (ptid.pid (), -1, 0);
 
       p += xsnprintf (p, endp - p, ":");
       p = write_ptid (p, endp, nptid);
@@ -6617,7 +6617,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
 
       if (ptid_is_pid (ptid))
 	  /* All (-1) threads of process.  */
-	nptid = ptid_t (ptid_get_pid (ptid), -1, 0);
+	nptid = ptid_t (ptid.pid (), -1, 0);
       else
 	{
 	  /* Small optimization: if we already have a stop reply for
@@ -6941,7 +6941,7 @@ is_pending_fork_parent (struct target_waitstatus *ws, int event_pid,
   if (ws->kind == TARGET_WAITKIND_FORKED
       || ws->kind == TARGET_WAITKIND_VFORKED)
     {
-      if (event_pid == -1 || event_pid == ptid_get_pid (thread_ptid))
+      if (event_pid == -1 || event_pid == thread_ptid.pid ())
 	return 1;
     }
 
@@ -7056,7 +7056,7 @@ remote_target::discard_pending_stop_replies (struct inferior *inf)
   reply = (struct stop_reply *) rns->pending_event[notif_client_stop.id];
 
   /* Discard the in-flight notification.  */
-  if (reply != NULL && ptid_get_pid (reply->ptid) == inf->pid)
+  if (reply != NULL && reply->ptid.pid () == inf->pid)
     {
       stop_reply_xfree (reply);
       rns->pending_event[notif_client_stop.id] = NULL;
@@ -7510,7 +7510,7 @@ Packet: '%s'\n"),
 	  }
 
 	/* If no process is specified, assume inferior_ptid.  */
-	pid = ptid_get_pid (inferior_ptid);
+	pid = inferior_ptid.pid ();
 	if (*p == '\0')
 	  ;
 	else if (*p == ';')
@@ -9720,7 +9720,7 @@ void
 remote_target::kill ()
 {
   int res = -1;
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
   struct remote_state *rs = get_remote_state ();
 
   if (packet_support (PACKET_vKill) != PACKET_DISABLE)
@@ -11322,7 +11322,7 @@ static void
 threadalive_test (const char *cmd, int tty)
 {
   int sample_thread = SAMPLE_THREAD;
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
   ptid_t ptid = ptid_t (pid, sample_thread, 0);
 
   if (remote_thread_alive (ptid))
@@ -11474,7 +11474,7 @@ remote_target::pid_to_str (ptid_t ptid)
 	  return normal_pid_to_str (ptid);
 	else
 	  xsnprintf (buf, sizeof buf, "Thread %d.%ld",
-		     ptid_get_pid (ptid), ptid_get_lwp (ptid));
+		     ptid.pid (), ptid_get_lwp (ptid));
       else
 	xsnprintf (buf, sizeof buf, "Thread %ld",
 		   ptid_get_lwp (ptid));
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 8a9a0ed81f..ad411f9b19 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -191,7 +191,7 @@ fetch_register (struct regcache *regcache, int regno)
   struct gdbarch *gdbarch = regcache->arch ();
   int addr[PPC_MAX_REGISTER_SIZE];
   int nr, isfloat;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   /* Retrieved values may be -1, so infer errors from errno.  */
   errno = 0;
@@ -250,7 +250,7 @@ store_register (struct regcache *regcache, int regno)
   struct gdbarch *gdbarch = regcache->arch ();
   int addr[PPC_MAX_REGISTER_SIZE];
   int nr, isfloat;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   /* Fetch the register's value from the register cache.  */
   regcache->raw_collect (regno, addr);
@@ -393,7 +393,7 @@ rs6000_nat_target::xfer_partial (enum target_object object,
 				 ULONGEST offset, ULONGEST len,
 				 ULONGEST *xfered_len)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   int arch64 = ARCH64 ();
 
   switch (object)
@@ -506,7 +506,7 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
       do
 	{
-	  pid = waitpid (ptid_get_pid (ptid), &status, 0);
+	  pid = waitpid (ptid.pid (), &status, 0);
 	  save_errno = errno;
 	}
       while (pid == -1 && errno == EINTR);
@@ -526,7 +526,7 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 	}
 
       /* Ignore terminated detached child processes.  */
-      if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
+      if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
 	pid = -1;
     }
   while (pid == -1);
@@ -611,7 +611,7 @@ rs6000_nat_target::create_inferior (const char *exec_file,
 static gdb::byte_vector
 rs6000_ptrace_ldinfo (ptid_t ptid)
 {
-  const int pid = ptid_get_pid (ptid);
+  const int pid = ptid.pid ();
   gdb::byte_vector ldi (1024);
   int rc = -1;
 
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 74cab71420..b112a3dd75 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -260,7 +260,7 @@ s390_inferior_tid (void)
   /* GNU/Linux LWP ID's are process ID's.  */
   int tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid); /* Not a threaded program.  */
+    tid = inferior_ptid.pid (); /* Not a threaded program.  */
 
   return tid;
 }
@@ -622,7 +622,7 @@ s390_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
   /* GDB core assumes the child inherits the watchpoints/hw breakpoints of
      the parent.  So copy the debug state from parent to child.  */
 
-  parent_pid = ptid_get_pid (parent->ptid);
+  parent_pid = parent->ptid.pid ();
   parent_state = s390_get_debug_reg_state (parent_pid);
   child_state = s390_get_debug_reg_state (child_pid);
 
@@ -667,7 +667,7 @@ bool
 s390_linux_nat_target::stopped_by_watchpoint ()
 {
   struct s390_debug_reg_state *state
-    = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = s390_get_debug_reg_state (inferior_ptid.pid ());
   per_lowcore_bits per_lowcore;
   ptrace_area parea;
 
@@ -704,7 +704,7 @@ void
 s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
 {
   int tid;
-  pid_t pid = ptid_get_pid (ptid_of_lwp (lp));
+  pid_t pid = ptid_of_lwp (lp).pid ();
 
   per_struct per_info;
   ptrace_area parea;
@@ -848,7 +848,7 @@ s390_refresh_per_info_cb (struct lwp_info *lp, void *arg)
 static int
 s390_refresh_per_info (void)
 {
-  ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+  ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
 
   iterate_over_lwps (pid_ptid, s390_refresh_per_info_cb, NULL);
   return 0;
@@ -861,7 +861,7 @@ s390_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
 {
   s390_watch_area area;
   struct s390_debug_reg_state *state
-    = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = s390_get_debug_reg_state (inferior_ptid.pid ());
 
   area.lo_addr = addr;
   area.hi_addr = addr + len - 1;
@@ -878,7 +878,7 @@ s390_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
   unsigned ix;
   s390_watch_area *area;
   struct s390_debug_reg_state *state
-    = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = s390_get_debug_reg_state (inferior_ptid.pid ());
 
   for (ix = 0;
        VEC_iterate (s390_watch_area, state->watch_areas, ix, area);
@@ -918,7 +918,7 @@ s390_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
 
   area.lo_addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
   area.hi_addr = area.lo_addr;
-  state = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+  state = s390_get_debug_reg_state (inferior_ptid.pid ());
   VEC_safe_push (s390_watch_area, state->break_areas, &area);
 
   return s390_refresh_per_info ();
@@ -934,7 +934,7 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
   struct watch_area *area;
   struct s390_debug_reg_state *state;
 
-  state = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+  state = s390_get_debug_reg_state (inferior_ptid.pid ());
   for (ix = 0;
        VEC_iterate (s390_watch_area, state->break_areas, ix, area);
        ix++)
diff --git a/gdb/sh-nbsd-nat.c b/gdb/sh-nbsd-nat.c
index 062b5220ff..ae58ecbec0 100644
--- a/gdb/sh-nbsd-nat.c
+++ b/gdb/sh-nbsd-nat.c
@@ -51,7 +51,7 @@ static sh_nbsd_nat_target the_sh_nbsd_nat_target;
 void
 sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
     {
@@ -73,7 +73,7 @@ sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
 void
 sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
 {
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
     {
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 85d3ad92ff..44a98a1d65 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -325,7 +325,7 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
 	     td_state_string (ti.ti_state));
     }
 
-  return ptid_t (ptid_get_pid (thread_id), ti.ti_lid, 0);
+  return ptid_t (thread_id.pid (), ti.ti_lid, 0);
 }
 
 /* Convert an LWP ID into a POSIX or Solaris thread ID.  If LWP_ID
@@ -366,7 +366,7 @@ lwp_to_thread (ptid_t lwp)
   else if (val != TD_OK)
     error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
 
-  return ptid_t (ptid_get_pid (lwp), 0 , ti.ti_tid);
+  return ptid_t (lwp.pid (), 0 , ti.ti_tid);
 }
 \f
 
@@ -387,7 +387,7 @@ sol_thread_target::detach (inferior *inf, int from_tty)
   target_ops *beneath = this->beneath ();
 
   sol_thread_active = 0;
-  inferior_ptid = ptid_t (ptid_get_pid (main_ph.ptid));
+  inferior_ptid = ptid_t (main_ph.ptid.pid ());
   unpush_target (this);
   beneath->detach (inf, from_tty);
 }
@@ -402,18 +402,18 @@ sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 {
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
-  inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
-  if (ptid_get_pid (inferior_ptid) == -1)
+  inferior_ptid = thread_to_lwp (inferior_ptid, main_ph.ptid.pid ());
+  if (inferior_ptid.pid () == -1)
     inferior_ptid = procfs_first_available ();
 
-  if (ptid_get_pid (ptid) != -1)
+  if (ptid.pid () != -1)
     {
       ptid_t save_ptid = ptid;
 
       ptid = thread_to_lwp (ptid, -2);
-      if (ptid_get_pid (ptid) == -2)		/* Inactive thread.  */
+      if (ptid.pid () == -2)		/* Inactive thread.  */
 	error (_("This version of Solaris can't start inactive threads."));
-      if (info_verbose && ptid_get_pid (ptid) == -1)
+      if (info_verbose && ptid.pid () == -1)
 	warning (_("Specified thread %ld seems to have terminated"),
 		 ptid_get_tid (save_ptid));
     }
@@ -434,18 +434,18 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
   save_ptid = inferior_ptid;
   scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
-  inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
-  if (ptid_get_pid (inferior_ptid) == -1)
+  inferior_ptid = thread_to_lwp (inferior_ptid, main_ph.ptid.pid ());
+  if (inferior_ptid.pid () == -1)
     inferior_ptid = procfs_first_available ();
 
-  if (ptid_get_pid (ptid) != -1)
+  if (ptid.pid () != -1)
     {
       ptid_t save_ptid = ptid;
 
       ptid = thread_to_lwp (ptid, -2);
-      if (ptid_get_pid (ptid) == -2)		/* Inactive thread.  */
+      if (ptid.pid () == -2)		/* Inactive thread.  */
 	error (_("This version of Solaris can't start inactive threads."));
-      if (info_verbose && ptid_get_pid (ptid) == -1)
+      if (info_verbose && ptid.pid () == -1)
 	warning (_("Specified thread %ld seems to have terminated"),
 		 ptid_get_tid (save_ptid));
     }
@@ -456,7 +456,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
     {
       /* Map the LWP of interest back to the appropriate thread ID.  */
       rtnval = lwp_to_thread (rtnval);
-      if (ptid_get_pid (rtnval) == -1)
+      if (rtnval.pid () == -1)
 	rtnval = save_ptid;
 
       /* See if we have a new thread.  */
@@ -652,7 +652,7 @@ check_for_thread_db (void)
 
       main_ph.ptid = inferior_ptid; /* Save for xfer_memory.  */
       ptid = lwp_to_thread (inferior_ptid);
-      if (ptid_get_pid (ptid) != -1)
+      if (ptid.pid () != -1)
 	inferior_ptid = ptid;
 
       target_update_thread_list ();
@@ -849,7 +849,7 @@ ps_ptwrite (struct ps_prochandle *ph, psaddr_t addr,
 ps_err_e
 ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -865,7 +865,7 @@ ps_err_e
 ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	     const prgregset_t gregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -917,7 +917,7 @@ ps_err_e
 ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	       prfpregset_t *fpregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -933,7 +933,7 @@ ps_err_e
 ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
 	       const prfpregset_t * fpregset)
 {
-  ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+  ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (ptid, target_gdbarch ());
 
@@ -979,10 +979,10 @@ ps_lgetLDT (struct ps_prochandle *ph, lwpid_t lwpid,
   /* FIXME: can't I get the process ID from the prochandle or
      something?  */
 
-  if (ptid_get_pid (inferior_ptid) <= 0 || lwpid <= 0)
+  if (inferior_ptid.pid () <= 0 || lwpid <= 0)
     return PS_BADLID;
 
-  ret = procfs_find_LDT_entry (ptid_t (ptid_get_pid (inferior_ptid),
+  ret = procfs_find_LDT_entry (ptid_t (inferior_ptid.pid (),
 			       lwpid, 0));
   if (ret)
     {
@@ -1009,10 +1009,10 @@ sol_thread_target::pid_to_str (ptid_t ptid)
 
       lwp = thread_to_lwp (ptid, -2);
 
-      if (ptid_get_pid (lwp) == -1)
+      if (lwp.pid () == -1)
 	xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)",
 		   ptid_get_tid (ptid));
-      else if (ptid_get_pid (lwp) != -2)
+      else if (lwp.pid () != -2)
 	xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
 		 ptid_get_tid (ptid), ptid_get_lwp (lwp));
       else
@@ -1022,7 +1022,7 @@ sol_thread_target::pid_to_str (ptid_t ptid)
   else if (ptid_get_lwp (ptid) != 0)
     xsnprintf (buf, sizeof (buf), "LWP    %ld        ", ptid_get_lwp (ptid));
   else
-    xsnprintf (buf, sizeof (buf), "process %d    ", ptid_get_pid (ptid));
+    xsnprintf (buf, sizeof (buf), "process %d    ", ptid.pid ());
 
   return buf;
 }
@@ -1042,7 +1042,7 @@ sol_update_thread_list_callback (const td_thrhandle_t *th, void *ignored)
   if (retval != TD_OK)
     return -1;
 
-  ptid = ptid_t (ptid_get_pid (inferior_ptid), 0, ti.ti_tid);
+  ptid = ptid_t (inferior_ptid.pid (), 0, ti.ti_tid);
   if (!in_thread_list (ptid) || is_exited (ptid))
     add_thread (ptid);
 
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index c133a3e82c..494cf47045 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -274,7 +274,7 @@ sparc_xfer_wcookie (struct target_ops *ops, enum target_object object,
      later).  Since release 3.6, OpenBSD uses a fully randomized
      cookie.  */
   {
-    int pid = ptid_get_pid (inferior_ptid);
+    int pid = inferior_ptid.pid ();
 
     /* Sanity check.  The proper type for a cookie is register_t, but
        we can't assume that this type exists on all systems supported
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index e18d58d1f4..8d96cfc096 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -214,7 +214,7 @@ read_maps_entry (const char *line,
 static bool
 adi_available (void)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   sparc64_adi_info *proc = get_adi_info_proc (pid);
   CORE_ADDR value;
 
@@ -238,7 +238,7 @@ adi_available (void)
 static CORE_ADDR
 adi_normalize_address (CORE_ADDR addr)
 {
-  adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+  adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
 
   if (ast.nbits)
     {
@@ -258,7 +258,7 @@ adi_normalize_address (CORE_ADDR addr)
 static CORE_ADDR
 adi_align_address (CORE_ADDR naddr)
 {
-  adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+  adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
 
   return (naddr - (naddr % ast.blksize)) / ast.blksize;
 }
@@ -268,7 +268,7 @@ adi_align_address (CORE_ADDR naddr)
 static int
 adi_convert_byte_count (CORE_ADDR naddr, int nbytes, CORE_ADDR locl)
 {
-  adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+  adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
 
   return ((naddr + nbytes + ast.blksize - 1) / ast.blksize) - locl;
 }
@@ -285,7 +285,7 @@ adi_convert_byte_count (CORE_ADDR naddr, int nbytes, CORE_ADDR locl)
 static int
 adi_tag_fd (void)
 {
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   sparc64_adi_info *proc = get_adi_info_proc (pid);
 
   if (proc->stat.tag_fd != 0)
@@ -309,7 +309,7 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
   char filename[MAX_PROC_NAME_SIZE];
   size_t i = 0;
 
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   snprintf (filename, sizeof filename, "/proc/%ld/adi/maps", (long) pid);
   gdb::unique_xmalloc_ptr<char> data
     = target_fileio_read_stralloc (NULL, filename);
@@ -349,7 +349,7 @@ adi_read_versions (CORE_ADDR vaddr, size_t size, gdb_byte *tags)
 
   if (!adi_is_addr_mapped (vaddr, size))
     {
-      adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+      adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
       error(_("Address at %s is not in ADI maps"),
             paddress (target_gdbarch (), vaddr * ast.blksize));
     }
@@ -370,7 +370,7 @@ adi_write_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
 
   if (!adi_is_addr_mapped (vaddr, size))
     {
-      adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+      adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
       error(_("Address at %s is not in ADI maps"),
             paddress (target_gdbarch (), vaddr * ast.blksize));
     }
@@ -388,7 +388,7 @@ adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
   int v_idx = 0;
   const int maxelts = 8;  /* # of elements per line */
 
-  adi_stat_t adi_stat = get_adi_info (ptid_get_pid (inferior_ptid));
+  adi_stat_t adi_stat = get_adi_info (inferior_ptid.pid ());
 
   while (cnt > 0)
     {
@@ -461,7 +461,7 @@ adi_examine_command (const char *args, int from_tty)
   if (!adi_available ())
     error (_("No ADI information"));
 
-  pid_t pid = ptid_get_pid (inferior_ptid);
+  pid_t pid = inferior_ptid.pid ();
   sparc64_adi_info *proc = get_adi_info_proc (pid);
   int cnt = 1;
   const char *p = args;
@@ -523,7 +523,7 @@ adi_assign_command (const char *args, int from_tty)
   int version = 0;
   if (q != NULL)           /* parse version tag */
     {
-      adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+      adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
       version = parse_and_eval_long (q);
       if (version < 0 || version > ast.max_version)
         error (_("Invalid ADI version tag %d"), version);
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 18c1856f7b..65b434efec 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -71,7 +71,7 @@ fetch_ppc_register (int regno)
 
   int tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid);
+    tid = inferior_ptid.pid ();
 
 #ifndef __powerpc64__
   /* If running as a 32-bit process on a 64-bit system, we attempt
@@ -156,7 +156,7 @@ fetch_ppc_memory (ULONGEST memaddr, gdb_byte *myaddr, int len)
 
   int tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid);
+    tid = inferior_ptid.pid ();
 
   buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET));
   for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
@@ -186,7 +186,7 @@ store_ppc_memory (ULONGEST memaddr, const gdb_byte *myaddr, int len)
 
   int tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid);
+    tid = inferior_ptid.pid ();
 
   buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET));
 
@@ -259,7 +259,7 @@ spu_proc_xfer_spu (const char *annex, gdb_byte *readbuf,
   char buf[128];
   int fd = 0;
   int ret = -1;
-  int pid = ptid_get_pid (inferior_ptid);
+  int pid = inferior_ptid.pid ();
 
   if (!annex)
     return TARGET_XFER_EOF;
@@ -424,7 +424,7 @@ spu_linux_nat_target::post_startup_inferior (ptid_t ptid)
 
   int tid = ptid_get_lwp (ptid);
   if (tid == 0)
-    tid = ptid_get_pid (ptid);
+    tid = ptid.pid ();
   
   while (!parse_spufs_run (&fd, &addr))
     {
@@ -471,17 +471,17 @@ spu_linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
       set_sigint_trap ();	/* Causes SIGINT to be passed on to the
 				   attached process.  */
 
-      pid = waitpid (ptid_get_pid (ptid), &status, 0);
+      pid = waitpid (ptid.pid (), &status, 0);
       if (pid == -1 && errno == ECHILD)
 	/* Try again with __WCLONE to check cloned processes.  */
-	pid = waitpid (ptid_get_pid (ptid), &status, __WCLONE);
+	pid = waitpid (ptid.pid (), &status, __WCLONE);
 
       save_errno = errno;
 
       /* Make sure we don't report an event for the exit of the
          original program, if we've detached from it.  */
       if (pid != -1 && !WIFSTOPPED (status)
-	  && pid != ptid_get_pid (inferior_ptid))
+	  && pid != inferior_ptid.pid ())
 	{
 	  pid = -1;
 	  save_errno = EINTR;
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index f6ddb65f38..c85a740787 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1596,14 +1596,14 @@ spu_memory_remove_breakpoint (struct gdbarch *gdbarch,
      -- this is not the correct behaviour.
 
      The workaround is to check whether the PID we are asked to remove this
-     breakpoint from (i.e. ptid_get_pid (inferior_ptid)) is different from the
+     breakpoint from (i.e. inferior_ptid.pid ()) is different from the
      PID of the current inferior (i.e. current_inferior ()->pid).  This is only
      true in the context of detach_breakpoints.  If so, we simply do nothing.
      [ Note that for the fork child process, it does not matter if breakpoints
      remain inserted, because those SPU contexts are not runnable anyway --
      the Linux kernel allows only the original process to invoke spu_run.  */
 
-  if (ptid_get_pid (inferior_ptid) != current_inferior ()->pid) 
+  if (inferior_ptid.pid () != current_inferior ()->pid) 
     return 0;
 
   return default_memory_remove_breakpoint (gdbarch, bp_tgt);
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index 5f3001b89f..d31338557a 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -71,7 +71,7 @@
 #define target_debug_print_enum_btrace_error(X) \
   target_debug_do_print (plongest (X))
 #define target_debug_print_ptid_t(X)		\
-  target_debug_do_print (plongest (ptid_get_pid (X)))
+  target_debug_do_print (plongest (X.pid ()))
 #define target_debug_print_struct_gdbarch_p(X)	\
   target_debug_do_print (gdbarch_bfd_arch_info (X)->printable_name)
 #define target_debug_print_const_gdb_byte_p(X)	\
diff --git a/gdb/target.c b/gdb/target.c
index 66db4b278c..278e9aa4b6 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -618,7 +618,7 @@ default_terminal_info (struct target_ops *self, const char *args, int from_tty)
 static ptid_t
 default_get_ada_task_ptid (struct target_ops *self, long lwp, long tid)
 {
-  return ptid_t (ptid_get_pid (inferior_ptid), lwp, tid);
+  return ptid_t (inferior_ptid.pid (), lwp, tid);
 }
 
 static enum exec_direction_kind
@@ -2088,7 +2088,7 @@ target_detach (inferior *inf, int from_tty)
   else
     /* If we're in breakpoints-always-inserted mode, have to remove
        them before detaching.  */
-    remove_breakpoints_pid (ptid_get_pid (inferior_ptid));
+    remove_breakpoints_pid (inferior_ptid.pid ());
 
   prepare_for_detach ();
 
@@ -3241,7 +3241,7 @@ target_announce_detach (int from_tty)
   if (exec_file == NULL)
     exec_file = "";
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
 		     target_pid_to_str (ptid_t (pid)));
   gdb_flush (gdb_stdout);
@@ -3264,7 +3264,7 @@ generic_mourn_inferior (void)
 
   if (!ptid_equal (ptid, null_ptid))
     {
-      int pid = ptid_get_pid (ptid);
+      int pid = ptid.pid ();
       exit_inferior (pid);
     }
 
@@ -3290,7 +3290,7 @@ normal_pid_to_str (ptid_t ptid)
 {
   static char buf[32];
 
-  xsnprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
+  xsnprintf (buf, sizeof buf, "process %d", ptid.pid ());
   return buf;
 }
 
diff --git a/gdb/thread.c b/gdb/thread.c
index f5a29f5cc1..9b7ca847e9 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -645,7 +645,7 @@ first_thread_of_process (int pid)
   struct thread_info *tp, *ret = NULL;
 
   for (tp = thread_list; tp; tp = tp->next)
-    if (pid == -1 || ptid_get_pid (tp->ptid) == pid)
+    if (pid == -1 || tp->ptid.pid () == pid)
       if (ret == NULL || tp->global_num < ret->global_num)
 	ret = tp;
 
@@ -660,11 +660,11 @@ any_thread_of_process (int pid)
   gdb_assert (pid != 0);
 
   /* Prefer the current thread.  */
-  if (ptid_get_pid (inferior_ptid) == pid)
+  if (inferior_ptid.pid () == pid)
     return inferior_thread ();
 
   ALL_NON_EXITED_THREADS (tp)
-    if (ptid_get_pid (tp->ptid) == pid)
+    if (tp->ptid.pid () == pid)
       return tp;
 
   return NULL;
@@ -680,7 +680,7 @@ any_live_thread_of_process (int pid)
   gdb_assert (pid != 0);
 
   /* Prefer the current thread if it's not executing.  */
-  if (ptid_get_pid (inferior_ptid) == pid)
+  if (inferior_ptid.pid () == pid)
     {
       /* If the current thread is dead, forget it.  If it's not
 	 executing, use it.  Otherwise, still choose it (below), but
@@ -693,7 +693,7 @@ any_live_thread_of_process (int pid)
     }
 
   ALL_NON_EXITED_THREADS (tp)
-    if (ptid_get_pid (tp->ptid) == pid)
+    if (tp->ptid.pid () == pid)
       {
 	if (!tp->executing)
 	  return tp;
@@ -816,7 +816,7 @@ thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
      changes.  E.g, target remote may only discover the remote process
      pid after adding the inferior to GDB's list.  */
   inf = find_inferior_ptid (old_ptid);
-  inf->pid = ptid_get_pid (new_ptid);
+  inf->pid = new_ptid.pid ();
 
   tp = find_thread_ptid (old_ptid);
   tp->ptid = new_ptid;
@@ -835,7 +835,7 @@ set_resumed (ptid_t ptid, int resumed)
   if (all || ptid_is_pid (ptid))
     {
       for (tp = thread_list; tp; tp = tp->next)
-	if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+	if (all || tp->ptid.pid () == ptid.pid ())
 	  tp->resumed = resumed;
     }
   else
@@ -883,7 +883,7 @@ set_running (ptid_t ptid, int running)
   if (all || ptid_is_pid (ptid))
     {
       for (tp = thread_list; tp; tp = tp->next)
-	if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+	if (all || tp->ptid.pid () == ptid.pid ())
 	  {
 	    if (tp->state == THREAD_EXITED)
 	      continue;
@@ -951,7 +951,7 @@ set_executing (ptid_t ptid, int executing)
   if (all || ptid_is_pid (ptid))
     {
       for (tp = thread_list; tp; tp = tp->next)
-	if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+	if (all || tp->ptid.pid () == ptid.pid ())
 	  tp->executing = executing;
     }
   else
@@ -987,7 +987,7 @@ set_stop_requested (ptid_t ptid, int stop)
   if (all || ptid_is_pid (ptid))
     {
       for (tp = thread_list; tp; tp = tp->next)
-	if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+	if (all || tp->ptid.pid () == ptid.pid ())
 	  tp->stop_requested = stop;
     }
   else
@@ -1018,7 +1018,7 @@ finish_thread_state (ptid_t ptid)
 	{
 	  if (tp->state == THREAD_EXITED)
 	    continue;
-	  if (all || ptid_get_pid (ptid) == ptid_get_pid (tp->ptid))
+	  if (all || ptid.pid () == tp->ptid.pid ())
 	    {
 	      if (set_running_thread (tp, tp->executing))
 		any_started = 1;
@@ -1116,7 +1116,7 @@ should_print_thread (const char *requested_threads, int default_inf_num,
 	return 0;
     }
 
-  if (pid != -1 && ptid_get_pid (thr->ptid) != pid)
+  if (pid != -1 && thr->ptid.pid () != pid)
     {
       if (requested_threads != NULL && *requested_threads != '\0')
 	error (_("Requested thread not found in requested process"));
diff --git a/gdb/tid-parse.c b/gdb/tid-parse.c
index 94967a5ab3..8322e58523 100644
--- a/gdb/tid-parse.c
+++ b/gdb/tid-parse.c
@@ -92,7 +92,7 @@ parse_thread_id (const char *tidstr, const char **end)
 
   ALL_THREADS (tp)
     {
-      if (ptid_get_pid (tp->ptid) == inf->pid
+      if (tp->ptid.pid () == inf->pid
 	  && tp->per_inf_num == thr_num)
 	break;
     }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 7e46b182ba..29c29ab48f 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -620,7 +620,7 @@ tfile_target::close ()
   if (trace_fd < 0)
     return;
 
-  pid = ptid_get_pid (inferior_ptid);
+  pid = inferior_ptid.pid ();
   inferior_ptid = null_ptid;	/* Avoid confusion from thread stuff.  */
   exit_inferior_silent (pid);
 
diff --git a/gdb/vax-bsd-nat.c b/gdb/vax-bsd-nat.c
index 10cd12e950..6372c9dc59 100644
--- a/gdb/vax-bsd-nat.c
+++ b/gdb/vax-bsd-nat.c
@@ -74,7 +74,7 @@ void
 vax_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
@@ -89,7 +89,7 @@ void
 vax_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
 
   if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 890cd06c07..440211a1db 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1408,7 +1408,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
   last_sig = GDB_SIGNAL_0;
 
   DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
-	       ptid_get_pid (ptid), ptid_get_tid (ptid), step, sig));
+	       ptid.pid (), ptid_get_tid (ptid), step, sig));
 
   /* Get context for currently selected thread.  */
   th = thread_rec (ptid_get_tid (inferior_ptid), FALSE);
@@ -2887,7 +2887,7 @@ void
 windows_nat_target::close ()
 {
   DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n",
-		ptid_get_pid (inferior_ptid)));
+		inferior_ptid.pid ()));
 }
 
 /* Convert pid to printable format.  */
@@ -2899,7 +2899,7 @@ windows_nat_target::pid_to_str (ptid_t ptid)
   if (ptid_get_tid (ptid) != 0)
     {
       snprintf (buf, sizeof (buf), "Thread %d.0x%lx",
-		ptid_get_pid (ptid), ptid_get_tid (ptid));
+		ptid.pid (), ptid_get_tid (ptid));
       return buf;
     }
 
@@ -2999,7 +2999,7 @@ windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
 ptid_t
 windows_nat_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_t (ptid_get_pid (inferior_ptid), 0, lwp);
+  return ptid_t (inferior_ptid.pid (), 0, lwp);
 }
 
 /* Implementation of the to_thread_name method.  */
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 90e5c19048..b1a96c1f94 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -70,7 +70,7 @@ x86_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
      in the end before detaching the forked off process, thus making
      this compatible with older Linux kernels too.  */
 
-  parent_pid = ptid_get_pid (parent->ptid);
+  parent_pid = parent->ptid.pid ();
   parent_state = x86_debug_reg_state (parent_pid);
   child_state = x86_debug_reg_state (child_pid);
   *child_state = *parent_state;
@@ -116,7 +116,7 @@ x86_linux_nat_target::read_description ()
   /* GNU/Linux LWP ID's are process ID's.  */
   tid = ptid_get_lwp (inferior_ptid);
   if (tid == 0)
-    tid = ptid_get_pid (inferior_ptid); /* Not a threaded program.  */
+    tid = inferior_ptid.pid (); /* Not a threaded program.  */
 
 #ifdef __x86_64__
   {
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index cfd293c17f..e730a10ffa 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -139,7 +139,7 @@ void
 x86_cleanup_dregs (void)
 {
   /* Starting from scratch has the same effect.  */
-  x86_forget_process (ptid_get_pid (inferior_ptid));
+  x86_forget_process (inferior_ptid.pid ());
 }
 
 /* Insert a watchpoint to watch a memory region which starts at
@@ -151,7 +151,7 @@ x86_insert_watchpoint (CORE_ADDR addr, int len,
 		       enum target_hw_bp_type type, struct expression *cond)
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_insert_watchpoint (state, type, addr, len);
 }
@@ -164,7 +164,7 @@ x86_remove_watchpoint (CORE_ADDR addr, int len,
 		       enum target_hw_bp_type type, struct expression *cond)
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_remove_watchpoint (state, type, addr, len);
 }
@@ -176,7 +176,7 @@ int
 x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_region_ok_for_watchpoint (state, addr, len);
 }
@@ -189,7 +189,7 @@ int
 x86_stopped_data_address (CORE_ADDR *addr_p)
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_stopped_data_address (state, addr_p);
 }
@@ -201,7 +201,7 @@ int
 x86_stopped_by_watchpoint ()
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_stopped_by_watchpoint (state);
 }
@@ -213,7 +213,7 @@ int
 x86_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   bp_tgt->placed_address = bp_tgt->reqstd_address;
   return x86_dr_insert_watchpoint (state, hw_execute,
@@ -228,7 +228,7 @@ x86_remove_hw_breakpoint (struct gdbarch *gdbarch,
 			  struct bp_target_info *bp_tgt)
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_remove_watchpoint (state, hw_execute,
 				   bp_tgt->placed_address, 1);
@@ -264,7 +264,7 @@ int
 x86_stopped_by_hw_breakpoint ()
 {
   struct x86_debug_reg_state *state
-    = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+    = x86_debug_reg_state (inferior_ptid.pid ());
 
   return x86_dr_stopped_by_hw_breakpoint (state);
 }
-- 
2.14.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
                   ` (9 preceding siblings ...)
  2018-06-13 21:51 ` [RFA 01/10] Remove ptid_build Tom Tromey
@ 2018-06-13 23:22 ` Joel Brobecker
  2018-06-14  2:04   ` Simon Marchi
  10 siblings, 1 reply; 18+ messages in thread
From: Joel Brobecker @ 2018-06-13 23:22 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> This series removes the remaining standalone ptid functions in favor
> of using methods on ptid_t.
> 
> These patches were largely created by running a script.

Looks like a very nice cleanup. I scanned through some of the patches,
but not being the C++ expert in the group, I only did it out of
curiosity for now. It looks fairly mechanical, as hinted by the fact
that Tom said it was created by running a script.

Anyone against the idea behind the change itself? Otherwise, I'd be
inclined to allow Tom to self-review on that one.

Thanks Tom!
-- 
Joel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-06-13 23:22 ` [RFA 00/10] Remove standalone ptid functions Joel Brobecker
@ 2018-06-14  2:04   ` Simon Marchi
  2018-06-14 11:06     ` Pedro Alves
  0 siblings, 1 reply; 18+ messages in thread
From: Simon Marchi @ 2018-06-14  2:04 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Tom Tromey, gdb-patches

On 2018-06-13 19:22, Joel Brobecker wrote:
>> This series removes the remaining standalone ptid functions in favor
>> of using methods on ptid_t.
>> 
>> These patches were largely created by running a script.
> 
> Looks like a very nice cleanup. I scanned through some of the patches,
> but not being the C++ expert in the group, I only did it out of
> curiosity for now. It looks fairly mechanical, as hinted by the fact
> that Tom said it was created by running a script.
> 
> Anyone against the idea behind the change itself? Otherwise, I'd be
> inclined to allow Tom to self-review on that one.
> 
> Thanks Tom!

Yay, thanks Tom, I did not have the courage to do that!  I was just 
waiting for Pedro to eliminate ptid_t completely with his multi-target 
work :).

I sampled a few files, and it LGTM.  I also built the cross-compiled 
Linux configurations I have, and it went fine.  If there's a compilation 
failure resulting from this, it should be very easy to fix.

Simon

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-06-14  2:04   ` Simon Marchi
@ 2018-06-14 11:06     ` Pedro Alves
  2018-06-14 15:42       ` Tom Tromey
  0 siblings, 1 reply; 18+ messages in thread
From: Pedro Alves @ 2018-06-14 11:06 UTC (permalink / raw)
  To: Simon Marchi, Joel Brobecker; +Cc: Tom Tromey, gdb-patches

On 06/14/2018 03:04 AM, Simon Marchi wrote:
> On 2018-06-13 19:22, Joel Brobecker wrote:
>>> This series removes the remaining standalone ptid functions in favor
>>> of using methods on ptid_t.
>>>
>>> These patches were largely created by running a script.
>>
>> Looks like a very nice cleanup. I scanned through some of the patches,
>> but not being the C++ expert in the group, I only did it out of
>> curiosity for now. It looks fairly mechanical, as hinted by the fact
>> that Tom said it was created by running a script.
>>
>> Anyone against the idea behind the change itself? Otherwise, I'd be
>> inclined to allow Tom to self-review on that one.
>>
>> Thanks Tom!
> 
> Yay, thanks Tom, I did not have the courage to do that!  I was just waiting for Pedro to eliminate ptid_t completely with his multi-target work :).

I won't eliminate it completely.  :-)

> I sampled a few files, and it LGTM.  I also built the cross-compiled Linux configurations I have, and it went fine.  If there's a compilation failure resulting from this, it should be very easy to fix.

I'm fine with this.

I'm just not so sure about eliminating pid_to_ptid.  I'd ran into uses
of that where I had second thoughts on whether replacing it with
a ptid_t ctor call is really a good idea.  What I thought was,
that when you're reading the code, a pid_to_ptid call more clearly shows
that want to build a process-wide (sometimes a filter) ptid as opposed
to a single thread ptid.  It also helps with grepping, if you'd like
to find such spots.  But it's not a big deal, and I can certainly live
with it.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-06-14 11:06     ` Pedro Alves
@ 2018-06-14 15:42       ` Tom Tromey
  2018-07-02 15:00         ` Tom Tromey
  0 siblings, 1 reply; 18+ messages in thread
From: Tom Tromey @ 2018-06-14 15:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Simon Marchi, Joel Brobecker, Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I'm just not so sure about eliminating pid_to_ptid.  I'd ran into uses
Pedro> of that where I had second thoughts on whether replacing it with
Pedro> a ptid_t ctor call is really a good idea.  What I thought was,
Pedro> that when you're reading the code, a pid_to_ptid call more clearly shows
Pedro> that want to build a process-wide (sometimes a filter) ptid as opposed
Pedro> to a single thread ptid.  It also helps with grepping, if you'd like
Pedro> to find such spots.  But it's not a big deal, and I can certainly live
Pedro> with it.

It's easy enough to drop it out of the series if you would prefer that,
or to rename it to something like ptid_t::from_pid.  Let me know.

Tom

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-06-14 15:42       ` Tom Tromey
@ 2018-07-02 15:00         ` Tom Tromey
  2018-07-03 13:54           ` Pedro Alves
  0 siblings, 1 reply; 18+ messages in thread
From: Tom Tromey @ 2018-07-02 15:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, Simon Marchi, Joel Brobecker, gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> I'm just not so sure about eliminating pid_to_ptid.  I'd ran into uses
Pedro> of that where I had second thoughts on whether replacing it with
Pedro> a ptid_t ctor call is really a good idea.  What I thought was,
Pedro> that when you're reading the code, a pid_to_ptid call more clearly shows
Pedro> that want to build a process-wide (sometimes a filter) ptid as opposed
Pedro> to a single thread ptid.  It also helps with grepping, if you'd like
Pedro> to find such spots.  But it's not a big deal, and I can certainly live
Pedro> with it.

Tom> It's easy enough to drop it out of the series if you would prefer that,
Tom> or to rename it to something like ptid_t::from_pid.  Let me know.

Hi Pedro.  This series is still pending since I was waiting for a reply
to this.

Tom

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-07-02 15:00         ` Tom Tromey
@ 2018-07-03 13:54           ` Pedro Alves
  2018-07-03 15:27             ` Tom Tromey
  0 siblings, 1 reply; 18+ messages in thread
From: Pedro Alves @ 2018-07-03 13:54 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Simon Marchi, Joel Brobecker, gdb-patches

On 07/02/2018 04:00 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
> 
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> Pedro> I'm just not so sure about eliminating pid_to_ptid.  I'd ran into uses
> Pedro> of that where I had second thoughts on whether replacing it with
> Pedro> a ptid_t ctor call is really a good idea.  What I thought was,
> Pedro> that when you're reading the code, a pid_to_ptid call more clearly shows
> Pedro> that want to build a process-wide (sometimes a filter) ptid as opposed
> Pedro> to a single thread ptid.  It also helps with grepping, if you'd like
> Pedro> to find such spots.  But it's not a big deal, and I can certainly live
> Pedro> with it.
> 
> Tom> It's easy enough to drop it out of the series if you would prefer that,
> Tom> or to rename it to something like ptid_t::from_pid.  Let me know.
> 
> Hi Pedro.  This series is still pending since I was waiting for a reply
> to this.

Sorry, I kept wanting to take a better look, and ended up putting it
off for too long.  I looked around the code a little better now, and I'm now
thinking that we won't lose as much as I expected -- most of a spots
end up being clear from context.  As for grepping, it's not as convenient, but
we can still find most spots with "ptid_t ([^,]*)" or some such I guess.

So OK with me as is.  Sorry for the delay.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFA 00/10] Remove standalone ptid functions
  2018-07-03 13:54           ` Pedro Alves
@ 2018-07-03 15:27             ` Tom Tromey
  0 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2018-07-03 15:27 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, Simon Marchi, Joel Brobecker, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> So OK with me as is.  Sorry for the delay.

No problem.
This rebase was hairy enough that I'm re-running it through the buildbot first.
I also grepped for each removed function to make sure there were no
leftovers; this caught a more recent change in aarch64-linux-nat.c.

Tom

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-07-03 15:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13 21:51 [RFA 00/10] Remove standalone ptid functions Tom Tromey
2018-06-13 21:51 ` [RFA 07/10] Remove ptid_lwp_p Tom Tromey
2018-06-13 21:51 ` [RFA 10/10] Remove ptid_equal Tom Tromey
2018-06-13 21:51 ` [RFA 08/10] Remove ptid_tid_p Tom Tromey
2018-06-13 21:51 ` [RFA 09/10] Remove ptid_match Tom Tromey
2018-06-13 21:51 ` [RFA 06/10] Remove ptid_is_pid Tom Tromey
2018-06-13 21:51 ` [RFA 03/10] Remove ptid_get_pid Tom Tromey
2018-06-13 21:51 ` [RFA 05/10] Remove ptid_get_tid Tom Tromey
2018-06-13 21:51 ` [RFA 02/10] Remove pid_to_ptid Tom Tromey
2018-06-13 21:51 ` [RFA 04/10] Remove ptid_get_lwp Tom Tromey
2018-06-13 21:51 ` [RFA 01/10] Remove ptid_build Tom Tromey
2018-06-13 23:22 ` [RFA 00/10] Remove standalone ptid functions Joel Brobecker
2018-06-14  2:04   ` Simon Marchi
2018-06-14 11:06     ` Pedro Alves
2018-06-14 15:42       ` Tom Tromey
2018-07-02 15:00         ` Tom Tromey
2018-07-03 13:54           ` Pedro Alves
2018-07-03 15:27             ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).