Move print goroutine info into command

* DebuggedProcess method: `PrintGoroutinesInfo` -> `GoroutinesInfo`
* `goroutines` command in command/command.go now responsible for
  printing info.
This commit is contained in:
Derek Parker
2015-04-09 09:53:02 -05:00
parent 22ac63f050
commit 42a57ad285
3 changed files with 60 additions and 36 deletions

View File

@ -158,7 +158,21 @@ func thread(p *proctl.DebuggedProcess, args ...string) error {
}
func goroutines(p *proctl.DebuggedProcess, args ...string) error {
return p.PrintGoroutinesInfo()
var fname string
gs, err := p.GoroutinesInfo()
if err != nil {
return err
}
fmt.Printf("[%d goroutines]\n", len(gs))
for _, g := range gs {
if g.Func != nil {
fname = g.Func.Name
}
fmt.Printf("Goroutine %d - %s:%d %s\n", g.Id, g.File, g.Line, fname)
}
return nil
}
func cont(p *proctl.DebuggedProcess, args ...string) error {