[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 03/20] gdbstub: Implement thread_alive (T pkt) wi
From: |
arilou |
Subject: |
[Qemu-devel] [PATCH v3 03/20] gdbstub: Implement thread_alive (T pkt) with new infra |
Date: |
Wed, 24 Apr 2019 17:26:57 +0300 |
From: Jon Doron <address@hidden>
Signed-off-by: Jon Doron <address@hidden>
---
gdbstub.c | 43 ++++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index 34e6722a8c..435b492b4f 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1514,6 +1514,30 @@ static void handle_detach(GdbCmdContext *gdb_ctx, void
*user_ctx)
put_packet(s, "OK");
}
+static void handle_thread_alive(GdbCmdContext *gdb_ctx, void *user_ctx)
+{
+ CPUState *cpu;
+
+ if (!gdb_ctx->num_params) {
+ put_packet(gdb_ctx->s, "E22");
+ return;
+ }
+
+ if (gdb_ctx->params[0].thread_id.kind == GDB_READ_THREAD_ERR) {
+ put_packet(gdb_ctx->s, "E22");
+ return;
+ }
+
+ cpu = gdb_get_cpu(gdb_ctx->s, gdb_ctx->params[0].thread_id.pid,
+ gdb_ctx->params[0].thread_id.tid);
+ if (!cpu) {
+ put_packet(gdb_ctx->s, "E22");
+ return;
+ }
+
+ put_packet(gdb_ctx->s, "OK");
+}
+
static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
CPUState *cpu;
@@ -1813,17 +1837,14 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
}
break;
case 'T':
- thread_kind = read_thread_id(p, &p, &pid, &tid);
- if (thread_kind == GDB_READ_THREAD_ERR) {
- put_packet(s, "E22");
- break;
- }
- cpu = gdb_get_cpu(s, pid, tid);
-
- if (cpu != NULL) {
- put_packet(s, "OK");
- } else {
- put_packet(s, "E22");
+ {
+ static GdbCmdParseEntry thread_alive_cmd_desc = {
+ .handler = handle_thread_alive,
+ .cmd = "T",
+ .cmd_startswith = 1,
+ .schema = "t0"
+ };
+ process_string_cmd(s, NULL, line_buf, &thread_alive_cmd_desc, 1);
}
break;
case 'q':
--
2.20.1
- [Qemu-devel] [PATCH v3 01/20] gdbstub: Add infrastructure to parse cmd packets, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 19/20] gdbstub: Implement generic set (Q pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 03/20] gdbstub: Implement thread_alive (T pkt) with new infra,
arilou <=
- [Qemu-devel] [PATCH v3 18/20] gdbstub: Implement generic query (q pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 17/20] gdbstub: Implement v commands with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 16/20] gdbstub: Implement step (s pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 14/20] gdbstub: Implement read all registers (g pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 20/20] gdbstub: Refactor parse handle packet to work with a static array, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 15/20] gdbstub: Implement file io (F pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 10/20] gdbstub: Implement get register (p pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 07/20] gdbstub: Implement insert breakpoint (Z pkt) with new infra, arilou, 2019/04/24