[binutils-gdb] fbsd-nat: Add helper routine to fetch siginfo_t for a ptid.

John Baldwin jhb@sourceware.org
Tue Mar 22 22:53:51 GMT 2022


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

commit 6719bc690e2829c50d3d3bb22ede1324e5baa12a
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Tue Mar 22 12:05:43 2022 -0700

    fbsd-nat: Add helper routine to fetch siginfo_t for a ptid.

Diff:
---
 gdb/fbsd-nat.c | 16 ++++++++++++++++
 gdb/fbsd-nat.h |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 6d76c8234d5..51234eaa6c9 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1766,6 +1766,22 @@ fbsd_nat_target::store_register_set (struct regcache *regcache, int regnum,
   return false;
 }
 
+/* See fbsd-nat.h.  */
+
+bool
+fbsd_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
+{
+  struct ptrace_lwpinfo pl;
+  pid_t pid = get_ptrace_pid (ptid);
+
+  if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
+    return false;
+  if (!(pl.pl_flags & PL_FLAG_SI))
+    return false;;
+  *siginfo = pl.pl_siginfo;
+  return (true);
+}
+
 void _initialize_fbsd_nat ();
 void
 _initialize_fbsd_nat ()
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index 2f17be5a8f0..d7c8eb81e96 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -166,4 +166,8 @@ protected:
   }
 };
 
+/* Fetch the signal information for PTID and store it in *SIGINFO.
+   Return true if successful.  */
+bool fbsd_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo);
+
 #endif /* fbsd-nat.h */


More information about the Gdb-cvs mailing list