+2020-09-10 Kamil Rytarowski <n54@gmx.com>
+
+ * netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add.
+ * netbsd-nat.c (netbsd_nat::qxfer_siginfo): Likewise.
+
2020-09-10 Kamil Rytarowski <n54@gmx.com>
* netbsd-nat.h (netbsd_nat::enable_proc_events): Add.
perror_with_name (("ptrace"));
}
+/* See netbsd-nat.h. */
+
+int
+qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset, int len)
+{
+ ptrace_siginfo_t psi;
+
+ if (offset > sizeof (siginfo_t))
+ return -1;
+
+ if (ptrace (PT_GET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
+ return -1;
+
+ if (offset + len > sizeof (siginfo_t))
+ len = sizeof (siginfo_t) - offset;
+
+ if (readbuf != NULL)
+ memcpy (readbuf, ((gdb_byte *) &psi.psi_siginfo) + offset, len);
+ else
+ {
+ memcpy (((gdb_byte *) &psi.psi_siginfo) + offset, writebuf, len);
+
+ if (ptrace (PT_SET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
+ return -1;
+ }
+ return len;
+}
+
}
traced. */
extern void enable_proc_events (pid_t pid);
+
+/* Implement reading and writing of inferior's siginfo_t specified by PID.
+ Returns -1 on failure and the number of bytes on a successful transfer.
+
+ This function assumes internally that the queried process is stopped and
+ traced. */
+
+extern int qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len);
}
#endif