public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c
@ 2017-06-12  9:34 Alan Hayward
  2017-06-12 11:05 ` Yao Qi
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Hayward @ 2017-06-12  9:34 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd

In record_full_exec_insn use cooked_read_value instead of creating
a temp buffer.

Code to remove MAX_REGISTER_SIZE from uses of record_full_core_regbuf
will be in a different patch (I'm debugging some issues with it).

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


Ok to commit?

Alan.



2017-06-12  Alan Hayward  <alan.hayward@arm.com>

	* gdb/record-full.c (record_full_exec_insn): Use
	regcache->cooked_read_value.



diff --git a/gdb/record-full.c b/gdb/record-full.c
index 31ff558d2a633cff71d3e6082e42f5d6fb88bcf1..2f09e2fc316d7d3073de035f961f7c3bf9d3002c 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -698,7 +698,7 @@ record_full_exec_insn (struct regcache *regcache,
     {
     case record_full_reg: /* reg */
       {
-        gdb_byte reg[MAX_REGISTER_SIZE];
+	struct value *value;

         if (record_debug > 1)
           fprintf_unfiltered (gdb_stdlog,
@@ -707,10 +707,13 @@ record_full_exec_insn (struct regcache *regcache,
                               host_address_to_string (entry),
                               entry->u.reg.num);

-        regcache_cooked_read (regcache, entry->u.reg.num, reg);
-        regcache_cooked_write (regcache, entry->u.reg.num,
-			       record_full_get_loc (entry));
-        memcpy (record_full_get_loc (entry), reg, entry->u.reg.len);
+	value = regcache->cooked_read_value (entry->u.reg.num);
+	gdb_assert (value != NULL);
+	regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry));
+	memcpy (record_full_get_loc (entry), value_contents_all (value),
+		entry->u.reg.len);
+	release_value (value);
+	value_free (value);
       }
       break;


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-22 13:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-12  9:34 [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c Alan Hayward
2017-06-12 11:05 ` Yao Qi
2017-06-12 13:59   ` Alan Hayward
2017-06-21  9:31     ` Alan Hayward
2017-06-21 10:33     ` Yao Qi
2017-06-21 10:52     ` Pedro Alves
2017-06-22 13:44       ` Alan Hayward
2017-06-22 13:45         ` Pedro Alves

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).