--- ./gdb/aix-thread.c_orig	2021-09-09 06:46:43.000000000 -0500
+++ ./gdb/aix-thread.c	2021-09-14 08:24:25.000000000 -0500
@@ -708,7 +708,7 @@
 
   while (1)
   {
-    if (getthrds (inferior_ptid.pid (), &thrinf, 
+    if (getthrds (current_inferior ()->pid, &thrinf, 
           	  sizeof (thrinf), &ktid, 1) != 1)
       break;
 
@@ -791,7 +791,7 @@
 
   /* Apply differences between the two arrays to GDB's thread list.  */
 
-  infpid = inferior_ptid.pid ();
+  infpid = current_inferior ()->pid; 
   for (pi = gi = 0; pi < pcount || gi < gcount;)
     {
       if (pi == pcount)
@@ -883,11 +883,11 @@
   struct thread_info *thread = NULL;
 
   if (!pd_active)
-    return inferior_ptid;
+    return ptid_t (current_inferior ()->pid);
 
   status = pthdb_session_update (pd_session);
   if (status != PTHDB_SUCCESS)
-    return inferior_ptid;
+    return ptid_t (current_inferior ()->pid);;
 
   sync_threadlists ();
 
@@ -897,7 +897,7 @@
   if (tid != 0)
     thread = iterate_over_threads (iter_tid, &tid);
   if (!thread)
-    ptid = inferior_ptid;
+    ptid = ptid_t (current_inferior ()->pid);
   else
     {
       ptid = thread->ptid;
@@ -921,7 +921,7 @@
 			       &pd_session);
   if (status != PTHDB_SUCCESS)
     {
-      return inferior_ptid;
+      return ptid_t (current_inferior ()->pid);
     }
   pd_active = 1;
   return pd_update (set_infpid);
@@ -932,11 +932,12 @@
 static void
 pd_deactivate (void)
 {
+  ptid_t ptdrtn = ptid_t (current_inferior ()->pid);
   if (!pd_active)
     return;
   pthdb_session_destroy (pd_session);
   
-  pid_to_prc (&inferior_ptid);
+  pid_to_prc (&ptdrtn);
   pd_active = 0;
 }
 
--- ./gdb/rs6000-nat.c_orig	2021-11-21 09:17:42 +0000
+++ ./gdb/rs6000-nat.c	2021-11-21 09:22:32 +0000
@@ -393,7 +393,7 @@
 				 ULONGEST offset, ULONGEST len,
 				 ULONGEST *xfered_len)
 {
-  pid_t pid = inferior_ptid.pid ();
+  pid_t pid = current_inferior ()->pid;
   int arch64 = ARCH64 ();
 
   switch (object)
@@ -522,14 +522,16 @@
 	  /* Claim it exited with unknown signal.  */
 	  ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
 	  ourstatus->value.sig = GDB_SIGNAL_UNKNOWN;
-	  return inferior_ptid;
+	  return ptid_t (current_inferior ()->pid);
 	}
 
       /* Ignore terminated detached child processes.  */
-      if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
+      if (!WIFSTOPPED (status) && pid != pid_t(current_inferior ()->pid))
 	pid = -1;
     }
   while (pid == -1);
+  
+  ptid = ptid_t (pid);
 
   /* AIX has a couple of strange returns from wait().  */
 
@@ -655,7 +657,7 @@
   if (writebuf)
     return TARGET_XFER_E_IO;
 
-  gdb::byte_vector ldi_buf = rs6000_ptrace_ldinfo (inferior_ptid);
+  gdb::byte_vector ldi_buf = rs6000_ptrace_ldinfo (ptid_t (current_inferior ()->pid));
   result = rs6000_aix_ld_info_to_xml (target_gdbarch (), ldi_buf.data (),
 				      readbuf, offset, len, 1);
 
