[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] Revert "target/hppa: Drop attempted gdbstub support for hppa
From: |
Sven Schnelle |
Subject: |
[PATCH 1/3] Revert "target/hppa: Drop attempted gdbstub support for hppa64" |
Date: |
Wed, 28 Feb 2024 21:14:31 +0100 |
Despite commit e207b4aa718e ("target/hppa: Drop attempted gdbstub
support for hppa64") saying that hppa-linux-gdb doesn't support 64 bit
mode via remote protocol, it is actually working with a small add-on
patch which enables gdb to guess the size from the g protocol:
$ hppa64-linux-gnu-gdb ~/seabios-hppa/out-64/hppa-firmware64.img
[..]
Reading symbols from /home/svens/seabios-hppa/out-64/hppa-firmware64.img...
(gdb) target remote :1234
Remote debugging using :1234
warning: remote target does not support file transfer, attempting to access
files from local filesystem.
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
startup () at src/parisc/head.S:144
144 rsm PSW_I, %r0 /* disable local irqs */
(gdb)
Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
target/hppa/gdbstub.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
index 4a965b38d7..48a514384f 100644
--- a/target/hppa/gdbstub.c
+++ b/target/hppa/gdbstub.c
@@ -21,16 +21,11 @@
#include "cpu.h"
#include "gdbstub/helpers.h"
-/*
- * GDB 15 only supports PA1.0 via the remote protocol, and ignores
- * any provided xml. Which means that any attempt to provide more
- * data results in "Remote 'g' packet reply is too long".
- */
-
int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
{
- CPUHPPAState *env = cpu_env(cs);
- uint32_t val;
+ HPPACPU *cpu = HPPA_CPU(cs);
+ CPUHPPAState *env = &cpu->env;
+ target_ureg val;
switch (n) {
case 0:
@@ -144,13 +139,24 @@ int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray
*mem_buf, int n)
break;
}
- return gdb_get_reg32(mem_buf, val);
+ if (TARGET_REGISTER_BITS == 64) {
+ return gdb_get_reg64(mem_buf, val);
+ } else {
+ return gdb_get_reg32(mem_buf, val);
+ }
}
int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
- CPUHPPAState *env = cpu_env(cs);
- uint32_t val = ldl_p(mem_buf);
+ HPPACPU *cpu = HPPA_CPU(cs);
+ CPUHPPAState *env = &cpu->env;
+ target_ureg val;
+
+ if (TARGET_REGISTER_BITS == 64) {
+ val = ldq_p(mem_buf);
+ } else {
+ val = ldl_p(mem_buf);
+ }
switch (n) {
case 0:
@@ -160,7 +166,7 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t
*mem_buf, int n)
env->gr[n] = val;
break;
case 32:
- env->cr[CR_SAR] = val & (hppa_is_pa20(env) ? 63 : 31);
+ env->cr[CR_SAR] = val;
break;
case 33:
env->iaoq_f = val;
@@ -272,5 +278,5 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t
*mem_buf, int n)
}
break;
}
- return 4;
+ return sizeof(target_ureg);
}
--
2.43.2