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  <tromey@adacore.com>

	* 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  <tromey@adacore.com>

	* linux-low.c (iterate_over_lwps): Update.
This commit is contained in:
Tom Tromey
2019-03-04 12:05:03 -07:00
parent 7a6e0d89bb
commit d3a70e03cf
9 changed files with 143 additions and 109 deletions

View File

@ -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