public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] fbsd-nat: Return nullptr rather than failing ::thread_name.
@ 2022-02-22 19:34 John Baldwin
  0 siblings, 0 replies; only message in thread
From: John Baldwin @ 2022-02-22 19:34 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d0bbe64c5a3f9608ae5987f1267de7a734ee8151

commit d0bbe64c5a3f9608ae5987f1267de7a734ee8151
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Tue Feb 22 11:22:14 2022 -0800

    fbsd-nat: Return nullptr rather than failing ::thread_name.
    
    ptrace on FreeBSD cannot be used against running processes and instead
    fails with EBUSY.  This meant that 'info threads' would fail if any of
    the threads were running (for example when using schedule-multiple=on
    in gdb.base/fork-running-state.exp).  Instead of throwing errors, just
    return nullptr as no thread name is better than causing info threads to
    fail completely.

Diff:
---
 gdb/fbsd-nat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 89c9ae6a9b7..cea3ce7d384 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -819,9 +819,9 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
      if a name has not been set explicitly.  Return a NULL name in
      that case.  */
   if (!fbsd_fetch_kinfo_proc (pid, &kp))
-    perror_with_name (_("Failed to fetch process information"));
+    return nullptr;
   if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1)
-    perror_with_name (("ptrace (PT_LWPINFO)"));
+    return nullptr;
   if (strcmp (kp.ki_comm, pl.pl_tdname) == 0)
     return NULL;
   xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-22 19:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 19:34 [binutils-gdb] fbsd-nat: Return nullptr rather than failing ::thread_name John Baldwin

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).