From eecdbd912e844d5bb9f2babf001ac06e4db41ca0 Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@cloudius-systems.com>
Date: Sat, 23 Feb 2013 20:54:32 +0200
Subject: [PATCH] gdb: improve thread status printing

With atomic status, there is no need to examine the runqueue.
---
 scripts/loader.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/scripts/loader.py b/scripts/loader.py
index 559bf4e52..2cae9948d 100644
--- a/scripts/loader.py
+++ b/scripts/loader.py
@@ -249,20 +249,14 @@ class osv_info_threads(gdb.Command):
                 cpu = t['_cpu']
                 fr = gdb.selected_frame()
                 sal = fr.find_sal()
-                status = 'rdy '
-                if t['_status']['_M_i'] == status_enum.waiting:
-                    status = 'wait'
-                elif t['_status']['_M_i'] == status_enum.waking:
-                    status = 'wake'
-                if state.cpu_from_thread(t):
-                    status = 'run '
+                status = str(t['_status']['_M_i']).replace('sched::thread::', '')
                 function = '??'
                 if fr.function():
                     function = fr.function().name
                 fname = '??'
                 if sal.symtab:
                     fname = sal.symtab.filename
-                gdb.write('0x%x cpu%s %s %s at %s:%s\n' %
+                gdb.write('0x%x cpu%s %-10s %s at %s:%s\n' %
                           (ulong(t.address),
                            cpu['arch']['acpi_id'],
                            status,
-- 
GitLab