[Lldb-commits] [lldb] r233255 - Fix -gdb-exit to detach if was attached or destroy otherwise (MI)
Ilia K
ki.stfu at gmail.com
Thu Mar 26 00:08:48 PDT 2015
Author: ki.stfu
Date: Thu Mar 26 02:08:47 2015
New Revision: 233255
URL: http://llvm.org/viewvc/llvm-project?rev=233255&view=rev
Log:
Fix -gdb-exit to detach if was attached or destroy otherwise (MI)
Summary:
This patch fixes -gdb-exit for locally target. It includes the following changes:
# Fix Process::Finalize
# Use SBProcess::Destroy in -gdb-exit
Reviewers: abidh, zturner, clayborg
Reviewed By: clayborg
Subscribers: lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8298
Modified:
lldb/trunk/source/Target/Process.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=233255&r1=233254&r2=233255&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Mar 26 02:08:47 2015
@@ -822,32 +822,8 @@ Process::GetGlobalProperties()
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
+ Destroy();
// Clear our broadcaster before we proceed with destroying
Broadcaster::Clear();
@@ -3952,6 +3928,13 @@ Process::Destroy ()
// 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());
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp?rev=233255&r1=233254&r2=233255&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp Thu Mar 26 02:08:47 2015
@@ -74,7 +74,7 @@ bool
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;
More information about the lldb-commits
mailing list