From patchwork Fri Oct 27 09:31:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 23907 Received: (qmail 52602 invoked by alias); 27 Oct 2017 09:32:00 -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 52564 invoked by uid 89); 27 Oct 2017 09:32:00 -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=H*r:sk:static. X-HELO: mail-wr0-f177.google.com Received: from mail-wr0-f177.google.com (HELO mail-wr0-f177.google.com) (209.85.128.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Oct 2017 09:31:57 +0000 Received: by mail-wr0-f177.google.com with SMTP id l1so5626233wrc.3 for ; Fri, 27 Oct 2017 02:31:56 -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=mJffDr7Bp8HXSTM3iC9MDSMnxnW/VO3wYHBDPoBy4DA=; b=Cgy9ba99qFnPHT/HqgP4MjYQjl1Wz4awVQkaiDAOFkKPLVDpbq8wHhjUCBwvIHE3RK IQ+93JuHQTMbxZJVI7eas+2s8NjWcWMabv4XJEF6Lpcoaed50ezutRoY1/cQCoWRq5tX ooBAPuDamg+q4G/0Pd0K4DTNOKnRhq/e3pSO/t9eURKK8Jtg0l86MyRbkq1iaQTbkzi4 BsFqn71vGXd0mnehLFXYHmQNGtk+2HpChWFBO1kvmtGj5IogtKq0IK7axMY9l/6vCiS3 O0LWL8XjPs2GrUUojDncTgtczB0eQfZiKyyygQhaBeUHOuiSt5atwv4jGayvIR6jrrMC +tjA== X-Gm-Message-State: AMCzsaVAduxCNN098XPK6tB5h4uWh9sQ+q/F0cCxL0hrGw/IWyJzOek+ msZblNs9dfyGpP8ciOdZRp8dSg== X-Google-Smtp-Source: ABhQp+QvoAl5H8TxxGU9z3Eel4F9pTWueu7i0HUHkgVlwJXUlgn9LUOn2J44tEDrSCNHC/CgTc1vig== X-Received: by 10.223.153.45 with SMTP id x42mr7734977wrb.212.1509096714872; Fri, 27 Oct 2017 02:31:54 -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.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Oct 2017 02:31:54 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 8/8] Construct readonly regcache without address space Date: Fri, 27 Oct 2017 10:31:42 +0100 Message-Id: <1509096702-12202-9-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 The address space is useless to readonly regcache, so this patch removes the parameter to construct readonly regcache. gdb: 2017-10-23 Yao Qi * frame.c (do_frame_register_read): Remove aspace. * jit.c (jit_frame_sniffer): Likwise. * ppc-linux-tdep.c (ppu2spu_sniffer): Likewise. * regcache.c (regcache::regcache): Pass nullptr. (regcache_print): Caller updated. * regcache.h (regcache::regcache): Remove one constructor parameter aspace. --- gdb/frame.c | 3 +-- gdb/jit.c | 4 +--- gdb/ppc-linux-tdep.c | 5 ++--- gdb/regcache.c | 4 ++-- gdb/regcache.h | 4 ++-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index bf308ba..0f5d846 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1020,9 +1020,8 @@ do_frame_register_read (void *src, int regnum, gdb_byte *buf) std::unique_ptr frame_save_as_regcache (struct frame_info *this_frame) { - struct address_space *aspace = get_frame_address_space (this_frame); std::unique_ptr regcache - (new struct regcache (get_frame_arch (this_frame), aspace)); + (new struct regcache (get_frame_arch (this_frame))); regcache_save (regcache.get (), do_frame_register_read, this_frame); return regcache; diff --git a/gdb/jit.c b/gdb/jit.c index a2d1f6d..7538684 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -1186,7 +1186,6 @@ jit_frame_sniffer (const struct frame_unwind *self, struct jit_unwind_private *priv_data; struct gdb_unwind_callbacks callbacks; struct gdb_reader_funcs *funcs; - struct address_space *aspace; struct gdbarch *gdbarch; callbacks.reg_get = jit_unwind_reg_get_impl; @@ -1200,12 +1199,11 @@ jit_frame_sniffer (const struct frame_unwind *self, gdb_assert (!*cache); - aspace = get_frame_address_space (this_frame); gdbarch = get_frame_arch (this_frame); *cache = XCNEW (struct jit_unwind_private); priv_data = (struct jit_unwind_private *) *cache; - priv_data->regcache = new regcache (gdbarch, aspace); + priv_data->regcache = new regcache (gdbarch); priv_data->this_frame = this_frame; callbacks.priv_data = priv_data; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 67d8305..847908a 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1361,10 +1361,9 @@ ppu2spu_sniffer (const struct frame_unwind *self, { struct ppu2spu_cache *cache = FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache); - - struct address_space *aspace = get_frame_address_space (this_frame); std::unique_ptr regcache - (new struct regcache (data.gdbarch, aspace)); + (new struct regcache (data.gdbarch)); + regcache_save (regcache.get (), ppu2spu_unwind_register, &data); cache->frame_id = frame_id_build (base, func); diff --git a/gdb/regcache.c b/gdb/regcache.c index 2cffb70..8ec099c 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -211,7 +211,7 @@ do_cooked_read (void *src, int regnum, gdb_byte *buf) } regcache::regcache (readonly_t, const regcache &src) - : regcache (src.arch (), src.aspace (), true) + : regcache (src.arch (), nullptr, true) { gdb_assert (!src.m_readonly_p); save (do_cooked_read, (void *) &src); @@ -1568,7 +1568,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) /* For the benefit of "maint print registers" & co when debugging an executable, allow dumping a regcache even when there is no thread selected / no registers. */ - regcache dummy_regs (target_gdbarch (), nullptr); + regcache dummy_regs (target_gdbarch ()); dummy_regs.dump (out, what_to_dump); } } diff --git a/gdb/regcache.h b/gdb/regcache.h index 98cb095..8c3cbc9 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -232,8 +232,8 @@ typedef struct cached_reg class regcache { public: - regcache (gdbarch *gdbarch, const address_space *aspace_) - : regcache (gdbarch, aspace_, true) + regcache (gdbarch *gdbarch) + : regcache (gdbarch, nullptr, true) {} struct readonly_t {};