From 3556c129601f84a3661c7db9de9c84360b97f45f Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Sun, 2 Feb 2020 19:17:30 +0000 Subject: [PATCH] thermosphere: gdb: fix IsThreadAlive --- thermosphere/src/gdb/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thermosphere/src/gdb/thread.c b/thermosphere/src/gdb/thread.c index e962cb146..d7fa9a302 100644 --- a/thermosphere/src/gdb/thread.c +++ b/thermosphere/src/gdb/thread.c @@ -53,12 +53,12 @@ GDB_DECLARE_HANDLER(IsThreadAlive) { unsigned long threadId; - if (GDB_ParseHexIntegerList(&threadId, ctx->commandData, 1, 0) == NULL) { + if (GDB_ParseHexIntegerList(&threadId, ctx->commandData, 1, 0) == NULL || threadId < 1) { return GDB_ReplyErrno(ctx, EILSEQ); } u32 coreMask = ctx->attachedCoreList; - return (coreMask & BIT(threadId)) != 0 ? GDB_ReplyOk(ctx) : GDB_ReplyErrno(ctx, ESRCH); + return (coreMask & BIT(threadId - 1)) != 0 ? GDB_ReplyOk(ctx) : GDB_ReplyErrno(ctx, ESRCH); } GDB_DECLARE_QUERY_HANDLER(CurrentThreadId)