Add netbsd_nat::enable_proc_events in gdb/nat
Add generic function to enable debugger events in a process. gdb/ChangeLog: * netbsd-nat.h (netbsd_nat::enable_proc_events): Add. * netbsd-nat.c: Include <sys/ptrace.h>. * (netbsd_nat::enable_proc_events): Add.
This commit is contained in:
parent
c489f8c6e6
commit
feedfcc773
@ -1,3 +1,9 @@
|
||||
2020-09-10 Kamil Rytarowski <n54@gmx.com>
|
||||
|
||||
* netbsd-nat.h (netbsd_nat::enable_proc_events): Add.
|
||||
* netbsd-nat.c: Include <sys/ptrace.h>.
|
||||
* (netbsd_nat::enable_proc_events): Add.
|
||||
|
||||
2020-09-10 Kamil Rytarowski <n54@gmx.com>
|
||||
|
||||
* netbsd-nat.h: Include "gdbsupport/function-view.h".
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "gdbsupport/common-debug.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <cstring>
|
||||
@ -163,4 +164,21 @@ for_each_thread (pid_t pid, gdb::function_view<void (ptid_t)> callback)
|
||||
netbsd_thread_lister (pid, fn);
|
||||
}
|
||||
|
||||
/* See netbsd-nat.h. */
|
||||
|
||||
void
|
||||
enable_proc_events (pid_t pid)
|
||||
{
|
||||
int events;
|
||||
|
||||
if (ptrace (PT_GET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
|
||||
perror_with_name (("ptrace"));
|
||||
|
||||
events |= PTRACE_LWP_CREATE;
|
||||
events |= PTRACE_LWP_EXIT;
|
||||
|
||||
if (ptrace (PT_SET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
|
||||
perror_with_name (("ptrace"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,13 @@ extern const char *thread_name (ptid_t ptid);
|
||||
|
||||
extern void for_each_thread (pid_t pid,
|
||||
gdb::function_view<void (ptid_t)> callback);
|
||||
|
||||
/* Enable additional event reporting in a new process specified by PID.
|
||||
|
||||
This function assumes internally that the queried process is stopped and
|
||||
traced. */
|
||||
|
||||
extern void enable_proc_events (pid_t pid);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user