MCPcopy Create free account
hub / github.com/apache/brpc / BthreadListCmd

Class BthreadListCmd

tools/gdb_bthread_stack.py:93–106  ·  view source on GitHub ↗

list all bthreads, print format is 'id\ttid\tfunction\thas stack

Source from the content-addressed store, hash-verified

91 return
92
93class BthreadListCmd(gdb.Command):
94 """list all bthreads, print format is 'id\ttid\tfunction\thas stack'"""
95 def __init__(self):
96 gdb.Command.__init__(self, "bthread_list", gdb.COMMAND_STACK, gdb.COMPLETE_NONE)
97
98 def invoke(self, arg, tty):
99 global status
100 global bthreads
101 if not status:
102 print("Not in bthread debug mode")
103 return
104 print("id\t\ttid\t\tfunction\t\thas stack\t\t\ttotal:{}".format(len(bthreads)))
105 for i, t in enumerate(bthreads):
106 print("#{}\t\t{}\t\t{}\t\t{}".format(i, t["tid"], t["fn"], "no" if str(t["stack"]) == "0x0" else "yes"))
107
108class BthreadNumCmd(gdb.Command):
109 """list active bthreads num"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected