diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2020-04-14 21:06:26 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2020-04-15 11:38:23 +0100 |
commit | 7b8c1527ae0a9ec96a9100a05c680b55eb3aa54f (patch) | |
tree | 9db5c80184c6b62d8492638b8221ca2acd3ccb88 /target/xtensa | |
parent | bbc40fefcee0d69d61ceaf8c0695d2ce43cdc87b (diff) |
gdbstub: Do not use memset() on GByteArray
Introduce gdb_get_zeroes() to fill a GByteArray with zeroes.
Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200414102427.7459-1-philmd@redhat.com>
[AJB: used slightly more gliby set_size approach]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200414200631.12799-13-alex.bennee@linaro.org>
Diffstat (limited to 'target/xtensa')
-rw-r--r-- | target/xtensa/gdbstub.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/target/xtensa/gdbstub.c b/target/xtensa/gdbstub.c index 0ee3feabe5..4d43f1340a 100644 --- a/target/xtensa/gdbstub.c +++ b/target/xtensa/gdbstub.c @@ -105,8 +105,7 @@ int xtensa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) default: qemu_log_mask(LOG_UNIMP, "%s from reg %d of unsupported size %d\n", __func__, n, reg->size); - memset(mem_buf, 0, reg->size); - return reg->size; + return gdb_get_zeroes(mem_buf, reg->size); } case xtRegisterTypeWindow: /*a*/ @@ -115,8 +114,7 @@ int xtensa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) default: qemu_log_mask(LOG_UNIMP, "%s from reg %d of unsupported type %d\n", __func__, n, reg->type); - memset(mem_buf, 0, reg->size); - return reg->size; + return gdb_get_zeroes(mem_buf, reg->size); } } |