summaryrefslogtreecommitdiffstats
path: root/target/xtensa/gdbstub.c
diff options
context:
space:
mode:
authorMax Filippov2018-11-20 03:02:32 +0100
committerMax Filippov2018-11-20 21:20:41 +0100
commit4614f0f8bd2e40cbc27ab6b9a1fd6244259ade8d (patch)
tree1a01e36e8b5320e7f031593f8827a4520e223a05 /target/xtensa/gdbstub.c
parentUpdate version for v3.1.0-rc2 release (diff)
downloadqemu-4614f0f8bd2e40cbc27ab6b9a1fd6244259ade8d.tar.gz
qemu-4614f0f8bd2e40cbc27ab6b9a1fd6244259ade8d.tar.xz
qemu-4614f0f8bd2e40cbc27ab6b9a1fd6244259ade8d.zip
target/xtensa: gdbstub fix register counting
In order to communicate correctly with gdb xtensa gdbstub must provide expected number of registers in 'g' packet response. xtensa-elf-gdb expects both nonprivileged and privileged registers. xtensa-linux-gdb only expects nonprivileged registers. gdb only counts one contiguous stretch of registers, do the same for the core registers in the xtensa_count_regs. With this change qemu-system-xtensa is able to communicate with all xtensa-elf-gdb versions (versions prior to 8.2 require overlay fixup), and qemu-xtensa is able to communicate with all xtensa-linux-gdb versions, except 8.2. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa/gdbstub.c')
-rw-r--r--target/xtensa/gdbstub.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/target/xtensa/gdbstub.c b/target/xtensa/gdbstub.c
index c9450914c7..d43bb190c6 100644
--- a/target/xtensa/gdbstub.c
+++ b/target/xtensa/gdbstub.c
@@ -45,15 +45,20 @@ void xtensa_count_regs(const XtensaConfig *config,
unsigned *n_regs, unsigned *n_core_regs)
{
unsigned i;
+ bool count_core_regs = true;
for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
if (config->gdb_regmap.reg[i].type != xtRegisterTypeTieState &&
config->gdb_regmap.reg[i].type != xtRegisterTypeMapped &&
config->gdb_regmap.reg[i].type != xtRegisterTypeUnmapped) {
++*n_regs;
- if ((config->gdb_regmap.reg[i].flags &
- XTENSA_REGISTER_FLAGS_PRIVILEGED) == 0) {
- ++*n_core_regs;
+ if (count_core_regs) {
+ if ((config->gdb_regmap.reg[i].flags &
+ XTENSA_REGISTER_FLAGS_PRIVILEGED) == 0) {
+ ++*n_core_regs;
+ } else {
+ count_core_regs = false;
+ }
}
}
}