From 57a4a3457e2600ad2903beea1fa71cbcaa2cd77a Mon Sep 17 00:00:00 2001 From: TuxSH Date: Sat, 1 Feb 2020 16:28:31 +0000 Subject: [PATCH] thermosphere: fix thread reporting logic, etc --- thermosphere/Makefile | 1 + thermosphere/src/gdb/net.c | 2 ++ thermosphere/src/gdb/thread.c | 5 ++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/thermosphere/Makefile b/thermosphere/Makefile index 6e8386692..7fdb177d8 100644 --- a/thermosphere/Makefile +++ b/thermosphere/Makefile @@ -72,6 +72,7 @@ CFLAGS := \ -fno-unwind-tables \ -std=gnu11 \ -Wall \ + -Werror \ -Wno-main \ $(ARCH) $(DEFINES) diff --git a/thermosphere/src/gdb/net.c b/thermosphere/src/gdb/net.c index d02c9ec47..5aebdbefb 100644 --- a/thermosphere/src/gdb/net.c +++ b/thermosphere/src/gdb/net.c @@ -236,6 +236,8 @@ int GDB_ReceivePacket(GDBContext *ctx) ctx->state = GDB_STATE_ATTACHED; } + // Debug + ctx->buffer[checksumPos + 2] = '\0'; DEBUGRAW("->"); DEBUGRAW(ctx->buffer); DEBUGRAW("\n"); diff --git a/thermosphere/src/gdb/thread.c b/thermosphere/src/gdb/thread.c index 9c90b0f71..e962cb146 100644 --- a/thermosphere/src/gdb/thread.c +++ b/thermosphere/src/gdb/thread.c @@ -70,8 +70,7 @@ GDB_DECLARE_QUERY_HANDLER(fThreadInfo) { // We have made our GDB packet big enough to list all the thread ids (coreIds + 1 for each coreId) char *buf = ctx->buffer + 1; - int n = 1; - buf[0] = 'm'; + size_t n = 0; u32 coreMask = ctx->attachedCoreList; @@ -89,7 +88,7 @@ GDB_DECLARE_QUERY_HANDLER(sThreadInfo) { // We have made our GDB packet big enough to list all the thread ids (coreIds + 1 for each coreId) in fThreadInfo // Note: we assume GDB doesn't accept notifications during the sequence transfer... - return GDB_SendPacket(ctx, "m", 1); + return GDB_SendPacket(ctx, "l", 1); } GDB_DECLARE_QUERY_HANDLER(ThreadEvents)