[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/29] gdbstub: Introduce gdb_handle_set_thread_user()
From: |
Alex Bennée |
Subject: |
[PATCH 10/29] gdbstub: Introduce gdb_handle_set_thread_user() |
Date: |
Tue, 5 Mar 2024 12:09:46 +0000 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
The upcoming follow-fork-mode child support needs to perform certain
actions when GDB switches between the stopped parent and the stopped
child. Introduce a user-specific hook for this.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240219141628.246823-10-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
gdbstub/internals.h | 1 +
gdbstub/gdbstub.c | 11 +++++++++--
gdbstub/user.c | 5 +++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index e6063835b1f..b4905c7181a 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -197,6 +197,7 @@ void gdb_handle_v_file_readlink(GArray *params, void
*user_ctx); /* user */
void gdb_handle_query_xfer_exec_file(GArray *params, void *user_ctx); /* user
*/
void gdb_handle_set_catch_syscalls(GArray *params, void *user_ctx); /* user */
void gdb_handle_query_supported_user(const char *gdb_supported); /* user */
+bool gdb_handle_set_thread_user(uint32_t pid, uint32_t tid); /* user */
void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 7be4418dcb5..3eb93162aa8 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1099,6 +1099,7 @@ static void handle_cont_with_sig(GArray *params, void
*user_ctx)
static void handle_set_thread(GArray *params, void *user_ctx)
{
+ uint32_t pid, tid;
CPUState *cpu;
if (params->len != 2) {
@@ -1116,8 +1117,14 @@ static void handle_set_thread(GArray *params, void
*user_ctx)
return;
}
- cpu = gdb_get_cpu(get_param(params, 1)->thread_id.pid,
- get_param(params, 1)->thread_id.tid);
+ pid = get_param(params, 1)->thread_id.pid;
+ tid = get_param(params, 1)->thread_id.tid;
+#ifdef CONFIG_USER_ONLY
+ if (gdb_handle_set_thread_user(pid, tid)) {
+ return;
+ }
+#endif
+ cpu = gdb_get_cpu(pid, tid);
if (!cpu) {
gdb_put_packet("E22");
return;
diff --git a/gdbstub/user.c b/gdbstub/user.c
index c9e8b83d720..b048754c4f8 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -386,6 +386,11 @@ void gdb_handle_query_supported_user(const char
*gdb_supported)
{
}
+bool gdb_handle_set_thread_user(uint32_t pid, uint32_t tid)
+{
+ return false;
+}
+
/*
* Execution state helpers
*/
--
2.39.2
- [PATCH 01/29] tests: bump QOS_PATH_MAX_ELEMENT_SIZE again, (continued)
- [PATCH 01/29] tests: bump QOS_PATH_MAX_ELEMENT_SIZE again, Alex Bennée, 2024/03/05
- [PATCH 05/29] gdbstub: Introduce gdbserver_fork_start(), Alex Bennée, 2024/03/05
- [PATCH 02/29] gdbstub: Support disablement in a multi-threaded process, Alex Bennée, 2024/03/05
- [PATCH 06/29] {linux,bsd}-user: Pass pid to fork_end(), Alex Bennée, 2024/03/05
- [PATCH 03/29] {linux,bsd}-user: Introduce get_task_state(), Alex Bennée, 2024/03/05
- [PATCH 09/29] gdbstub: Introduce gdb_handle_query_supported_user(), Alex Bennée, 2024/03/05
- [PATCH 12/29] gdbstub: Implement follow-fork-mode child, Alex Bennée, 2024/03/05
- [PATCH 14/29] plugins: scoreboard API, Alex Bennée, 2024/03/05
- [PATCH 11/29] gdbstub: Introduce gdb_handle_detach_user(), Alex Bennée, 2024/03/05
- [PATCH 07/29] {linux,bsd}-user: Pass pid to gdbserver_fork(), Alex Bennée, 2024/03/05
- [PATCH 10/29] gdbstub: Introduce gdb_handle_set_thread_user(),
Alex Bennée <=
- [PATCH 13/29] tests/tcg: Add two follow-fork-mode tests, Alex Bennée, 2024/03/05
- [PATCH 16/29] plugins: implement inline operation relative to cpu_index, Alex Bennée, 2024/03/05
- [PATCH 15/29] plugins: define qemu_plugin_u64, Alex Bennée, 2024/03/05
- [PATCH 08/29] gdbstub: Call gdbserver_fork() both in parent and in child, Alex Bennée, 2024/03/05
- [PATCH 23/29] contrib/plugins/howvec: migrate to new per_vcpu API, Alex Bennée, 2024/03/05
- [PATCH 17/29] plugins: add inline operation per vcpu, Alex Bennée, 2024/03/05
- [PATCH 29/29] target/riscv: honour show_opcodes when disassembling, Alex Bennée, 2024/03/05
- [PATCH 26/29] disas: introduce show_opcodes, Alex Bennée, 2024/03/05