Don't use !eStateRunning when you mean eStateStopped in DestroyImpl.

When we go to destroy the process, we first try to halt it, if
we succeeded and the target stopped, we want to clear out the
thread plans and breakpoints in case we still need to resume to complete
killing the process.  If the target was exited or detached, it's
pointless but harmless to do this.  But if the state is eStateInvalid -
for instance if we tried to interrupt the target to Halt it and that
fails - we don't want to keep trying to interact with the inferior,
so we shouldn't do this work.

This change explicitly checks eStateStopped, and only does the pre-resume
cleanup if we did manage to stop the process.
This commit is contained in:
Jim Ingham 2021-07-19 14:25:37 -07:00
parent 1a43ee65d1
commit 2656af95eb
1 changed files with 1 additions and 1 deletions

View File

@ -3228,7 +3228,7 @@ Status Process::DestroyImpl(bool force_kill) {
error = StopForDestroyOrDetach(exit_event_sp);
}
if (m_public_state.GetValue() != eStateRunning) {
if (m_public_state.GetValue() == eStateStopped) {
// Ditch all thread plans, and remove all our breakpoints: in case we
// have to restart the target to kill it, we don't want it hitting a
// breakpoint... Only do this if we've stopped, however, since if we