public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 6/7]: Regcache: jit should use a writable regcache
@ 2017-08-17  8:50 Alan Hayward
  0 siblings, 0 replies; only message in thread
From: Alan Hayward @ 2017-08-17  8:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd

regcache_set_cached_value () is a bit of a hack, allowing the writing
to a readonly regcache.

With the previous platches in the series in place, you should instead
create a writable regcache, and update using raw_supply.


Tested on a --enable-targets=all build with board files unix,
native-gdbserver and unittest.exp.


2017-08-16  Alan Hayward  <alan.hayward@arm.com>

	* jit.c (jit_unwind_reg_set_impl): Use supply method.
	(jit_frame_sniffer): Create writable regcache.


diff --git a/gdb/jit.c b/gdb/jit.c
index e96572a8d1d7fe16561be7ba8a61b56d6bb1e85d..ed5bf160a4caa3a671aacd31b58c105a00f93ecc 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1125,7 +1125,7 @@ jit_unwind_reg_set_impl (struct gdb_unwind_callbacks *cb, int dwarf_regnum,
      return;
    }

-  regcache_raw_set_cached_value (priv->regcache, gdb_reg, value->value);
+  priv->regcache->raw_supply (gdb_reg, value->value);
  value->free (value);
}

@@ -1206,7 +1206,7 @@ jit_frame_sniffer (const struct frame_unwind *self,

  *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, aspace, false);
  priv_data->this_frame = this_frame;

  callbacks.priv_data = priv_data;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-17  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17  8:50 [PATCH 6/7]: Regcache: jit should use a writable regcache Alan Hayward

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).