This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: gdbserver: Clear regcache if buf is NULL


If xstate_bv bits are zero, XSAVE extended state is in init state and
gdbserver should treat XMM/YMM registers as 0. This patch clears regcache
if buf is NULL. OK to install?

Thanks.


H.J.
---
2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>

	* regcache.c (supply_register): Clear regcache if buf is NULL.

diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 2082604..d6cdc46 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -215,7 +215,10 @@ register_data (struct regcache *regcache, int n, int fetch)
 void
 supply_register (struct regcache *regcache, int n, const void *buf)
 {
-  memcpy (register_data (regcache, n, 0), buf, register_size (n));
+  if (buf)
+    memcpy (register_data (regcache, n, 0), buf, register_size (n));
+  else
+    memset (register_data (regcache, n, 0), 0, register_size (n));
 }
 
 void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]