aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/linux-nat.h
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-03-24 14:05:43 +0000
committerGary Benson <gbenson@redhat.com>2015-03-24 14:05:43 +0000
commit6d4ee8c6ad7d5b04e524b2b48ffe5639028594a5 (patch)
tree796ae04a4d944777a1aa9bcde44ec114b58f11af /gdb/nat/linux-nat.h
parent70a0bb6b590bcfe304fe082d421feb52e0a0d4dc (diff)
downloadgdb-6d4ee8c6ad7d5b04e524b2b48ffe5639028594a5.zip
gdb-6d4ee8c6ad7d5b04e524b2b48ffe5639028594a5.tar.gz
gdb-6d4ee8c6ad7d5b04e524b2b48ffe5639028594a5.tar.bz2
Add iterate_over_lwps to gdbserver
This commit introduces a new function, iterate_over_lwps, that shared Linux code can use to call a function for each LWP that matches certain criteria. This function already existed in GDB and was in use by GDB's various low-level Linux x86 debug register setters. An equivalent was written for gdbserver and gdbserver's low-level Linux x86 debug register setters were modified to use it. gdb/ChangeLog: * linux-nat.h: Include nat/linux-nat.h. (iterate_over_lwps): Move declaration to nat/linux-nat.h. * nat/linux-nat.h (struct lwp_info): New forward declaration. (iterate_over_lwps_ftype): New typedef. (iterate_over_lwps): New declaration. * linux-nat.h (iterate_over_lwps): Update comment. Use iterate_over_lwps_ftype. Update callback return value check. gdb/gdbserver/ChangeLog: * linux-low.h: Include nat/linux-nat.h. * linux-low.c (iterate_over_lwps_args): New structure. (iterate_over_lwps_filter): New function. (iterate_over_lwps): Likewise. * linux-x86-low.c (update_debug_registers_callback): Update signature to what iterate_over_lwps expects. Remove PID check that iterate_over_lwps now performs. (x86_dr_low_set_addr): Use iterate_over_lwps. (x86_dr_low_set_control): Likewise.
Diffstat (limited to 'gdb/nat/linux-nat.h')
-rw-r--r--gdb/nat/linux-nat.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
index c06f72d..c534944 100644
--- a/gdb/nat/linux-nat.h
+++ b/gdb/nat/linux-nat.h
@@ -20,6 +20,8 @@
#ifndef LINUX_NAT_H
#define LINUX_NAT_H
+struct lwp_info;
+
/* Unlike other extended result codes, WSTOPSIG (status) on
PTRACE_O_TRACESYSGOOD syscall events doesn't return SIGTRAP, but
instead SIGTRAP with bit 7 set. */
@@ -32,4 +34,17 @@
extern ptid_t current_lwp_ptid (void);
+/* Function type for the CALLBACK argument of iterate_over_lwps. */
+typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp, void *arg);
+
+/* Iterate over all LWPs. Calls CALLBACK with its second argument set
+ to DATA for every LWP in the list. If CALLBACK returns nonzero for
+ a particular LWP, return a pointer to the structure describing that
+ LWP immediately. Otherwise return NULL. This function must be
+ provided by the client. */
+
+extern struct lwp_info *iterate_over_lwps (ptid_t filter,
+ iterate_over_lwps_ftype callback,
+ void *data);
+
#endif /* LINUX_NAT_H */