[Lldb-commits] [lldb] 2656af9 - Don't use !eStateRunning when you mean eStateStopped in DestroyImpl.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 19 14:30:13 PDT 2021


Author: Jim Ingham
Date: 2021-07-19T14:30:04-07:00
New Revision: 2656af95eb8e67364db7b8dc4a95c3b65c286b2d

URL: https://github.com/llvm/llvm-project/commit/2656af95eb8e67364db7b8dc4a95c3b65c286b2d
DIFF: https://github.com/llvm/llvm-project/commit/2656af95eb8e67364db7b8dc4a95c3b65c286b2d.diff

LOG: 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.

Added: 
    

Modified: 
    lldb/source/Target/Process.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 2907c71054f08..05a361ba0ab7c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -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


        


More information about the lldb-commits mailing list