From 3327ccf79527582eefb7369281ccc1ecb7b268db Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 3 Feb 2010 18:20:21 +0000 Subject: [PATCH] 2010-02-03 H.J. Lu * regcache.c (supply_register): Clear regcache if buf is NULL. --- gdb/gdbserver/ChangeLog | 6 +++++- gdb/gdbserver/regcache.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 08277daf346..ac6af76a736 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,9 @@ +2010-02-03 H.J. Lu + + * regcache.c (supply_register): Clear regcache if buf is NULL. + 2010-02-02 Nicolas Roche - Joel Brobecker + Joel Brobecker * inferiors.c (find_inferior): Add function documentation. (unloaded_dll): Handle the case where the unloaded dll has not diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index 20826043ee9..d6cdc46d42a 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 -- 2.30.2