From patchwork Fri Oct 27 09:31:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 23906 Received: (qmail 52392 invoked by alias); 27 Oct 2017 09:31:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 52223 invoked by uid 89); 27 Oct 2017 09:31:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=lp, 2576 X-HELO: mail-wm0-f68.google.com Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Oct 2017 09:31:54 +0000 Received: by mail-wm0-f68.google.com with SMTP id t139so2480783wmt.1 for ; Fri, 27 Oct 2017 02:31:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=MgihAFqwrpwT4Kq2J49zdBgbut76U2ixeapXgvPuETU=; b=eo0wfVXR7ghYGHQ1MmtFflomgIVi9qBhzlPBAlKyggXpXxHog6aH50vVuDwE7H5kEW jkiUUTdWWoAkQrW7LHNn8rfGfPGfLSDr0zcuFfgABKQ2unOe9Y1TtT8VQx+qKh6etfuk hUXASpMs5s/OYYea3cDTp27v+MtQG4W3cheyL91VIGn8XpAPOx2hjL02keF8F0lq/u1Z JnW87viLwLlNW8lbpow5zBfTCgYM6HDoAHnuB3UTqT8a11H5UA5rCVSnU+mPvWGyF64p 2vpYMZDGt9jzHIPKWOTqDrkH/c16q1opJL9itFvaDSmnezLSAVkcx2loAt1Qtf9z+Fov 1Hxw== X-Gm-Message-State: AMCzsaU/ebzfb+/w9lnoh0X8bkw1266Vktyba/DqYyjYedk1f/jgEXHq 5x/Tlqqxh0laYijEB+F57A/61g== X-Google-Smtp-Source: ABhQp+StDpWthC5lwqGUxhWeystTH2mYrSUXkGudDKtaU+RS8ff3RVahhMoy9LC8ufCMOfl9hcHZnA== X-Received: by 10.28.131.2 with SMTP id f2mr46700wmd.137.1509096711966; Fri, 27 Oct 2017 02:31:51 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id r29sm10349378wra.71.2017.10.27.02.31.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Oct 2017 02:31:51 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 5/8] s/get_regcache_aspace (regcache)/regcache->aspace ()/g Date: Fri, 27 Oct 2017 10:31:39 +0100 Message-Id: <1509096702-12202-6-git-send-email-yao.qi@linaro.org> In-Reply-To: <1509096702-12202-1-git-send-email-yao.qi@linaro.org> References: <1509096702-12202-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes and remove get_regcache_aspace. gdb: 2017-10-22 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/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 +---- 7 files changed, 27 insertions(+), 36 deletions(-) diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index dc47c73..ab15913 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1195,7 +1195,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 8d48169..5380c7d 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 858ffa1..0e31dbc 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 5d8f9f3..a6395f4 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 8c5e36b..0488b71 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 fa1ed48..6985dc9 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 6fb790d..2360e27 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;