diff options
author | Zachary Turner <zturner@google.com> | 2015-05-13 19:44:24 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-05-13 19:44:24 +0000 |
commit | 7271bab3bbe73b801896598012ef5d66e178e4e9 (patch) | |
tree | 0023b3fc6f2997c9dcdbd8951f8da784db625d22 /lldb/source/Target/Platform.cpp | |
parent | f9e1a165dd8fe700321f8b836b609f4fd218969a (diff) | |
download | bcm5719-llvm-7271bab3bbe73b801896598012ef5d66e178e4e9.tar.gz bcm5719-llvm-7271bab3bbe73b801896598012ef5d66e178e4e9.zip |
Have Platform::KillProcess try to use the process plugin first.
llvm-svn: 237280
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r-- | lldb/source/Target/Platform.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 57375215981..a68d28e8ce3 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -20,6 +20,7 @@ // Project includes #include "lldb/Breakpoint/BreakpointIDList.h" #include "lldb/Core/DataBufferHeap.h" +#include "lldb/Core/Debugger.h" #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" @@ -1252,10 +1253,27 @@ Platform::KillProcess (const lldb::pid_t pid) if (log) log->Printf ("Platform::%s, pid %" PRIu64, __FUNCTION__, pid); - if (!IsHost ()) - return Error ("base lldb_private::Platform class can't launch remote processes"); + // Try to find a process plugin to handle this Kill request. If we can't, fall back to + // the default OS implementation. + size_t num_debuggers = Debugger::GetNumDebuggers(); + for (size_t didx = 0; didx < num_debuggers; ++didx) + { + DebuggerSP debugger = Debugger::GetDebuggerAtIndex(didx); + lldb_private::TargetList &targets = debugger->GetTargetList(); + for (int tidx = 0; tidx < targets.GetNumTargets(); ++tidx) + { + ProcessSP process = targets.GetTargetAtIndex(tidx)->GetProcessSP(); + if (process->GetID() == pid) + return process->Destroy(true); + } + } - Host::Kill (pid, SIGTERM); + if (!IsHost()) + { + return Error("base lldb_private::Platform class can't kill remote processes unless " + "they are controlled by a process plugin"); + } + Host::Kill(pid, SIGTERM); return Error(); } |