list all bthreads, print format is 'id\ttid\tfunction\thas stack
| 91 | return |
| 92 | |
| 93 | class 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 | |
| 108 | class BthreadNumCmd(gdb.Command): |
| 109 | """list active bthreads num""" |