]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: gdb support: use parse_and_eval to get the goroutine id
authorChristian Himpel <chressie@googlemail.com>
Mon, 19 Nov 2012 18:22:47 +0000 (10:22 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 19 Nov 2012 18:22:47 +0000 (10:22 -0800)
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

src/pkg/runtime/runtime-gdb.py

index b32a670e2673f1c31437004f7e3b02c2abe46cff..eff9a400370f945dbcc63f73335aa5000e2888be 100644 (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