diff options
author | Song Gao | 2022-08-05 05:35:19 +0200 |
---|---|---|
committer | Richard Henderson | 2022-08-05 19:02:40 +0200 |
commit | 1fe8ac3511fc771376019c6bfe77f317c5e56cd6 (patch) | |
tree | 11b25f90bc015ee0ad35137c8ff3a3aea7c115d0 /target/loongarch/gdbstub.c | |
parent | hw/loongarch: remove acpi-build.c unused variable 'aml_len' (diff) | |
download | qemu-1fe8ac3511fc771376019c6bfe77f317c5e56cd6.tar.gz qemu-1fe8ac3511fc771376019c6bfe77f317c5e56cd6.tar.xz qemu-1fe8ac3511fc771376019c6bfe77f317c5e56cd6.zip |
target/loongarch: Fix GDB get the wrong pc
GDB LoongArch add a register orig_a0, see the base64.xml [1].
We should add the orig_a0 to match the upstream GDB.
[1]: https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongarch/base64.xml
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220805033523.1416837-2-gaosong@loongson.cn>
Diffstat (limited to 'target/loongarch/gdbstub.c')
-rw-r--r-- | target/loongarch/gdbstub.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 24e126fb2d..5feb43445f 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -19,8 +19,11 @@ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) if (0 <= n && n < 32) { return gdb_get_regl(mem_buf, env->gpr[n]); } else if (n == 32) { - return gdb_get_regl(mem_buf, env->pc); + /* orig_a0 */ + return gdb_get_regl(mem_buf, 0); } else if (n == 33) { + return gdb_get_regl(mem_buf, env->pc); + } else if (n == 34) { return gdb_get_regl(mem_buf, env->CSR_BADV); } return 0; @@ -36,7 +39,7 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) if (0 <= n && n < 32) { env->gpr[n] = tmp; length = sizeof(target_ulong); - } else if (n == 32) { + } else if (n == 33) { env->pc = tmp; length = sizeof(target_ulong); } |