[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 13/24] gdbstub: specialise handle_query_attached
From: |
Alex Bennée |
Subject: |
[PATCH v3 13/24] gdbstub: specialise handle_query_attached |
Date: |
Tue, 21 Feb 2023 22:52:16 +0000 |
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>
---
v3
- remove allusions to possible linker optimisations
---
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 3912d0de38..3875c6877e 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -152,7 +152,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);
@@ -181,6 +181,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 76c24b7cb6..0d90685c72 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
@@ -1672,11 +1666,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");
@@ -1786,12 +1775,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 0232e62ea4..ade0cc366c 100644
--- a/gdbstub/softmmu.c
+++ b/gdbstub/softmmu.c
@@ -439,6 +439,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 33a0701cea..90dfe49f27 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -340,6 +340,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.39.1
- [PATCH v3 01/24] gdbstub/internals.h: clean up include guard, (continued)
- [PATCH v3 01/24] gdbstub/internals.h: clean up include guard, Alex Bennée, 2023/02/21
- [PATCH v3 02/24] gdbstub: fix-up copyright and license files, Alex Bennée, 2023/02/21
- [PATCH v3 03/24] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs, Alex Bennée, 2023/02/21
- [PATCH v3 05/24] gdbstub: move GDBState to shared internals header, Alex Bennée, 2023/02/21
- [PATCH v3 04/24] gdbstub: define separate user/system structures, Alex Bennée, 2023/02/21
- [PATCH v3 06/24] includes: move tb_flush into its own header, Alex Bennée, 2023/02/21
- [PATCH v3 11/24] gdbstub: rationalise signal mapping in softmmu, Alex Bennée, 2023/02/21
- [PATCH v3 07/24] gdbstub: move fromhex/tohex routines to internals, Alex Bennée, 2023/02/21
- [PATCH v3 08/24] gdbstub: make various helpers visible to the rest of the module, Alex Bennée, 2023/02/21
- [PATCH v3 09/24] gdbstub: move chunk of softmmu functionality to own file, Alex Bennée, 2023/02/21
- [PATCH v3 13/24] gdbstub: specialise handle_query_attached,
Alex Bennée <=
- [PATCH v3 10/24] gdbstub: move chunks of user code into own files, Alex Bennée, 2023/02/21
- [PATCH v3 23/24] include: split target_long definition from cpu-defs, Alex Bennée, 2023/02/21
- [PATCH v3 15/24] gdbstub: introduce gdb_get_max_cpus, Alex Bennée, 2023/02/21
- [PATCH v3 24/24] gdbstub: split out softmmu/user specifics for syscall handling, Alex Bennée, 2023/02/21
- [PATCH v3 20/24] gdbstub: move syscall handling to new file, Alex Bennée, 2023/02/21
- [PATCH v3 22/24] testing: probe gdb for supported architectures ahead of time, Alex Bennée, 2023/02/21
- [PATCH v3 17/24] gdbstub: fix address type of gdb_set_cpu_pc, Alex Bennée, 2023/02/21
- [PATCH v3 14/24] gdbstub: specialise target_memory_rw_debug, Alex Bennée, 2023/02/21
- [PATCH v3 16/24] gdbstub: specialise stub_can_reverse, Alex Bennée, 2023/02/21
- [PATCH v3 12/24] gdbstub: abstract target specific details from gdb_put_packet_binary, Alex Bennée, 2023/02/21