[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4.5 14/29] gdbstub: specialise handle_query_attached
From: |
Richard Henderson |
Subject: |
[PATCH v4.5 14/29] gdbstub: specialise handle_query_attached |
Date: |
Thu, 2 Mar 2023 18:57:50 -0800 |
From: Alex Bennée <alex.bennee@linaro.org>
In both user and softmmu cases we are just replying with a constant.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230302190846.2593720-15-alex.bennee@linaro.org>
---
gdbstub/internals.h | 4 +++-
gdbstub/gdbstub.c | 15 ++-------------
gdbstub/softmmu.c | 5 +++++
gdbstub/user.c | 5 +++++
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index 6534e373cb..20caacd744 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -154,7 +154,7 @@ int gdb_continue_partial(char *newstates);
void gdb_put_buffer(const uint8_t *buf, int len);
/*
- * Command handlers - either softmmu or user only
+ * Command handlers - either specialised or softmmu or user only
*/
void gdb_init_gdbserver_state(void);
@@ -183,6 +183,8 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx);
/* softmmu */
void gdb_handle_query_offsets(GArray *params, void *user_ctx); /* user */
void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx); /*user */
+void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */
+
/*
* Break/Watch point support - there is an implementation for softmmu
* and user mode.
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 0476ee7039..52d1769f57 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -46,12 +46,6 @@
#include "internals.h"
-#ifdef CONFIG_USER_ONLY
-#define GDB_ATTACHED "0"
-#else
-#define GDB_ATTACHED "1"
-#endif
-
#ifndef CONFIG_USER_ONLY
static int phy_memory_mode;
#endif
@@ -1673,11 +1667,6 @@ static void handle_query_xfer_features(GArray *params,
void *user_ctx)
gdbserver_state.str_buf->len, true);
}
-static void handle_query_attached(GArray *params, void *user_ctx)
-{
- gdb_put_packet(GDB_ATTACHED);
-}
-
static void handle_query_qemu_supported(GArray *params, void *user_ctx)
{
g_string_printf(gdbserver_state.str_buf, "sstepbits;sstep");
@@ -1787,12 +1776,12 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = {
},
#endif
{
- .handler = handle_query_attached,
+ .handler = gdb_handle_query_attached,
.cmd = "Attached:",
.cmd_startswith = 1
},
{
- .handler = handle_query_attached,
+ .handler = gdb_handle_query_attached,
.cmd = "Attached",
},
{
diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c
index 04e75449a2..7c180b779a 100644
--- a/gdbstub/softmmu.c
+++ b/gdbstub/softmmu.c
@@ -446,6 +446,11 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx)
* Execution state helpers
*/
+void gdb_handle_query_attached(GArray *params, void *user_ctx)
+{
+ gdb_put_packet("1");
+}
+
void gdb_continue(void)
{
if (!runstate_needs_reset()) {
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 0c8cd028b1..c0fd83b373 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -345,6 +345,11 @@ void gdbserver_fork(CPUState *cpu)
* Execution state helpers
*/
+void gdb_handle_query_attached(GArray *params, void *user_ctx)
+{
+ gdb_put_packet("0");
+}
+
void gdb_continue(void)
{
gdbserver_user_state.running_state = 1;
--
2.34.1
- [PATCH v4.5 06/29] gdbstub: move GDBState to shared internals header, (continued)
- [PATCH v4.5 06/29] gdbstub: move GDBState to shared internals header, Richard Henderson, 2023/03/02
- [PATCH v4.5 08/29] gdbstub: move fromhex/tohex routines to internals, Richard Henderson, 2023/03/02
- [PATCH v4.5 09/29] gdbstub: make various helpers visible to the rest of the module, Richard Henderson, 2023/03/02
- [PATCH v4.5 10/29] gdbstub: move chunk of softmmu functionality to own file, Richard Henderson, 2023/03/02
- [PATCH v4.5 12/29] gdbstub: rationalise signal mapping in softmmu, Richard Henderson, 2023/03/02
- [PATCH v4.5 11/29] gdbstub: move chunks of user code into own files, Richard Henderson, 2023/03/02
- [PATCH v4.5 03/29] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs, Richard Henderson, 2023/03/02
- [PATCH v4.5 04/29] gdbstub: clean-up indent on gdb_exit, Richard Henderson, 2023/03/02
- [PATCH v4.5 16/29] gdbstub: introduce gdb_get_max_cpus, Richard Henderson, 2023/03/02
- [PATCH v4.5 13/29] gdbstub: abstract target specific details from gdb_put_packet_binary, Richard Henderson, 2023/03/02
- [PATCH v4.5 14/29] gdbstub: specialise handle_query_attached,
Richard Henderson <=
- [PATCH v4.5 15/29] gdbstub: specialise target_memory_rw_debug, Richard Henderson, 2023/03/02
- [PATCH v4.5 07/29] includes: move tb_flush into its own header, Richard Henderson, 2023/03/02
- [PATCH v4.5 17/29] gdbstub: specialise stub_can_reverse, Richard Henderson, 2023/03/02
- [PATCH v4.5 19/29] gdbstub: don't use target_ulong while handling registers, Richard Henderson, 2023/03/02
- [PATCH v4.5 18/29] gdbstub: fix address type of gdb_set_cpu_pc, Richard Henderson, 2023/03/02
- [PATCH v4.5 20/29] gdbstub: move register helpers into standalone include, Richard Henderson, 2023/03/02
- [PATCH v4.5 22/29] gdbstub: only compile gdbstub twice for whole build, Richard Henderson, 2023/03/02
- [PATCH v4.5 21/29] gdbstub: move syscall handling to new file, Richard Henderson, 2023/03/02
- [PATCH v4.5 25/29] gdbstub: split out softmmu/user specifics for syscall handling, Richard Henderson, 2023/03/02
- [PATCH v4.5 27/29] gdbstub: Adjust gdb_do_syscall to only use uint32_t and uint64_t, Richard Henderson, 2023/03/02