[binutils-gdb] Clear *VAL in regcache_raw_read_unsigned
Yao Qi
qiyao@sourceware.org
Wed Feb 10 16:42:00 GMT 2016
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9f6a71b4bfdad8fa2fe33e86f799fa0d362973dc
commit 9f6a71b4bfdad8fa2fe33e86f799fa0d362973dc
Author: Yao Qi <yao.qi@linaro.org>
Date: Wed Feb 10 16:40:52 2016 +0000
Clear *VAL in regcache_raw_read_unsigned
We have function regcache_raw_read_unsigned defined in both GDB and
GDBserver, so that it is used in common like this,
ULONGEST value;
status = regcache_raw_read_unsigned (regcache, regnum, &value);
'value' is correctly set in GDB side, but may not be correctly set
in GDBserver, because &value is passed in regcache_raw_read_unsigned
but collect_register may only set part of the whole variable. In my
test, I see the top half of 'value' is garbage. This patch fixes this
problem by clearing *VAL before calling collect_register.
gdb/gdbserver:
2016-02-10 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache_raw_read_unsigned): Clear *VAL.
Diff:
---
gdb/gdbserver/ChangeLog | 4 ++++
gdb/gdbserver/regcache.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 30df0bc..2c11f89 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2016-02-10 Yao Qi <yao.qi@linaro.org>
+
+ * regcache.c (regcache_raw_read_unsigned): Clear *VAL.
+
2016-02-09 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 6a737ea..2af8e24 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -440,6 +440,7 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
"%d bytes."),
(int) sizeof (ULONGEST));
+ *val = 0;
collect_register (regcache, regnum, val);
return REG_VALID;
More information about the Gdb-cvs
mailing list