if (!fbsd_fetch_kinfo_proc (pid, &kp))
     perror_with_name (_("Failed to fetch process information"));
   if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_LWPINFO)"));
   if (strcmp (kp.ki_comm, pl.pl_tdname) == 0)
     return NULL;
   xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname);
 
   if (ptrace (PT_GET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events,
              sizeof (events)) == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_GET_EVENT_MASK)"));
   events |= PTRACE_FORK | PTRACE_LWP;
 #ifdef PTRACE_VFORK
   events |= PTRACE_VFORK;
 #endif
   if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events,
              sizeof (events)) == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_SET_EVENT_MASK)"));
 #else
 #ifdef TDP_RFPPWAIT
   if (ptrace (PT_FOLLOW_FORK, pid, (PTRACE_TYPE_ARG3)0, 1) == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_FOLLOW_FORK)"));
 #endif
 #ifdef PT_LWP_EVENTS
   if (ptrace (PT_LWP_EVENTS, pid, (PTRACE_TYPE_ARG3)0, 1) == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_LWP_EVENTS)"));
 #endif
 #endif
 }
   gdb_assert (!in_thread_list (target, ptid_t (pid)));
   nlwps = ptrace (PT_GETNUMLWPS, pid, NULL, 0);
   if (nlwps == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_GETNUMLWPS)"));
 
   gdb::unique_xmalloc_ptr<lwpid_t[]> lwps (XCNEWVEC (lwpid_t, nlwps));
 
   nlwps = ptrace (PT_GETLWPLIST, pid, (caddr_t) lwps.get (), nlwps);
   if (nlwps == -1)
-    perror_with_name (("ptrace"));
+    perror_with_name (("ptrace (PT_GETLWPLIST)"));
 
   for (i = 0; i < nlwps; i++)
     {
          /* Don't add exited threads.  Note that this is only called
             when attaching to a multi-threaded process.  */
          if (ptrace (PT_LWPINFO, lwps[i], (caddr_t) &pl, sizeof pl) == -1)
-           perror_with_name (("ptrace"));
+           perror_with_name (("ptrace (PT_LWPINFO)"));
          if (pl.pl_flags & PL_FLAG_EXITED)
            continue;
 #endif
            request = PT_SUSPEND;
 
          if (ptrace (request, tp->ptid.lwp (), NULL, 0) == -1)
-           perror_with_name (("ptrace"));
+           perror_with_name (request == PT_RESUME ?
+                             ("ptrace (PT_RESUME)") :
+                             ("ptrace (PT_SUSPEND)"));
        }
     }
   else
         until the process is continued however).  */
       for (thread_info *tp : all_non_exited_threads (this, ptid))
        if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1)
-         perror_with_name (("ptrace"));
+         perror_with_name (("ptrace (PT_RESUME)"));
       ptid = inferior_ptid;
     }
 
   if (step)
     {
       if (ptrace (PT_SETSTEP, get_ptrace_pid (ptid), NULL, 0) == -1)
-       perror_with_name (("ptrace"));
+       perror_with_name (("ptrace (PT_SETSTEP)"));
       step = 0;
     }
   ptid = ptid_t (ptid.pid ());
 
          pid = wptid.pid ();
          if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
-           perror_with_name (("ptrace"));
+           perror_with_name (("ptrace (PT_LWPINFO)"));
 
          wptid = ptid_t (pid, pl.pl_lwpid);
 
                  delete_thread (thr);
                }
              if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1)
-               perror_with_name (("ptrace"));
+               perror_with_name (("ptrace (PT_CONTINUE)"));
              continue;
            }
 #endif
                  gdb_assert (pid == child);
 
                  if (ptrace (PT_LWPINFO, child, (caddr_t)&pl, sizeof pl) == -1)
-                   perror_with_name (("ptrace"));
+                   perror_with_name (("ptrace (PT_LWPINFO)"));
 
                  gdb_assert (pl.pl_flags & PL_FLAG_CHILD);
                  child_ptid = ptid_t (child, pl.pl_lwpid);
                 and once system call stops are enabled on a process
                 it stops for all system call entries and exits.  */
              if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1)
-               perror_with_name (("ptrace"));
+               perror_with_name (("ptrace (PT_CONTINUE)"));
              continue;
            }
        }
         infrun.c.  */
 
       if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
-       perror_with_name (("ptrace"));
+       perror_with_name (("ptrace (PT_DETACH)"));
 
 #ifndef PTRACE_VFORK
       if (fork_kind () == TARGET_WAITKIND_VFORKED)