[PATCH 1/2] Refactor function set_step_over_info

Yao Qi
2016-04-15T13:29:53Z

This patch replace two parameters of set_step_over_info (aspace and
address) with one (thread).

gdb:

2016-04-15 Yao Qi <yao.qi@linaro.org>

* infrun.c (set_step_over_info): Remove parameter aspace and
address. Add thread. Set field aspace and address.
Callers updated.
(keep_going_pass_signal): Remove local variable regcache.
---
gdb/infrun.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 696105d..9017b0a 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1325,14 +1325,24 @@ struct step_over_info
static struct step_over_info step_over_info;

/* Record the address of the breakpoint/instruction we're currently
- stepping over. */
+ stepping over THREAD. */

static void
-set_step_over_info (struct address_space *aspace, CORE_ADDR address,
+set_step_over_info (struct thread_info *thread,
int nonsteppable_watchpoint_p)
{
- step_over_info.aspace = aspace;
- step_over_info.address = address;
+ if (thread != NULL)
+ {
+ struct regcache *regcache = get_thread_regcache (thread->ptid);
+
+ step_over_info.aspace = get_regcache_aspace (regcache);
+ step_over_info.address = regcache_read_pc (regcache);
+ }
+ else
+ {
+ step_over_info.aspace = NULL;
+ step_over_info.address = 0;
+ }
step_over_info.nonsteppable_watchpoint_p = nonsteppable_watchpoint_p;
}

@@ -2578,8 +2588,7 @@ resume (enum gdb_signal sig)
if (target_is_non_stop_p ())
stop_all_threads ();

- set_step_over_info (get_regcache_aspace (regcache),
- regcache_read_pc (regcache), 0);
+ set_step_over_info (tp, 0);

step = maybe_software_singlestep (gdbarch, pc);

@@ -7713,7 +7722,6 @@ keep_going_pass_signal (struct execution_control_state *ecs)
}
else
{
- struct regcache *regcache = get_current_regcache ();
int remove_bp;
int remove_wps;
step_over_what step_what;
@@ -7749,11 +7757,10 @@ keep_going_pass_signal (struct execution_control_state *ecs)
if (remove_bp
&& (remove_wps || !use_displaced_stepping (ecs->event_thread)))
{
- set_step_over_info (get_regcache_aspace (regcache),
- regcache_read_pc (regcache), remove_wps);
+ set_step_over_info (ecs->event_thread, remove_wps);
}
else if (remove_wps)
- set_step_over_info (NULL, 0, remove_wps);
+ set_step_over_info (NULL, remove_wps);

/* If we now need to do an in-line step-over, we need to stop
all other threads. Note this must be done before
--
1.9.1