From 1d55f111f38ca7d7b3199372abd5a76ac2ba5047 Mon Sep 17 00:00:00 2001 From: xuxingliang Date: Tue, 22 Oct 2024 21:06:52 +0800 Subject: [PATCH] gdb: check if pid is valid Add check to make sure pid is valid. Remove stack check for interrupt context. Signed-off-by: xuxingliang --- tools/gdb/nuttxgdb/thread.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/gdb/nuttxgdb/thread.py b/tools/gdb/nuttxgdb/thread.py index 510a6c624a6..5c8559d8737 100644 --- a/tools/gdb/nuttxgdb/thread.py +++ b/tools/gdb/nuttxgdb/thread.py @@ -366,7 +366,11 @@ class Nxthread(gdb.Command): g_registers.restore() else: - if arg[0].isnumeric() and pidhash[int(arg[0])] != 0: + if ( + arg[0].isnumeric() + and int(arg[0]) < npidhash + and pidhash[int(arg[0])] != 0 + ): if pidhash[int(arg[0])]["task_state"] == gdb.parse_and_eval( "TSTATE_TASK_RUNNING" ):