[lldb] Always call DestroyImpl from Process::Finalize
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 14 Jul 2021 20:21:36 +0000 (13:21 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 14 Jul 2021 20:35:53 +0000 (13:35 -0700)
Always destroy the process, regardless of its private state. This will
call the virtual function DoDestroy under the hood, giving our derived
class a chance to do the necessary tear down, including what to do when
the private state is eStateExited.

Differential revision: https://reviews.llvm.org/D106004

lldb/source/Target/Process.cpp

index 99e4314..a169b46 100644 (file)
@@ -493,25 +493,9 @@ void Process::Finalize() {
   if (m_finalizing.exchange(true))
     return;
 
-  // Destroy this process if needed
-  switch (GetPrivateState()) {
-  case eStateConnected:
-  case eStateAttaching:
-  case eStateLaunching:
-  case eStateStopped:
-  case eStateRunning:
-  case eStateStepping:
-  case eStateCrashed:
-  case eStateSuspended:
-    DestroyImpl(false);
-    break;
-
-  case eStateInvalid:
-  case eStateUnloaded:
-  case eStateDetached:
-  case eStateExited:
-    break;
-  }
+  // Destroy the process. This will call the virtual function DoDestroy under
+  // the hood, giving our derived class a chance to do the ncessary tear down.
+  DestroyImpl(false);
 
   // Clear our broadcaster before we proceed with destroying
   Broadcaster::Clear();