From d3a70e03cf51c8fb6bc183eaff7559edffec2045 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 4 Mar 2019 12:05:03 -0700 Subject: Change iterate_over_lwps to take a gdb::function_view This changes iterate_over_lwps to use a gdb::function_view. This was needed in order to make null_ptid and minus_one_ptid 'const'. gdb/ChangeLog 2019-03-12 Tom Tromey * linux-nat.c (iterate_over_lwps): Update. (stop_callback): Remove parameter. (stop_wait_callback, detach_callback, resume_set_callback) (select_singlestep_lwp_callback, set_ignore_sigint) (status_callback, resumed_callback, resume_clear_callback) (kill_callback, kill_wait_callback, linux_nat_stop_lwp): Remove data parameter. (linux_nat_target::detach, linux_nat_target::resume) (linux_stop_and_wait_all_lwps, select_event_lwp) (linux_nat_filter_event, linux_nat_wait_1) (linux_nat_target::kill, linux_nat_target::stop) (linux_nat_target::stop): Update. (linux_nat_resume_callback): Change type. (resume_stopped_resumed_lwps, count_events_callback) (select_event_lwp_callback): Likewise. (linux_stop_lwp, linux_nat_stop_lwp): Update. * arm-linux-nat.c (struct update_registers_data): Remove. (update_registers_callback): Change type. (arm_linux_insert_hw_breakpoint1): Update. * nat/x86-linux-dregs.c (update_debug_registers_callback): Remove parameter. (x86_linux_dr_set_addr): Update. (x86_linux_dr_set_control): Update. * nat/linux-nat.h (iterate_over_lwps_ftype): Remove parameter. (iterate_over_lwps): Use gdb::function_view. * nat/aarch64-linux-hw-point.c (struct aarch64_dr_update_callback_param): Remove. (debug_reg_change_callback): Change type. (aarch64_notify_debug_reg_change): Update. * s390-linux-nat.c (s390_refresh_per_info): Update. gdb/gdbserver/ChangeLog 2019-03-12 Tom Tromey * linux-low.c (iterate_over_lwps): Update. --- gdb/arm-linux-nat.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'gdb/arm-linux-nat.c') diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index e4622b0..8c98a71 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -952,26 +952,18 @@ arm_linux_hw_breakpoint_equal (const struct arm_linux_hw_breakpoint *p1, /* Callback to mark a watch-/breakpoint to be updated in all threads of the current process. */ -struct update_registers_data -{ - int watch; - int index; -}; - static int -update_registers_callback (struct lwp_info *lwp, void *arg) +update_registers_callback (struct lwp_info *lwp, int watch, int index) { - struct update_registers_data *data = (struct update_registers_data *) arg; - if (lwp->arch_private == NULL) lwp->arch_private = XCNEW (struct arch_lwp_info); /* The actual update is done later just before resuming the lwp, we just mark that the registers need updating. */ - if (data->watch) - lwp->arch_private->wpts_changed[data->index] = 1; + if (watch) + lwp->arch_private->wpts_changed[index] = 1; else - lwp->arch_private->bpts_changed[data->index] = 1; + lwp->arch_private->bpts_changed[index] = 1; /* If the lwp isn't stopped, force it to momentarily pause, so we can update its breakpoint registers. */ @@ -991,7 +983,6 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt, ptid_t pid_ptid; gdb_byte count, i; struct arm_linux_hw_breakpoint* bpts; - struct update_registers_data data; pid = inferior_ptid.pid (); pid_ptid = ptid_t (pid); @@ -1010,10 +1001,13 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt, for (i = 0; i < count; ++i) if (!arm_hwbp_control_is_enabled (bpts[i].control)) { - data.watch = watchpoint; - data.index = i; bpts[i] = *bpt; - iterate_over_lwps (pid_ptid, update_registers_callback, &data); + iterate_over_lwps (pid_ptid, + [=] (struct lwp_info *info) + { + return update_registers_callback (info, watch, + index); + }); break; } -- cgit v1.1