Skip to content

Commit

Permalink
Support all in gdb goroutine commands.
Browse files Browse the repository at this point in the history
For example, can use `goroutine all bt` to dump all goroutines
infomation.
  • Loading branch information
haosdent committed Jul 9, 2018
1 parent b56e247 commit ce9598a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/runtime/runtime-gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,19 @@ def __init__(self):
gdb.Command.__init__(self, "goroutine", gdb.COMMAND_STACK, gdb.COMPLETE_NONE)

def invoke(self, arg, _from_tty):
goid_str, cmd = arg.split(None, 1)
goids = []

if goid_str == 'all':
for ptr in SliceValue(gdb.parse_and_eval("'runtime.allgs'")):
goids.append(int(ptr['goid']))
else:
goids = [int(gdb.parse_and_eval(goid_str))]

for goid in goids:
self._invoke(goid, cmd)

def _invoke(self, goid, cmd):
goid, cmd = arg.split(None, 1)
goid = gdb.parse_and_eval(goid)
pc, sp = find_goroutine(int(goid))
Expand Down

0 comments on commit ce9598a

Please sign in to comment.