mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
fbsd-nat: Include ptrace operation in error messages.
This commit is contained in:
parent
9385df2a58
commit
5efac66ca6
@ -821,7 +821,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
|
||||
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);
|
||||
@ -850,22 +850,22 @@ fbsd_enable_proc_events (pid_t pid)
|
||||
|
||||
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
|
||||
}
|
||||
@ -884,13 +884,13 @@ fbsd_add_threads (fbsd_nat_target *target, pid_t pid)
|
||||
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++)
|
||||
{
|
||||
@ -904,7 +904,7 @@ fbsd_add_threads (fbsd_nat_target *target, pid_t pid)
|
||||
/* 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
|
||||
@ -1179,7 +1179,9 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
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
|
||||
@ -1188,7 +1190,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1218,7 +1220,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
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 ());
|
||||
@ -1306,7 +1308,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
|
||||
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);
|
||||
|
||||
@ -1338,7 +1340,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
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
|
||||
@ -1401,7 +1403,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
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);
|
||||
@ -1490,7 +1492,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1637,7 +1639,7 @@ fbsd_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user