s/get_regcache_aspace (regcache)/regcache->aspace ()/g

and remove get_regcache_aspace.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

	* darwin-nat.c (cancel_breakpoint): Use regcache->aspace ().
	* frame.c (create_sentinel_frame): Likewise.
	* infrun.c (displaced_step_prepare_throw): Likewise.
	(resume): Likewise.
	(thread_still_needs_step_over_bp): Likewise.
	(proceed): Likewise.
	(do_target_wait): Likewise.
	(adjust_pc_after_break): Likewise.
	(handle_syscall_event): Likewise.
	(save_waitstatus): Likewise.
	(handle_inferior_event_1): Likewise.
	(handle_signal_stop): Likewise.
	(keep_going_pass_signal): Likewise.
	* linux-nat.c (status_callback): Likewise.
	(save_stop_reason): Likewise.
	(resume_stopped_resumed_lwps): Likewise.
	* record-full.c (record_full_exec_insn): Likewise.
	(record_full_wait_1): Likewise.
	* regcache.c (get_regcache_aspace): Remove.
	* regcache.h (get_regcache_aspace): Remove.
This commit is contained in:
Yao Qi
2017-11-02 15:15:41 +00:00
parent d999647bc4
commit a01bda5221
8 changed files with 50 additions and 36 deletions

View File

@@ -1,3 +1,26 @@
2017-11-02 Yao Qi <yao.qi@linaro.org>
* darwin-nat.c (cancel_breakpoint): Use regcache->aspace ().
* frame.c (create_sentinel_frame): Likewise.
* infrun.c (displaced_step_prepare_throw): Likewise.
(resume): Likewise.
(thread_still_needs_step_over_bp): Likewise.
(proceed): Likewise.
(do_target_wait): Likewise.
(adjust_pc_after_break): Likewise.
(handle_syscall_event): Likewise.
(save_waitstatus): Likewise.
(handle_inferior_event_1): Likewise.
(handle_signal_stop): Likewise.
(keep_going_pass_signal): Likewise.
* linux-nat.c (status_callback): Likewise.
(save_stop_reason): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_wait_1): Likewise.
* regcache.c (get_regcache_aspace): Remove.
* regcache.h (get_regcache_aspace): Remove.
2017-11-02 Yao Qi <yao.qi@linaro.org> 2017-11-02 Yao Qi <yao.qi@linaro.org>
* regcache.c (struct regcache_descr) <nr_raw_registers>: Remove. * regcache.c (struct regcache_descr) <nr_raw_registers>: Remove.

View File

@@ -1194,7 +1194,7 @@ cancel_breakpoint (ptid_t ptid)
CORE_ADDR pc; CORE_ADDR pc;
pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch); pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc)) if (breakpoint_inserted_here_p (regcache->aspace (), pc))
{ {
inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n", inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n",
(unsigned long) ptid_get_tid (ptid)); (unsigned long) ptid_get_tid (ptid));

View File

@@ -1521,7 +1521,7 @@ create_sentinel_frame (struct program_space *pspace, struct regcache *regcache)
frame->level = -1; frame->level = -1;
frame->pspace = pspace; frame->pspace = pspace;
frame->aspace = get_regcache_aspace (regcache); frame->aspace = regcache->aspace ();
/* Explicitly initialize the sentinel frame's cache. Provide it /* Explicitly initialize the sentinel frame's cache. Provide it
with the underlying regcache. In the future additional with the underlying regcache. In the future additional
information, such as the frame's thread will be added. */ information, such as the frame's thread will be added. */

View File

@@ -1760,7 +1760,7 @@ displaced_step_prepare_throw (ptid_t ptid)
struct thread_info *tp = find_thread_ptid (ptid); struct thread_info *tp = find_thread_ptid (ptid);
struct regcache *regcache = get_thread_regcache (ptid); struct regcache *regcache = get_thread_regcache (ptid);
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
struct address_space *aspace = get_regcache_aspace (regcache); struct address_space *aspace = regcache->aspace ();
CORE_ADDR original, copy; CORE_ADDR original, copy;
ULONGEST len; ULONGEST len;
struct displaced_step_closure *closure; struct displaced_step_closure *closure;
@@ -2388,7 +2388,7 @@ resume (enum gdb_signal sig)
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
struct thread_info *tp = inferior_thread (); struct thread_info *tp = inferior_thread ();
CORE_ADDR pc = regcache_read_pc (regcache); CORE_ADDR pc = regcache_read_pc (regcache);
struct address_space *aspace = get_regcache_aspace (regcache); struct address_space *aspace = regcache->aspace ();
ptid_t resume_ptid; ptid_t resume_ptid;
/* This represents the user's step vs continue request. When /* This represents the user's step vs continue request. When
deciding whether "set scheduler-locking step" applies, it's the deciding whether "set scheduler-locking step" applies, it's the
@@ -2591,7 +2591,7 @@ resume (enum gdb_signal sig)
if (target_is_non_stop_p ()) if (target_is_non_stop_p ())
stop_all_threads (); stop_all_threads ();
set_step_over_info (get_regcache_aspace (regcache), set_step_over_info (regcache->aspace (),
regcache_read_pc (regcache), 0, tp->global_num); regcache_read_pc (regcache), 0, tp->global_num);
step = maybe_software_singlestep (gdbarch, pc); step = maybe_software_singlestep (gdbarch, pc);
@@ -2920,7 +2920,7 @@ thread_still_needs_step_over_bp (struct thread_info *tp)
{ {
struct regcache *regcache = get_thread_regcache (tp->ptid); struct regcache *regcache = get_thread_regcache (tp->ptid);
if (breakpoint_here_p (get_regcache_aspace (regcache), if (breakpoint_here_p (regcache->aspace (),
regcache_read_pc (regcache)) regcache_read_pc (regcache))
== ordinary_breakpoint_here) == ordinary_breakpoint_here)
return 1; return 1;
@@ -3007,7 +3007,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
regcache = get_current_regcache (); regcache = get_current_regcache ();
gdbarch = regcache->arch (); gdbarch = regcache->arch ();
aspace = get_regcache_aspace (regcache); aspace = regcache->aspace ();
pc = regcache_read_pc (regcache); pc = regcache_read_pc (regcache);
tp = inferior_thread (); tp = inferior_thread ();
@@ -3535,7 +3535,7 @@ do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
paddress (gdbarch, pc)); paddress (gdbarch, pc));
discard = 1; discard = 1;
} }
else if (!breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc)) else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
{ {
if (debug_infrun) if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@@ -4150,7 +4150,7 @@ adjust_pc_after_break (struct thread_info *thread,
if (decr_pc == 0) if (decr_pc == 0)
return; return;
aspace = get_regcache_aspace (regcache); aspace = regcache->aspace ();
/* Find the location where (if we've hit a breakpoint) the /* Find the location where (if we've hit a breakpoint) the
breakpoint would be. */ breakpoint would be. */
@@ -4266,7 +4266,7 @@ handle_syscall_event (struct execution_control_state *ecs)
syscall_number); syscall_number);
ecs->event_thread->control.stop_bpstat ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_regcache_aspace (regcache), = bpstat_stop_status (regcache->aspace (),
stop_pc, ecs->ptid, &ecs->ws); stop_pc, ecs->ptid, &ecs->ws);
if (handle_stop_requested (ecs)) if (handle_stop_requested (ecs))
@@ -4404,7 +4404,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
tp->suspend.waitstatus_pending_p = 1; tp->suspend.waitstatus_pending_p = 1;
regcache = get_thread_regcache (tp->ptid); regcache = get_thread_regcache (tp->ptid);
aspace = get_regcache_aspace (regcache); aspace = regcache->aspace ();
if (ws->kind == TARGET_WAITKIND_STOPPED if (ws->kind == TARGET_WAITKIND_STOPPED
&& ws->value.sig == GDB_SIGNAL_TRAP) && ws->value.sig == GDB_SIGNAL_TRAP)
@@ -4888,7 +4888,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
{ {
struct regcache *regcache = get_thread_regcache (ecs->ptid); struct regcache *regcache = get_thread_regcache (ecs->ptid);
if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), if (breakpoint_inserted_here_p (regcache->aspace (),
regcache_read_pc (regcache))) regcache_read_pc (regcache)))
{ {
if (debug_infrun) if (debug_infrun)
@@ -4958,7 +4958,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
handle_solib_event (); handle_solib_event ();
ecs->event_thread->control.stop_bpstat ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_regcache_aspace (regcache), = bpstat_stop_status (regcache->aspace (),
stop_pc, ecs->ptid, &ecs->ws); stop_pc, ecs->ptid, &ecs->ws);
if (handle_stop_requested (ecs)) if (handle_stop_requested (ecs))
@@ -5212,7 +5212,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
ecs->event_thread->control.stop_bpstat ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), = bpstat_stop_status (get_current_regcache ()->aspace (),
stop_pc, ecs->ptid, &ecs->ws); stop_pc, ecs->ptid, &ecs->ws);
if (handle_stop_requested (ecs)) if (handle_stop_requested (ecs))
@@ -5327,7 +5327,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
ecs->event_thread = inferior_thread (); ecs->event_thread = inferior_thread ();
ecs->event_thread->control.stop_bpstat ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), = bpstat_stop_status (get_current_regcache ()->aspace (),
stop_pc, ecs->ptid, &ecs->ws); stop_pc, ecs->ptid, &ecs->ws);
/* Note that this may be referenced from inside /* Note that this may be referenced from inside
@@ -5780,7 +5780,7 @@ handle_signal_stop (struct execution_control_state *ecs)
CORE_ADDR pc; CORE_ADDR pc;
regcache = get_thread_regcache (ecs->ptid); regcache = get_thread_regcache (ecs->ptid);
aspace = get_regcache_aspace (regcache); aspace = regcache->aspace ();
pc = regcache_read_pc (regcache); pc = regcache_read_pc (regcache);
/* However, before doing so, if this single-step breakpoint was /* However, before doing so, if this single-step breakpoint was
@@ -5872,7 +5872,7 @@ handle_signal_stop (struct execution_control_state *ecs)
if (ecs->event_thread->control.step_range_end != 1) if (ecs->event_thread->control.step_range_end != 1)
{ {
struct address_space *aspace = struct address_space *aspace =
get_regcache_aspace (get_thread_regcache (ecs->ptid)); get_thread_regcache (ecs->ptid)->aspace ();
/* skip_inline_frames is expensive, so we avoid it if we can /* skip_inline_frames is expensive, so we avoid it if we can
determine that the address is one where functions cannot have determine that the address is one where functions cannot have
@@ -5944,7 +5944,7 @@ handle_signal_stop (struct execution_control_state *ecs)
/* See if there is a breakpoint/watchpoint/catchpoint/etc. that /* See if there is a breakpoint/watchpoint/catchpoint/etc. that
handles this event. */ handles this event. */
ecs->event_thread->control.stop_bpstat ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), = bpstat_stop_status (get_current_regcache ()->aspace (),
stop_pc, ecs->ptid, &ecs->ws); stop_pc, ecs->ptid, &ecs->ws);
/* Following in case break condition called a /* Following in case break condition called a
@@ -7758,7 +7758,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
if (remove_bp if (remove_bp
&& (remove_wps || !use_displaced_stepping (ecs->event_thread))) && (remove_wps || !use_displaced_stepping (ecs->event_thread)))
{ {
set_step_over_info (get_regcache_aspace (regcache), set_step_over_info (regcache->aspace (),
regcache_read_pc (regcache), remove_wps, regcache_read_pc (regcache), remove_wps,
ecs->event_thread->global_num); ecs->event_thread->global_num);
} }

View File

@@ -2642,7 +2642,7 @@ status_callback (struct lwp_info *lp, void *data)
} }
#if !USE_SIGTRAP_SIGINFO #if !USE_SIGTRAP_SIGINFO
else if (!breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc)) else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
{ {
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@@ -2802,7 +2802,7 @@ save_stop_reason (struct lwp_info *lp)
} }
#else #else
if ((!lp->step || lp->stop_pc == sw_bp_pc) if ((!lp->step || lp->stop_pc == sw_bp_pc)
&& software_breakpoint_inserted_here_p (get_regcache_aspace (regcache), && software_breakpoint_inserted_here_p (regcache->aspace (),
sw_bp_pc)) sw_bp_pc))
{ {
/* The LWP was either continued, or stepped a software /* The LWP was either continued, or stepped a software
@@ -2810,7 +2810,7 @@ save_stop_reason (struct lwp_info *lp)
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT; lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
} }
if (hardware_breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc)) if (hardware_breakpoint_inserted_here_p (regcache->aspace (), pc))
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT; lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
if (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON) if (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON)
@@ -3574,7 +3574,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
immediately, and we're not waiting for this LWP. */ immediately, and we're not waiting for this LWP. */
if (!ptid_match (lp->ptid, *wait_ptid_p)) if (!ptid_match (lp->ptid, *wait_ptid_p))
{ {
if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc)) if (breakpoint_inserted_here_p (regcache->aspace (), pc))
leave_stopped = 1; leave_stopped = 1;
} }

View File

@@ -743,7 +743,7 @@ record_full_exec_insn (struct regcache *regcache,
not doing the change at all if the watchpoint not doing the change at all if the watchpoint
traps. */ traps. */
if (hardware_watchpoint_inserted_in_range if (hardware_watchpoint_inserted_in_range
(get_regcache_aspace (regcache), (regcache->aspace (),
entry->u.mem.addr, entry->u.mem.len)) entry->u.mem.addr, entry->u.mem.len))
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT; record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
} }
@@ -1109,7 +1109,7 @@ record_full_wait_1 (struct target_ops *ops,
registers_changed (); registers_changed ();
regcache = get_current_regcache (); regcache = get_current_regcache ();
tmp_pc = regcache_read_pc (regcache); tmp_pc = regcache_read_pc (regcache);
aspace = get_regcache_aspace (regcache); aspace = regcache->aspace ();
if (target_stopped_by_watchpoint ()) if (target_stopped_by_watchpoint ())
{ {
@@ -1172,7 +1172,7 @@ record_full_wait_1 (struct target_ops *ops,
{ {
struct regcache *regcache = get_current_regcache (); struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
struct address_space *aspace = get_regcache_aspace (regcache); struct address_space *aspace = regcache->aspace ();
int continue_flag = 1; int continue_flag = 1;
int first_record_full_end = 1; int first_record_full_end = 1;
struct cleanup *old_cleanups struct cleanup *old_cleanups

View File

@@ -264,12 +264,6 @@ private:
int m_regnum; int m_regnum;
}; };
struct address_space *
get_regcache_aspace (const struct regcache *regcache)
{
return regcache->aspace ();
}
/* Return a pointer to register REGNUM's buffer cache. */ /* Return a pointer to register REGNUM's buffer cache. */
gdb_byte * gdb_byte *

View File

@@ -39,10 +39,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t,
extern ptid_t regcache_get_ptid (const struct regcache *regcache); extern ptid_t regcache_get_ptid (const struct regcache *regcache);
/* Return REGCACHE's address space. */
extern struct address_space *get_regcache_aspace (const struct regcache *);
enum register_status regcache_register_status (const struct regcache *regcache, enum register_status regcache_register_status (const struct regcache *regcache,
int regnum); int regnum);
@@ -257,6 +253,7 @@ public:
/* Return regcache's architecture. */ /* Return regcache's architecture. */
gdbarch *arch () const; gdbarch *arch () const;
/* Return REGCACHE's address space. */
address_space *aspace () const address_space *aspace () const
{ {
return m_aspace; return m_aspace;