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() threads := dbp.ThreadList()
callInjectionDone, err := callInjectionProtocol(dbp, threads) callInjectionDone, callErr := callInjectionProtocol(dbp, threads)
if err != nil { // callErr check delayed until after pickCurrentThread, which must always
return err // happen, otherwise the debugger could be left in an inconsistent
} // state.
if err := pickCurrentThread(dbp, trapthread, threads); err != nil { if err := pickCurrentThread(dbp, trapthread, threads); err != nil {
return err return err
} }
if callErr != nil {
return callErr
}
curthread := dbp.CurrentThread() curthread := dbp.CurrentThread()
curbp := curthread.Breakpoint() curbp := curthread.Breakpoint()