From: John Baldwin Date: Tue, 22 Mar 2022 19:05:43 +0000 (-0700) Subject: fbsd-nat: Add helper routine to fetch siginfo_t for a ptid. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6719bc690e2829c50d3d3bb22ede1324e5baa12a;p=binutils-gdb.git fbsd-nat: Add helper routine to fetch siginfo_t for a ptid. --- 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 */