[Lldb-commits] [PATCH] Fix -gdb-exit to detach if was attached or destroy otherwise (MI)
Ilia K
ki.stfu at gmail.com
Tue Mar 24 13:57:01 PDT 2015
Remove switch() in Process::Finalize
http://reviews.llvm.org/D8298
Files:
source/Target/Process.cpp
tools/lldb-mi/MICmdCmdMiscellanous.cpp
Index: source/Target/Process.cpp
===================================================================
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -822,32 +822,8 @@
void
Process::Finalize()
{
- switch (GetPrivateState())
- {
- case eStateConnected:
- case eStateAttaching:
- case eStateLaunching:
- case eStateStopped:
- case eStateRunning:
- case eStateStepping:
- case eStateCrashed:
- case eStateSuspended:
- if (GetShouldDetach())
- {
- // FIXME: This will have to be a process setting:
- bool keep_stopped = false;
- Detach(keep_stopped);
- }
- else
- Destroy();
- break;
-
- case eStateInvalid:
- case eStateUnloaded:
- case eStateDetached:
- case eStateExited:
- break;
- }
+ // Destroy this process first
+ Destroy();
// Clear our broadcaster before we proceed with destroying
Broadcaster::Clear();
@@ -3952,6 +3928,13 @@
// that might hinder the destruction. Remember to set this back to false when we are done. That way if the attempt
// failed and the process stays around for some reason it won't be in a confused state.
+ if (GetShouldDetach())
+ {
+ // FIXME: This will have to be a process setting:
+ bool keep_stopped = false;
+ Detach(keep_stopped);
+ }
+
m_destroy_in_process = true;
Error error (WillDestroy());
Index: tools/lldb-mi/MICmdCmdMiscellanous.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdMiscellanous.cpp
+++ tools/lldb-mi/MICmdCmdMiscellanous.cpp
@@ -74,7 +74,7 @@
CMICmdCmdGdbExit::Execute(void)
{
CMICmnLLDBDebugger::Instance().GetDriver().SetExitApplicationFlag(true);
- const lldb::SBError sbErr = m_rLLDBDebugSessionInfo.GetProcess().Detach();
+ const lldb::SBError sbErr = m_rLLDBDebugSessionInfo.GetProcess().Destroy();
// Do not check for sbErr.Fail() here, m_lldbProcess is likely !IsValid()
return MIstatus::success;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8298.22598.patch
Type: text/x-patch
Size: 2165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150324/d5a01934/attachment.bin>
More information about the lldb-commits
mailing list