[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/21] gdbstub: specialise stub_can_reverse
From: |
Alex Bennée |
Subject: |
[PATCH v2 16/21] gdbstub: specialise stub_can_reverse |
Date: |
Thu, 5 Jan 2023 16:43:15 +0000 |
Currently we only support replay for softmmu mode so it is a constant
false for user-mode.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
gdbstub/internals.h | 1 +
gdbstub/gdbstub.c | 13 ++-----------
gdbstub/softmmu.c | 5 +++++
gdbstub/user.c | 5 +++++
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index a371373c1d..1def9dfc9c 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -126,6 +126,7 @@ CPUState *gdb_first_attached_cpu(void);
void gdb_append_thread_id(CPUState *cpu, GString *buf);
int gdb_get_cpu_index(CPUState *cpu);
unsigned int gdb_get_max_cpus(void); /* both */
+bool gdb_stub_can_reverse(void); /* softmmu, stub for user */
void gdb_create_default_process(GDBState *s);
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index f9950200b8..c293b8e43c 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -113,15 +113,6 @@ int use_gdb_syscalls(void)
return gdb_syscall_mode == GDB_SYS_ENABLED;
}
-static bool stub_can_reverse(void)
-{
-#ifdef CONFIG_USER_ONLY
- return false;
-#else
- return replay_mode == REPLAY_MODE_PLAY;
-#endif
-}
-
/* writes 2*len+1 bytes in buf */
void gdb_memtohex(GString *buf, const uint8_t *mem, int len)
{
@@ -1307,7 +1298,7 @@ static void handle_step(GArray *params, void *user_ctx)
static void handle_backward(GArray *params, void *user_ctx)
{
- if (!stub_can_reverse()) {
+ if (!gdb_stub_can_reverse()) {
gdb_put_packet("E22");
}
if (params->len == 1) {
@@ -1558,7 +1549,7 @@ static void handle_query_supported(GArray *params, void
*user_ctx)
g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+");
}
- if (stub_can_reverse()) {
+ if (gdb_stub_can_reverse()) {
g_string_append(gdbserver_state.str_buf,
";ReverseStep+;ReverseContinue+");
}
diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c
index 015848358a..ff18611ce7 100644
--- a/gdbstub/softmmu.c
+++ b/gdbstub/softmmu.c
@@ -446,6 +446,11 @@ unsigned int gdb_get_max_cpus(void)
return ms->smp.max_cpus;
}
+bool gdb_stub_can_reverse(void)
+{
+ return replay_mode == REPLAY_MODE_PLAY;
+}
+
/*
* Softmmu specific command helpers
*/
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 9556a272d7..ccc73683de 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -407,6 +407,11 @@ unsigned int gdb_get_max_cpus(void)
return max_cpus;
}
+/* replay not supported for user-mode */
+bool gdb_stub_can_reverse(void)
+{
+ return false;
+}
/*
* Break/Watch point helpers
--
2.34.1
- [PATCH v2 12/21] gdbstub: abstract target specific details from gdb_put_packet_binary, (continued)
- [PATCH v2 12/21] gdbstub: abstract target specific details from gdb_put_packet_binary, Alex Bennée, 2023/01/05
- [PATCH v2 13/21] gdbstub: specialise handle_query_attached, Alex Bennée, 2023/01/05
- [PATCH v2 21/21] gdbstub: only compile gdbstub twice for whole build, Alex Bennée, 2023/01/05
- [PATCH v2 14/21] gdbstub: specialise target_memory_rw_debug, Alex Bennée, 2023/01/05
- [PATCH v2 11/21] gdbstub: move chunks of user code into own files, Alex Bennée, 2023/01/05
- [PATCH v2 10/21] gdbstub: move chunk of softmmu functionality to own file, Alex Bennée, 2023/01/05
- [PATCH v2 17/21] gdbstub: fix address type of gdb_set_cpu_pc, Alex Bennée, 2023/01/05
- [PATCH v2 16/21] gdbstub: specialise stub_can_reverse,
Alex Bennée <=
- [PATCH v2 18/21] gdbstub: don't use target_ulong while handling registers, Alex Bennée, 2023/01/05
- [PATCH v2 15/21] gdbstub: introduce gdb_get_max_cpus, Alex Bennée, 2023/01/05
- [PATCH v2 19/21] gdbstub: move register helpers into standalone include, Alex Bennée, 2023/01/05
- [PATCH v2 20/21] gdbstub: move syscall handling to new file, Alex Bennée, 2023/01/05