https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9930eeca765ac2520a7bd…
commit 9930eeca765ac2520a7bd5dd411915d232cc96c3
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Thu May 6 18:32:44 2021 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Tue May 11 11:00:49 2021 +0200
[KDGDB] Implement TIB address retrieval
---
drivers/base/kdgdb/gdb_input.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/base/kdgdb/gdb_input.c b/drivers/base/kdgdb/gdb_input.c
index c10d7750c84..822efb88042 100644
--- a/drivers/base/kdgdb/gdb_input.c
+++ b/drivers/base/kdgdb/gdb_input.c
@@ -259,6 +259,30 @@ handle_gdb_query(void)
return send_gdb_packet("l");
}
+ if (strncmp(gdb_input, "qGetTIBAddr:", 12) == 0)
+ {
+ ULONG_PTR Pid, Tid;
+ PETHREAD Thread;
+
+#if MONOPROCESS
+ Pid = 0;
+ Tid = hex_to_tid(&gdb_input[12]);
+
+ KDDBGPRINT(" %p.\n", Tid);
+
+ Thread = find_thread(Pid, Tid);
+#else
+ Pid = hex_to_pid(&gdb_input[13]);
+ Tid = hex_to_tid(strstr(&gdb_input[13], ".") + 1);
+
+ /* We cannot use PsLookupProcessThreadByCid as we could be running at any IRQL.
+ * So loop. */
+ KDDBGPRINT(" p%p.%p.\n", Pid, Tid);
+ Thread = find_thread(Pid, Tid);
+#endif
+ return send_gdb_memory(&Thread->Tcb.Teb, sizeof(Thread->Tcb.Teb));
+ }
+
if (strncmp(gdb_input, "qThreadExtraInfo,", 17) == 0)
{
ULONG_PTR Pid, Tid;