[Lldb-commits] [PATCH] Fix -gdb-exit to detach if was attached or destroy otherwise (MI)

Greg Clayton clayborg at gmail.com
Thu Mar 12 10:00:10 PDT 2015


We should not add SBProcess::GetShouldDetach() and we should fix the Process::DoDestroy() functions to all look at the Process::GetShouldDetach() and each instance should do the right thing (detach or kill) based on that setting. This isn't something we should pass out of the API. See inlined comments above.


================
Comment at: include/lldb/API/SBProcess.h:326-327
@@ -325,2 +325,4 @@
 
+    bool GetShouldDetach() const;
+
 protected:
----------------
Remove this.

================
Comment at: source/API/SBProcess.cpp:1404-1412
@@ -1403,1 +1403,10 @@
 }
+
+bool
+SBProcess::GetShouldDetach() const
+{
+    ProcessSP process_sp(GetSP());
+    if (process_sp)
+        return process_sp->GetShouldDetach();
+    return false;
+}
----------------
Remove this.

================
Comment at: tools/lldb-mi/MICmdCmdMiscellanous.cpp:87-91
@@ -86,3 +86,7 @@
     CMICmnLLDBDebugger::Instance().GetDriver().SetExitApplicationFlag(true);
-    const lldb::SBError sbErr = m_rLLDBDebugSessionInfo.GetProcess().Detach();
+    lldb::SBProcess sbProcess = m_rLLDBDebugSessionInfo.GetProcess();
+    if (!sbProcess.IsValid())
+        return MIstatus::success;
+
+    const lldb::SBError sbErr = sbProcess.GetShouldDetach() ? sbProcess.Detach() : sbProcess.Destroy();
     // Do not check for sbErr.Fail() here, m_lldbProcess is likely !IsValid()
----------------
Remove this and always call sbProcess.Destroy(). We will need to modify the internal plug-ins to "do the right thing" when destroy is called.

http://reviews.llvm.org/D8298

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list