Add a common utility function to read and write siginfo_t in inferior
gdb/ChangeLog: * netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add. * netbsd-nat.c (netbsd_nat::qxfer_siginfo): Likewise.
This commit is contained in:
parent
feedfcc773
commit
1ccb2c170c
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -181,4 +181,33 @@ enable_proc_events (pid_t pid)
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,16 @@ extern void for_each_thread (pid_t pid,
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user