This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2292a3698340570c3590ee79678db004ccf5c69e
Author: anjiahao <anjia...@xiaomi.com>
AuthorDate: Fri Nov 24 12:26:57 2023 +0800

    gdb/thread.py:change show gdb index/tid/pid format
    
    Signed-off-by: anjiahao <anjia...@xiaomi.com>
---
 tools/gdb/thread.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/gdb/thread.py b/tools/gdb/thread.py
index 72f2fae378..8e42919358 100644
--- a/tools/gdb/thread.py
+++ b/tools/gdb/thread.py
@@ -148,19 +148,20 @@ class Nxinfothreads(gdb.Command):
                 % ("Tid", "Pid", "Cpu", "Thread", "Info", "Frame")
             )
         else:
-            gdb.write("%-4s %-4s %-21s %-80s %-30s\n" % ("Tid", "Pid", 
"Thread", "Info", "Frame"))
+            gdb.write("%-5s %-4s %-4s %-21s %-80s %-30s\n" % ("Index", "Tid", 
"Pid", "Thread", "Info", "Frame"))
 
         for i in range(0, npidhash):
             if pidhash[i] == 0:
                 continue
 
             pid = pidhash[i]["group"]["tg_pid"]
+            tid = pidhash[i]["pid"]
 
             if pidhash[i]["task_state"] == 
gdb.parse_and_eval("TSTATE_TASK_RUNNING"):
-                id = "*%s" % i
+                index = "*%s" % i
                 pc = int(gdb.parse_and_eval("$pc"))
             else:
-                id = " %s" % i
+                index = " %s" % i
                 pc = get_pc_value(pidhash[i])
 
             thread = "Thread 0x%x" % pidhash[i]
@@ -203,10 +204,10 @@ class Nxinfothreads(gdb.Command):
             if utils.is_target_smp():
                 cpu = "%d" % pidhash[i]["cpu"]
                 gdb.write(
-                    "%-4s %-4s %-4s %-21s %-80s %-30s\n" % (id, pid, cpu, 
thread, info, frame)
+                    "%-5s %-4s %-4s %-4s %-21s %-80s %-30s\n" % (index, tid, 
pid, cpu, thread, info, frame)
                 )
             else:
-                gdb.write("%-4s %-4s %-21s %-80s %-30s\n" % (id, pid, thread, 
info, frame))
+                gdb.write("%-5s %-4s %-4s %-21s %-80s %-30s\n" % (index, tid, 
pid, thread, info, frame))
 
 
 class Nxthread(gdb.Command):

Reply via email to