Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 8/8] Construct readonly regcache without address space
Date: Fri, 27 Oct 2017 09:32:00 -0000	[thread overview]
Message-ID: <1509096702-12202-9-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1509096702-12202-1-git-send-email-yao.qi@linaro.org>

The address space is useless to readonly regcache, so this patch removes
the parameter to construct readonly regcache.

gdb:

2017-10-23  Yao Qi  <yao.qi@linaro.org>

	* 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<struct regcache>
 frame_save_as_regcache (struct frame_info *this_frame)
 {
-  struct address_space *aspace = get_frame_address_space (this_frame);
   std::unique_ptr<struct regcache> 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<struct regcache> 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 {};
-- 
1.9.1


  parent reply	other threads:[~2017-10-27  9:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  9:31 [PATCH 0/8] regcache misc cleanup and refactor Yao Qi
2017-10-27  9:31 ` [PATCH 1/8] Remove regcache_descr fields sizeof_raw_register_status and sizeof_cooked_register_status Yao Qi
2017-10-27  9:31 ` [PATCH 4/8] Remove regcache_descr::nr_raw_registers Yao Qi
2017-10-31 14:27   ` Simon Marchi
2017-11-02 15:20     ` Yao Qi
2017-10-27  9:31 ` [PATCH 3/8] New method regcache::assert_regnum Yao Qi
2017-10-27  9:32 ` [PATCH 2/8] Remove code wrapped by "#if 0" Yao Qi
2017-10-27  9:32 ` [PATCH 5/8] s/get_regcache_aspace (regcache)/regcache->aspace ()/g Yao Qi
2017-10-27  9:32 ` Yao Qi [this message]
2017-10-31 14:35   ` [PATCH 8/8] Construct readonly regcache without address space Simon Marchi
     [not found]     ` <CAH=s-PMFXtwS-3J9et_onyEOCUL9P-AgO9V=pBt60neQn67g9g@mail.gmail.com>
2017-10-31 18:04       ` Simon Marchi
2017-10-27  9:32 ` [PATCH 7/8] const-fy regcache::m_readonly_p Yao Qi
2017-10-27  9:32 ` [PATCH 6/8] const-fy regcache::m_aspace Yao Qi
2017-10-31 14:19   ` Simon Marchi
2017-11-01  9:43     ` Yao Qi
2017-11-01 14:00       ` Simon Marchi
2017-11-01 14:35         ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509096702-12202-9-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox