This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PATCH: gdbserver: Clear regcache if buf is NULL
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GDB <gdb-patches at sourceware dot org>
- Date: Wed, 3 Feb 2010 09:44:14 -0800
- Subject: PATCH: gdbserver: Clear regcache if buf is NULL
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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