Index: include/lldb/Target/Process.h =================================================================== --- include/lldb/Target/Process.h +++ include/lldb/Target/Process.h @@ -997,6 +997,10 @@ Status ResumeSynchronous(Stream *stream); //------------------------------------------------------------------ + /// Allows subclasses to decide if resuming execution is supported. + virtual bool CanResume() const { return true; } + + //------------------------------------------------------------------ /// Halts a running process. /// /// This function is not meant to be overridden by Process @@ -1267,13 +1271,7 @@ /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ - virtual Status DoResume() { - Status error; - error.SetErrorStringWithFormat( - "error: %s does not support resuming processes", - GetPluginName().GetCString()); - return error; - } + virtual Status DoResume() = 0; //------------------------------------------------------------------ /// Called after resuming a process. Index: source/Commands/CommandObjectThread.cpp =================================================================== --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -94,7 +94,7 @@ bool all_threads = false; if (command.GetArgumentCount() == 0) { Thread *thread = m_exe_ctx.GetThreadPtr(); - if (!HandleOneThread(thread->GetID(), result)) + if (!thread || !HandleOneThread(thread->GetID(), result)) return false; return result.Succeeded(); } else if (command.GetArgumentCount() == 1) { @@ -775,6 +775,12 @@ else error = process->Resume(); + if(!error.Success()) { + result.AppendMessage(error.AsCString()); + result.SetStatus(eReturnStatusFailed); + return false; + } + // There is a race condition where this thread will return up the call // stack to the main command handler // and show an (lldb) prompt before HandlePrivateEvent (from Index: source/Plugins/Process/elf-core/ProcessElfCore.h =================================================================== --- source/Plugins/Process/elf-core/ProcessElfCore.h +++ source/Plugins/Process/elf-core/ProcessElfCore.h @@ -84,11 +84,17 @@ void RefreshStateAfterStop() override; + lldb_private::Status DoResume() override; + + bool CanResume() const override { return false; } + //------------------------------------------------------------------ // Process Queries //------------------------------------------------------------------ bool IsAlive() override; + bool WarnBeforeDetach() const override { return false; } + //------------------------------------------------------------------ // Process Memory //------------------------------------------------------------------ Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -28,6 +28,7 @@ #include "lldb/Utility/Log.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Threading.h" #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" @@ -219,7 +220,7 @@ ArchSpec core_arch(m_core_module_sp->GetArchitecture()); target_arch.MergeFrom(core_arch); GetTarget().SetArchitecture(target_arch); - + SetUnixSignals(UnixSignals::Create(GetArchitecture())); // Ensure we found at least one thread that was stopped on a signal. @@ -291,6 +292,10 @@ Status ProcessElfCore::DoDestroy() { return Status(); } +lldb_private::Status ProcessElfCore::DoResume() { + llvm::report_fatal_error("ProcessElfCore::DoResume() not supported"); +} + //------------------------------------------------------------------ // Process Queries //------------------------------------------------------------------ @@ -730,7 +735,7 @@ core_file->GetArchitecture(arch); ArchSpec target_arch = GetTarget().GetArchitecture(); - + if (target_arch.IsMIPS()) return target_arch; Index: source/Plugins/Process/minidump/ProcessMinidump.h =================================================================== --- source/Plugins/Process/minidump/ProcessMinidump.h +++ source/Plugins/Process/minidump/ProcessMinidump.h @@ -65,6 +65,10 @@ void RefreshStateAfterStop() override; + Status DoResume() override; + + bool CanResume() const override { return false; } + bool IsAlive() override; bool WarnBeforeDetach() const override; Index: source/Plugins/Process/minidump/ProcessMinidump.cpp =================================================================== --- source/Plugins/Process/minidump/ProcessMinidump.cpp +++ source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -25,6 +25,7 @@ #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Threading.h" @@ -143,6 +144,10 @@ Status ProcessMinidump::DoDestroy() { return Status(); } +Status ProcessMinidump::DoResume() { + llvm::report_fatal_error("ProcessMinidump::DoResume() not supported"); +} + void ProcessMinidump::RefreshStateAfterStop() { if (!m_active_exception) return; Index: source/Target/Process.cpp =================================================================== --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -1615,6 +1615,15 @@ LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::Resume -- locking run lock"); + if (!CanResume()) { + Status error; + error.SetErrorStringWithFormat( + "error: %s does not support resuming processes", + GetPluginName().GetCString()); + if (log) + log->Printf("Process::Resume: -- plugin does not support resuming."); + return error; + } if (!m_public_run_lock.TrySetRunning()) { Status error("Resume request failed - process still running."); if (log) @@ -1629,6 +1638,15 @@ LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::ResumeSynchronous -- locking run lock"); + if (!CanResume()) { + Status error; + error.SetErrorStringWithFormat( + "error: %s does not support resuming processes", + GetPluginName().GetCString()); + if (log) + log->Printf("Process::Resume: -- plugin does not support resuming."); + return error; + } if (!m_public_run_lock.TrySetRunning()) { Status error("Resume request failed - process still running."); if (log)