aboutsummaryrefslogtreecommitdiff
path: root/devel/gdb/files/commit-6719bc690e2
blob: 8d1183ada96c770929277cc8cff782a0643f4c03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
commit 20c8aa681d97f5ab8a8f374b23339777b1dc4353
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.
    
    (cherry picked from commit 6719bc690e2829c50d3d3bb22ede1324e5baa12a)

diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 6d76c8234d5..51234eaa6c9 100644
--- gdb/fbsd-nat.c
+++ 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
--- gdb/fbsd-nat.h
+++ gdb/fbsd-nat.h
@@ -166,4 +166,8 @@ class fbsd_nat_target : public inf_ptrace_target
   }
 };
 
+/* 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 */