From a01bda5221f75031ea2b6d05860e46c7b9b58b55 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 2 Nov 2017 15:15:41 +0000 Subject: [PATCH] s/get_regcache_aspace (regcache)/regcache->aspace ()/g and remove get_regcache_aspace. gdb: 2017-11-02 Yao Qi * 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. --- gdb/ChangeLog | 23 +++++++++++++++++++++++ gdb/darwin-nat.c | 2 +- gdb/frame.c | 2 +- gdb/infrun.c | 34 +++++++++++++++++----------------- gdb/linux-nat.c | 8 ++++---- gdb/record-full.c | 6 +++--- gdb/regcache.c | 6 ------ gdb/regcache.h | 5 +---- 8 files changed, 50 insertions(+), 36 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bee135719c..9d846abdad 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2017-11-02 Yao Qi + + * 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 * regcache.c (struct regcache_descr) : Remove. diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 635284ddbd..e57bcf9e81 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1194,7 +1194,7 @@ cancel_breakpoint (ptid_t ptid) CORE_ADDR pc; 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", (unsigned long) ptid_get_tid (ptid)); diff --git a/gdb/frame.c b/gdb/frame.c index 8d481694cd..5380c7d770 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1521,7 +1521,7 @@ create_sentinel_frame (struct program_space *pspace, struct regcache *regcache) frame->level = -1; frame->pspace = pspace; - frame->aspace = get_regcache_aspace (regcache); + frame->aspace = regcache->aspace (); /* Explicitly initialize the sentinel frame's cache. Provide it with the underlying regcache. In the future additional information, such as the frame's thread will be added. */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 858ffa1175..0e31dbcdb5 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1760,7 +1760,7 @@ displaced_step_prepare_throw (ptid_t ptid) struct thread_info *tp = find_thread_ptid (ptid); struct regcache *regcache = get_thread_regcache (ptid); struct gdbarch *gdbarch = regcache->arch (); - struct address_space *aspace = get_regcache_aspace (regcache); + struct address_space *aspace = regcache->aspace (); CORE_ADDR original, copy; ULONGEST len; struct displaced_step_closure *closure; @@ -2388,7 +2388,7 @@ resume (enum gdb_signal sig) struct gdbarch *gdbarch = regcache->arch (); struct thread_info *tp = inferior_thread (); 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; /* This represents the user's step vs continue request. When 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 ()) 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); 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); - if (breakpoint_here_p (get_regcache_aspace (regcache), + if (breakpoint_here_p (regcache->aspace (), regcache_read_pc (regcache)) == ordinary_breakpoint_here) return 1; @@ -3007,7 +3007,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal) regcache = get_current_regcache (); gdbarch = regcache->arch (); - aspace = get_regcache_aspace (regcache); + aspace = regcache->aspace (); pc = regcache_read_pc (regcache); tp = inferior_thread (); @@ -3535,7 +3535,7 @@ do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options) paddress (gdbarch, pc)); 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) fprintf_unfiltered (gdb_stdlog, @@ -4150,7 +4150,7 @@ adjust_pc_after_break (struct thread_info *thread, if (decr_pc == 0) return; - aspace = get_regcache_aspace (regcache); + aspace = regcache->aspace (); /* Find the location where (if we've hit a breakpoint) the breakpoint would be. */ @@ -4266,7 +4266,7 @@ handle_syscall_event (struct execution_control_state *ecs) syscall_number); ecs->event_thread->control.stop_bpstat - = bpstat_stop_status (get_regcache_aspace (regcache), + = bpstat_stop_status (regcache->aspace (), stop_pc, ecs->ptid, &ecs->ws); 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; regcache = get_thread_regcache (tp->ptid); - aspace = get_regcache_aspace (regcache); + aspace = regcache->aspace (); if (ws->kind == TARGET_WAITKIND_STOPPED && 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); - if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), + if (breakpoint_inserted_here_p (regcache->aspace (), regcache_read_pc (regcache))) { if (debug_infrun) @@ -4958,7 +4958,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs) handle_solib_event (); ecs->event_thread->control.stop_bpstat - = bpstat_stop_status (get_regcache_aspace (regcache), + = bpstat_stop_status (regcache->aspace (), stop_pc, ecs->ptid, &ecs->ws); 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)); 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); 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->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); /* Note that this may be referenced from inside @@ -5780,7 +5780,7 @@ handle_signal_stop (struct execution_control_state *ecs) CORE_ADDR pc; regcache = get_thread_regcache (ecs->ptid); - aspace = get_regcache_aspace (regcache); + aspace = regcache->aspace (); pc = regcache_read_pc (regcache); /* 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) { 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 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 handles this event. */ 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); /* Following in case break condition called a @@ -7758,7 +7758,7 @@ 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), + set_step_over_info (regcache->aspace (), regcache_read_pc (regcache), remove_wps, ecs->event_thread->global_num); } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 5d8f9f3a56..a6395f4b5e 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2642,7 +2642,7 @@ status_callback (struct lwp_info *lp, void *data) } #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) fprintf_unfiltered (gdb_stdlog, @@ -2802,7 +2802,7 @@ save_stop_reason (struct lwp_info *lp) } #else 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)) { /* 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; } - 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; 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. */ 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; } diff --git a/gdb/record-full.c b/gdb/record-full.c index 8c5e36b589..0488b7148a 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -743,7 +743,7 @@ record_full_exec_insn (struct regcache *regcache, not doing the change at all if the watchpoint traps. */ if (hardware_watchpoint_inserted_in_range - (get_regcache_aspace (regcache), + (regcache->aspace (), entry->u.mem.addr, entry->u.mem.len)) record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT; } @@ -1109,7 +1109,7 @@ record_full_wait_1 (struct target_ops *ops, registers_changed (); regcache = get_current_regcache (); tmp_pc = regcache_read_pc (regcache); - aspace = get_regcache_aspace (regcache); + aspace = regcache->aspace (); if (target_stopped_by_watchpoint ()) { @@ -1172,7 +1172,7 @@ record_full_wait_1 (struct target_ops *ops, { struct regcache *regcache = get_current_regcache (); struct gdbarch *gdbarch = regcache->arch (); - struct address_space *aspace = get_regcache_aspace (regcache); + struct address_space *aspace = regcache->aspace (); int continue_flag = 1; int first_record_full_end = 1; struct cleanup *old_cleanups diff --git a/gdb/regcache.c b/gdb/regcache.c index 508f37bd7c..0bae395536 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -264,12 +264,6 @@ private: 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. */ gdb_byte * diff --git a/gdb/regcache.h b/gdb/regcache.h index 696b776966..861a6d25af 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -39,10 +39,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t, 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, int regnum); @@ -257,6 +253,7 @@ public: /* Return regcache's architecture. */ gdbarch *arch () const; + /* Return REGCACHE's address space. */ address_space *aspace () const { return m_aspace; -- 2.34.1