[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/29] gdbstub: Introduce gdb_handle_detach_user()
From: |
Alex Bennée |
Subject: |
[PATCH 11/29] gdbstub: Introduce gdb_handle_detach_user() |
Date: |
Tue, 5 Mar 2024 12:09:47 +0000 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
The upcoming follow-fork-mode child support needs to perform certain
actions when GDB detaches from the stopped parent or the stopped child.
Introduce a user-specific hook for this.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240219141628.246823-11-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
gdbstub/internals.h | 1 +
gdbstub/gdbstub.c | 6 ++++++
gdbstub/user.c | 5 +++++
3 files changed, 12 insertions(+)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index b4905c7181a..b4724598384 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -198,6 +198,7 @@ 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 */
+bool gdb_handle_detach_user(uint32_t pid); /* user */
void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 3eb93162aa8..17efcae0d0e 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1024,6 +1024,12 @@ static void handle_detach(GArray *params, void *user_ctx)
pid = get_param(params, 0)->val_ul;
}
+#ifdef CONFIG_USER_ONLY
+ if (gdb_handle_detach_user(pid)) {
+ return;
+ }
+#endif
+
process = gdb_get_process(pid);
gdb_process_breakpoint_remove_all(process);
process->attached = false;
diff --git a/gdbstub/user.c b/gdbstub/user.c
index b048754c4f8..1a7b582a40d 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -391,6 +391,11 @@ bool gdb_handle_set_thread_user(uint32_t pid, uint32_t tid)
return false;
}
+bool gdb_handle_detach_user(uint32_t pid)
+{
+ return false;
+}
+
/*
* Execution state helpers
*/
--
2.39.2
- [PATCH 04/29] {linux,bsd}-user: Update ts_tid after fork(), (continued)
- [PATCH 04/29] {linux,bsd}-user: Update ts_tid after fork(), Alex Bennée, 2024/03/05
- [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 <=
- [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, 2024/03/05
- [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