--- ./gdb/aix-thread.c_orig	2023-05-24 22:24:07.905864993 +0000
+++ ./gdb/aix-thread.c	2023-05-24 22:27:02.754060315 +0000
@@ -1050,17 +1050,17 @@
    application is pthreaded, and if so, prepare for thread debugging.  */
 
 static void
-pd_enable (void)
+pd_enable (inferior *inf)
 {
   int status;
   char *stub_name;
   struct bound_minimal_symbol ms;
   struct aix_thread_variables *data;
 
-  if (!inferior_ptid.pid ())
+  if (inf == NULL)
     return;
   
-  data = get_thread_data_helper_for_ptid (inferior_ptid);
+  data = get_aix_thread_variables_data (inf); 
 
   /* Don't initialize twice.  */
   if (data->pd_able)
@@ -1071,7 +1071,7 @@
 
   /* Check whether the application is pthreaded.  */
   stub_name = NULL;
-  status = pthdb_session_pthreaded (inferior_ptid.pid (), PTHDB_FLAG_REGS,
+  status = pthdb_session_pthreaded (inf->pid, PTHDB_FLAG_REGS,
 				    &pd_callbacks, &stub_name);
   if ((status != PTHDB_SUCCESS
        && status != PTHDB_NOT_PTHREADED) || !stub_name)
@@ -1089,7 +1089,6 @@
   current_inferior ()->push_target (&aix_thread_ops);
   data->pd_able = 1; 
 
-  inferior *inf = current_inferior (); 
   /* When attaching / handling fork child, don't try activating
      thread debugging until we know about all shared libraries.  */ 
   if (inf->in_initial_library_scan)
