proc: keep debugger state consistent if callInjectionProtocol fails

pickCurrentThread should always run.
This commit is contained in:
aarzilli 2020-04-22 16:34:48 +02:00 committed by Derek Parker
parent 6102c31d6d
commit bb2525a7d5

@ -78,15 +78,19 @@ func (dbp *Target) Continue() error {
threads := dbp.ThreadList()
callInjectionDone, err := callInjectionProtocol(dbp, threads)
if err != nil {
return err
}
callInjectionDone, callErr := callInjectionProtocol(dbp, threads)
// callErr check delayed until after pickCurrentThread, which must always
// happen, otherwise the debugger could be left in an inconsistent
// state.
if err := pickCurrentThread(dbp, trapthread, threads); err != nil {
return err
}
if callErr != nil {
return callErr
}
curthread := dbp.CurrentThread()
curbp := curthread.Breakpoint()