terminal: make printcontext use SelectedGoroutine

printcontext should use SelectedGoroutine instead of trusting that the
goroutine running on current thread matches the SelectedGoroutine.

When the user switches to a parked goroutine CurrentThread and
SelectedGoroutine will diverge.

Almost all calls to printcontext are safe, they happen after a continue
command returns when SelectedGoroutine and CurrentThread always agree,
but the calls in frameCommand and listCommand are wrong.

Additionally we should stop reporting an error when the debugger is
stopped on an unknown PC address.
This commit is contained in:
aarzilli
2018-04-08 12:41:47 +02:00
committed by Derek Parker
parent 4e177bb99a
commit 4f70ff0a77
3 changed files with 76 additions and 10 deletions

View File

@ -128,6 +128,9 @@ func Continue(dbp Process) error {
}
loc, err := curthread.Location()
if err != nil || loc.Fn == nil || (loc.Fn.Name != "runtime.breakpoint" && loc.Fn.Name != "runtime.Breakpoint") {
if g := dbp.SelectedGoroutine(); g != nil {
g.CurrentLoc = *loc
}
break
}
}