runtime: gdb support: use parse_and_eval to get the goroutine id

This enables to loop over some goroutines, e.g. to print the
backtrace of goroutines 1 to 9:

        set $i = 1
        while $i < 10
        printf "backtrace of goroutine %d:\n", $i
        goroutine $i++ bt
        end

R=lvd, lvd
CC=golang-dev
https://golang.org/cl/6843071
This commit is contained in:
Christian Himpel 2012-11-19 10:22:47 -08:00 committed by Ian Lance Taylor
parent 8f3b703323
commit ca8aac698f
1 changed files with 1 additions and 0 deletions

View File

@ -375,6 +375,7 @@ class GoroutineCmd(gdb.Command):
def invoke(self, arg, from_tty):
goid, cmd = arg.split(None, 1)
goid = gdb.parse_and_eval(goid)
pc, sp = find_goroutine(int(goid))
if not pc:
print "No such goroutine: ", goid