diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-11-19 22:23:22 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2017-11-19 22:23:22 -0500 |
commit | 00192f771796a144fe27f5f1d98d8e6f66976221 (patch) | |
tree | a6d13f19a5cbbff28e05370135853a1bac0b11ce /gdb | |
parent | 2bee2b6ca4cb1a736f963a168dd2ded2831c540d (diff) | |
download | gdb-00192f771796a144fe27f5f1d98d8e6f66976221.zip gdb-00192f771796a144fe27f5f1d98d8e6f66976221.tar.gz gdb-00192f771796a144fe27f5f1d98d8e6f66976221.tar.bz2 |
Remove usages of find_inferior in linux-arm-low.c
Replace two usages with the overload of for_each_thread that filters on
pid. It allows to simplify the callback a little bit.
gdb/gdbserver/ChangeLog:
* linux-arm-low.c (struct update_registers_data): Remove.
(update_registers_callback): Return void, take arguments
directly, don't check thread's pid.
(arm_insert_point, arm_remove_point): Use for_each_thread.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/linux-arm-low.c | 55 |
2 files changed, 33 insertions, 29 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index ded57cd..c9f5966 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,12 @@ 2017-11-19 Simon Marchi <simon.marchi@ericsson.com> + * linux-arm-low.c (struct update_registers_data): Remove. + (update_registers_callback): Return void, take arguments + directly, don't check thread's pid. + (arm_insert_point, arm_remove_point): Use for_each_thread. + +2017-11-19 Simon Marchi <simon.marchi@ericsson.com> + * win32-low.c (continue_one_thread): Return void, take argument directly. (child_continue): Use for_each_thread. diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 3fddec6..f2c030d 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -460,35 +460,22 @@ arm_linux_hw_point_initialize (enum raw_bkpt_type raw_type, CORE_ADDR addr, /* Callback to mark a watch-/breakpoint to be updated in all threads of the current process. */ -struct update_registers_data -{ - int watch; - int i; -}; - -static int -update_registers_callback (thread_info *thread, void *arg) +static void +update_registers_callback (thread_info *thread, int watch, int i) { struct lwp_info *lwp = get_thread_lwp (thread); - struct update_registers_data *data = (struct update_registers_data *) arg; - - /* Only update the threads of the current process. */ - if (pid_of (thread) == pid_of (current_thread)) - { - /* 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->i] = 1; - else - lwp->arch_private->bpts_changed[data->i] = 1; - /* If the lwp isn't stopped, force it to momentarily pause, so - we can update its breakpoint registers. */ - if (!lwp->stopped) - linux_stop_lwp (lwp); - } + /* The actual update is done later just before resuming the lwp, + we just mark that the registers need updating. */ + if (watch) + lwp->arch_private->wpts_changed[i] = 1; + else + lwp->arch_private->bpts_changed[i] = 1; - return 0; + /* If the lwp isn't stopped, force it to momentarily pause, so + we can update its breakpoint registers. */ + if (!lwp->stopped) + linux_stop_lwp (lwp); } static int @@ -538,9 +525,14 @@ arm_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, for (i = 0; i < count; i++) if (!arm_hwbp_control_is_enabled (pts[i].control)) { - struct update_registers_data data = { watch, i }; pts[i] = p; - find_inferior (&all_threads, update_registers_callback, &data); + + /* Only update the threads of the current process. */ + for_each_thread (current_thread->id.pid (), [&] (thread_info *thread) + { + update_registers_callback (thread, watch, i); + }); + return 0; } @@ -578,9 +570,14 @@ arm_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, for (i = 0; i < count; i++) if (arm_linux_hw_breakpoint_equal (&p, pts + i)) { - struct update_registers_data data = { watch, i }; pts[i].control = arm_hwbp_control_disable (pts[i].control); - find_inferior (&all_threads, update_registers_callback, &data); + + /* Only update the threads of the current process. */ + for_each_thread (current_thread->id.pid (), [&] (thread_info *thread) + { + update_registers_callback (thread, watch, i); + }); + return 0; } |