[Lldb-commits] [lldb] r205315 - Implement ProcessMonitor::Kill for FreeBSD
Ed Maste
emaste at freebsd.org
Tue Apr 1 07:30:57 PDT 2014
Author: emaste
Date: Tue Apr 1 09:30:56 2014
New Revision: 205315
URL: http://llvm.org/viewvc/llvm-project?rev=205315&view=rev
Log:
Implement ProcessMonitor::Kill for FreeBSD
On FreeBSD ptrace(PT_KILL) is used to terminate the traced process
(as if PT_CONTINUE had been used with SIGKILL as the signal to be
delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy.
On Linux, after ptrace(PTRACE_KILL) the traced process still exists
and can be interrogated. It is only upon resume that it exits as though
it received SIGKILL.
For now I'm committing only the FreeBSD change, until the Linux change
(review D3159) is successfully tested.
http://llvm.org/pr18894
Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=205315&r1=205314&r2=205315&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Tue Apr 1 09:30:56 2014
@@ -702,7 +702,7 @@ EventMessageOperation::Execute(ProcessMo
//------------------------------------------------------------------------------
/// @class KillOperation
-/// @brief Implements ProcessMonitor::BringProcessIntoLimbo.
+/// @brief Implements ProcessMonitor::Kill.
class KillOperation : public Operation
{
public:
@@ -1648,7 +1648,7 @@ ProcessMonitor::SingleStep(lldb::tid_t u
}
bool
-ProcessMonitor::BringProcessIntoLimbo()
+ProcessMonitor::Kill()
{
bool result;
KillOperation op(result);
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=205315&r1=205314&r2=205315&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h Tue Apr 1 09:30:56 2014
@@ -194,11 +194,9 @@ public:
bool
SingleStep(lldb::tid_t unused, uint32_t signo);
- /// Sends the inferior process a PTRACE_KILL signal. The inferior will
- /// still exists and can be interrogated. Once resumed it will exit as
- /// though it received a SIGKILL.
+ /// Terminate the traced process.
bool
- BringProcessIntoLimbo();
+ Kill();
lldb_private::Error
Detach(lldb::tid_t tid);
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=205315&r1=205314&r2=205315&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Tue Apr 1 09:30:56 2014
@@ -337,11 +337,13 @@ ProcessPOSIX::DoDestroy()
if (!HasExited())
{
- // Drive the exit event to completion (do not keep the inferior in
- // limbo).
+ assert(m_monitor);
m_exit_now = true;
-
+#ifdef __linux__
if ((m_monitor == NULL || kill(m_monitor->GetPID(), SIGKILL)) && error.Success())
+#else
+ if (!m_monitor->Kill())
+#endif
{
error.SetErrorToErrno();
return error;
More information about the lldb-commits
mailing list