[Lldb-commits] [PATCH] Fix -gdb-exit to detach if was attached or destroy otherwise (MI)
Ilia K
ki.stfu at gmail.com
Thu Mar 12 09:44:01 PDT 2015
Hi abidh, clayborg,
This patch fixes -gdb-exit for locally target. It includes the following changes:
# Add SBProcess::GetShouldDetach
# Fix -gdb-exit
http://reviews.llvm.org/D8298
Files:
include/lldb/API/SBProcess.h
source/API/SBProcess.cpp
tools/lldb-mi/MICmdCmdMiscellanous.cpp
Index: include/lldb/API/SBProcess.h
===================================================================
--- include/lldb/API/SBProcess.h
+++ include/lldb/API/SBProcess.h
@@ -323,6 +323,8 @@
bool
IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
+ bool GetShouldDetach() const;
+
protected:
friend class SBAddress;
friend class SBBreakpoint;
Index: source/API/SBProcess.cpp
===================================================================
--- source/API/SBProcess.cpp
+++ source/API/SBProcess.cpp
@@ -1401,3 +1401,12 @@
return runtime_sp->IsActive();
}
+
+bool
+SBProcess::GetShouldDetach() const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ return process_sp->GetShouldDetach();
+ return false;
+}
Index: tools/lldb-mi/MICmdCmdMiscellanous.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdMiscellanous.cpp
+++ tools/lldb-mi/MICmdCmdMiscellanous.cpp
@@ -84,7 +84,11 @@
CMICmdCmdGdbExit::Execute(void)
{
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()
return MIstatus::success;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8298.21845.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150312/fc721b41/attachment.bin>
More information about the lldb-commits
mailing list