Skip to content

Commit 2656af9

Browse files
committed
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.
1 parent 1a43ee6 commit 2656af9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Target/Process.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3228,7 +3228,7 @@ Status Process::DestroyImpl(bool force_kill) {
32283228
error = StopForDestroyOrDetach(exit_event_sp);
32293229
}
32303230

3231-
if (m_public_state.GetValue() != eStateRunning) {
3231+
if (m_public_state.GetValue() == eStateStopped) {
32323232
// Ditch all thread plans, and remove all our breakpoints: in case we
32333233
// have to restart the target to kill it, we don't want it hitting a
32343234
// breakpoint... Only do this if we've stopped, however, since if we

0 commit comments

Comments
 (0)