terminal: show current thread of goroutines (#564)

This commit is contained in:
Alessandro Arzilli
2016-06-20 19:20:44 +02:00
committed by Derek Parker
parent ede880134c
commit 7761faad5b
4 changed files with 17 additions and 1 deletions

View File

@ -186,11 +186,17 @@ func ConvertFunction(fn *gosym.Func) *Function {
// ConvertGoroutine converts from proc.G to api.Goroutine.
func ConvertGoroutine(g *proc.G) *Goroutine {
th := g.Thread()
tid := 0
if th != nil {
tid = th.ID
}
return &Goroutine{
ID: g.ID,
CurrentLoc: ConvertLocation(g.CurrentLoc),
UserCurrentLoc: ConvertLocation(g.UserCurrent()),
GoStatementLoc: ConvertLocation(g.Go()),
ThreadID: tid,
}
}