aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/aarch64-linux-hw-point.c27
-rw-r--r--gdb/nat/linux-nat.h9
-rw-r--r--gdb/nat/x86-linux-dregs.c6
3 files changed, 17 insertions, 25 deletions
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index eed0606..1efec9a 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -278,27 +278,17 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
*next_addr_orig_p = align_down (*next_addr_orig_p + alignment, alignment);
}
-struct aarch64_dr_update_callback_param
-{
- int is_watchpoint;
- unsigned int idx;
-};
-
-/* Callback for iterate_over_lwps. Records the
+/* Helper for aarch64_notify_debug_reg_change. Records the
information about the change of one hardware breakpoint/watchpoint
setting for the thread LWP.
- The information is passed in via PTR.
N.B. The actual updating of hardware debug registers is not
carried out until the moment the thread is resumed. */
static int
-debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
+debug_reg_change_callback (struct lwp_info *lwp, int is_watchpoint,
+ unsigned int idx)
{
- struct aarch64_dr_update_callback_param *param_p
- = (struct aarch64_dr_update_callback_param *) ptr;
int tid = ptid_of_lwp (lwp).lwp ();
- int idx = param_p->idx;
- int is_watchpoint = param_p->is_watchpoint;
struct arch_lwp_info *info = lwp_arch_private_info (lwp);
dr_changed_t *dr_changed_ptr;
dr_changed_t dr_changed;
@@ -356,13 +346,14 @@ static void
aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
int is_watchpoint, unsigned int idx)
{
- struct aarch64_dr_update_callback_param param;
ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
- param.is_watchpoint = is_watchpoint;
- param.idx = idx;
-
- iterate_over_lwps (pid_ptid, debug_reg_change_callback, (void *) &param);
+ iterate_over_lwps (pid_ptid, [=] (struct lwp_info *info)
+ {
+ return debug_reg_change_callback (info,
+ is_watchpoint,
+ idx);
+ });
}
/* Reconfigure STATE to be compatible with Linux kernels with the PR
diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
index 1e32dd9..29f43d8 100644
--- a/gdb/nat/linux-nat.h
+++ b/gdb/nat/linux-nat.h
@@ -20,6 +20,7 @@
#ifndef NAT_LINUX_NAT_H
#define NAT_LINUX_NAT_H
+#include "common/function-view.h"
#include "target/waitstatus.h"
struct lwp_info;
@@ -43,7 +44,7 @@ struct arch_lwp_info;
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);
+typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp);
/* Iterate over all LWPs. Calls CALLBACK with its second argument set
to DATA for every LWP in the list. If CALLBACK returns nonzero for
@@ -51,9 +52,9 @@ typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp, void *arg);
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);
+extern struct lwp_info *iterate_over_lwps
+ (ptid_t filter,
+ gdb::function_view<iterate_over_lwps_ftype> callback);
/* Return the ptid of LWP. */
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index 33bbfa2..29b4ee1 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -76,7 +76,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
the actual debug registers immediately prior to LWP resuming. */
static int
-update_debug_registers_callback (struct lwp_info *lwp, void *arg)
+update_debug_registers_callback (struct lwp_info *lwp)
{
lwp_set_debug_registers_changed (lwp, 1);
@@ -106,7 +106,7 @@ x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
- iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
+ iterate_over_lwps (pid_ptid, update_debug_registers_callback);
}
/* See nat/x86-linux-dregs.h. */
@@ -124,7 +124,7 @@ x86_linux_dr_set_control (unsigned long control)
{
ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
- iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
+ iterate_over_lwps (pid_ptid, update_debug_registers_callback);
}
/* See nat/x86-linux-dregs.h. */