proc/native,proc/gdbserial: set selectedGoroutine after StepInstruction

When stepping through runtime sometimes the current goroutine will
change. It is impossible to handle this in Next, Step and StepOut but
StepInstruction can reset the current goroutine correctly.
This commit is contained in:
aarzilli 2017-06-23 15:52:46 +02:00 committed by Derek Parker
parent 283128aeab
commit 4121fb1f96
2 changed files with 16 additions and 2 deletions

@ -642,7 +642,14 @@ func (p *Process) StepInstruction() error {
if err != nil {
return err
}
return thread.SetCurrentBreakpoint()
err = thread.SetCurrentBreakpoint()
if err != nil {
return err
}
if g, _ := proc.GetG(thread); g != nil {
p.selectedGoroutine = g
}
return nil
}
func (p *Process) SwitchThread(tid int) error {

@ -316,7 +316,14 @@ func (dbp *Process) StepInstruction() (err error) {
if err != nil {
return err
}
return thread.SetCurrentBreakpoint()
err = thread.SetCurrentBreakpoint()
if err != nil {
return err
}
if g, _ := proc.GetG(thread); g != nil {
dbp.selectedGoroutine = g
}
return nil
}
// SwitchThread changes from current thread to the thread specified by `tid`.