diff options
| author | Augusto Noronha <anoronha@apple.com> | 2024-10-10 15:01:20 -0700 |
|---|---|---|
| committer | Augusto Noronha <anoronha@apple.com> | 2024-10-10 15:05:58 -0700 |
| commit | 2ff4c25b7efff64b3b662d0bedcfe7edebcf20b9 (patch) | |
| tree | 4745bb41775ee5d30beda655c3760f3ebbcda592 /lldb/source/Plugins | |
| parent | f02252e1fd2965db007cf7be74c448b7a119c321 (diff) | |
Revert "[lldb] Implement basic support for reverse-continue (#99736)"
This reverts commit d5e1de6da96c1ab3b8cae68447e8ed3696a7006e.
Diffstat (limited to 'lldb/source/Plugins')
12 files changed, 22 insertions, 121 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index b0aa664775b4..de047ee214c1 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -82,9 +82,6 @@ void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info, case eStopReasonProcessorTrace: log.Printf("%s: %s processor trace", __FUNCTION__, header); return; - case eStopReasonHistoryBoundary: - log.Printf("%s: %s history boundary", __FUNCTION__, header); - return; default: log.Printf("%s: %s invalid stop reason %" PRIu32, __FUNCTION__, header, static_cast<uint32_t>(stop_info.reason)); diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 116c43343c01..9b2907c68099 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -402,16 +402,9 @@ lldb_private::DynamicLoader *ProcessKDP::GetDynamicLoader() { Status ProcessKDP::WillResume() { return Status(); } -Status ProcessKDP::DoResume(RunDirection direction) { +Status ProcessKDP::DoResume() { Status error; Log *log = GetLog(KDPLog::Process); - - if (direction == RunDirection::eRunReverse) { - error.SetErrorStringWithFormatv( - "error: {0} does not support reverse execution of processes", GetPluginName()); - return error; - } - // Only start the async thread if we try to do any process control if (!m_async_thread.IsJoinable()) StartAsyncThread(); diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h index 1b71d83f70b0..e5ec5914f960 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h @@ -90,7 +90,7 @@ public: // Process Control lldb_private::Status WillResume() override; - lldb_private::Status DoResume(lldb::RunDirection direction) override; + lldb_private::Status DoResume() override; lldb_private::Status DoHalt(bool &caused_stop) override; diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index 76b7095deaa5..703aa082f047 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -204,17 +204,11 @@ ProcessWindows::DoAttachToProcessWithID(lldb::pid_t pid, return error; } -Status ProcessWindows::DoResume(RunDirection direction) { +Status ProcessWindows::DoResume() { Log *log = GetLog(WindowsLog::Process); llvm::sys::ScopedLock lock(m_mutex); Status error; - if (direction == RunDirection::eRunReverse) { - error.SetErrorStringWithFormatv( - "error: {0} does not support reverse execution of processes", GetPluginName()); - return error; - } - StateType private_state = GetPrivateState(); if (private_state == eStateStopped || private_state == eStateCrashed) { LLDB_LOG(log, "process {0} is in state {1}. Resuming...", diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h index 97284b7cd143..e97cfb790248 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h @@ -52,7 +52,7 @@ public: Status DoAttachToProcessWithID( lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override; - Status DoResume(lldb::RunDirection direction) override; + Status DoResume() override; Status DoDestroy() override; Status DoHalt(bool &caused_stop) override; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index fc792a440941..e42526c8fd72 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -199,20 +199,6 @@ uint64_t GDBRemoteCommunicationClient::GetRemoteMaxPacketSize() { return m_max_packet_size; } -bool GDBRemoteCommunicationClient::GetReverseContinueSupported() { - if (m_supports_reverse_continue == eLazyBoolCalculate) { - GetRemoteQSupported(); - } - return m_supports_reverse_continue == eLazyBoolYes; -} - -bool GDBRemoteCommunicationClient::GetReverseStepSupported() { - if (m_supports_reverse_step == eLazyBoolCalculate) { - GetRemoteQSupported(); - } - return m_supports_reverse_step == eLazyBoolYes; -} - bool GDBRemoteCommunicationClient::QueryNoAckModeSupported() { if (m_supports_not_sending_acks == eLazyBoolCalculate) { m_send_acks = true; @@ -309,8 +295,6 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { m_supports_qXfer_siginfo_read = eLazyBoolCalculate; m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate; m_uses_native_signals = eLazyBoolCalculate; - m_supports_reverse_continue = eLazyBoolCalculate; - m_supports_reverse_step = eLazyBoolCalculate; m_supports_qProcessInfoPID = true; m_supports_qfProcessInfo = true; m_supports_qUserName = true; @@ -364,8 +348,6 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_memory_tagging = eLazyBoolNo; m_supports_qSaveCore = eLazyBoolNo; m_uses_native_signals = eLazyBoolNo; - m_supports_reverse_continue = eLazyBoolNo; - m_supports_reverse_step = eLazyBoolNo; m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if // not, we assume no limit @@ -419,10 +401,6 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_qSaveCore = eLazyBoolYes; else if (x == "native-signals+") m_uses_native_signals = eLazyBoolYes; - else if (x == "ReverseContinue+") - m_supports_reverse_continue = eLazyBoolYes; - else if (x == "ReverseStep+") - m_supports_reverse_step = eLazyBoolYes; // Look for a list of compressions in the features list e.g. // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib- // deflate,lzma diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index 116b47c1edf0..898d176abc34 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -331,10 +331,6 @@ public: bool GetMultiprocessSupported(); - bool GetReverseContinueSupported(); - - bool GetReverseStepSupported(); - LazyBool SupportsAllocDeallocMemory() // const { // Uncomment this to have lldb pretend the debug server doesn't respond to @@ -565,8 +561,6 @@ protected: LazyBool m_supports_memory_tagging = eLazyBoolCalculate; LazyBool m_supports_qSaveCore = eLazyBoolCalculate; LazyBool m_uses_native_signals = eLazyBoolCalculate; - LazyBool m_supports_reverse_continue = eLazyBoolCalculate; - LazyBool m_supports_reverse_step = eLazyBoolCalculate; bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1, m_supports_qUserName : 1, m_supports_qGroupName : 1, diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 4016cde74ebe..35fa93e53bc6 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -716,7 +716,6 @@ static const char *GetStopReasonString(StopReason stop_reason) { return "vforkdone"; case eStopReasonInterrupt: return "async interrupt"; - case eStopReasonHistoryBoundary: case eStopReasonInstrumentation: case eStopReasonInvalid: case eStopReasonPlanComplete: diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 3fc03bd05d5d..3e09c316d74f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -169,10 +169,6 @@ public: } }; -std::chrono::seconds ResumeTimeout() { - return std::chrono::seconds(5); -} - } // namespace static PluginProperties &GetGlobalPluginProperties() { @@ -1184,11 +1180,10 @@ Status ProcessGDBRemote::WillResume() { return Status(); } -Status ProcessGDBRemote::DoResume(RunDirection direction) { +Status ProcessGDBRemote::DoResume() { Status error; Log *log = GetLog(GDBRLog::Process); - LLDB_LOGF(log, "ProcessGDBRemote::Resume(%s)", - direction == RunDirection::eRunForward ? "" : "reverse"); + LLDB_LOGF(log, "ProcessGDBRemote::Resume()"); ListenerSP listener_sp( Listener::MakeListener("gdb-remote.resume-packet-sent")); @@ -1202,21 +1197,12 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) { StreamString continue_packet; bool continue_packet_error = false; - // Number of threads continuing with "c", i.e. continuing without a signal to deliver. - const size_t num_continue_c_tids = m_continue_c_tids.size(); - // Number of threads continuing with "C", i.e. continuing with a signal to deliver. - const size_t num_continue_C_tids = m_continue_C_tids.size(); - // Number of threads continuing with "s", i.e. single-stepping. - const size_t num_continue_s_tids = m_continue_s_tids.size(); - // Number of threads continuing with "S", i.e. single-stepping with a signal to deliver. - const size_t num_continue_S_tids = m_continue_S_tids.size(); - if (direction == RunDirection::eRunForward && - m_gdb_comm.HasAnyVContSupport()) { + if (m_gdb_comm.HasAnyVContSupport()) { std::string pid_prefix; if (m_gdb_comm.GetMultiprocessSupported()) pid_prefix = llvm::formatv("p{0:x-}.", GetID()); - if (num_continue_c_tids == num_threads || + if (m_continue_c_tids.size() == num_threads || (m_continue_c_tids.empty() && m_continue_C_tids.empty() && m_continue_s_tids.empty() && m_continue_S_tids.empty())) { // All threads are continuing @@ -1279,11 +1265,14 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) { } else continue_packet_error = true; - if (direction == RunDirection::eRunForward && continue_packet_error) { + if (continue_packet_error) { // Either no vCont support, or we tried to use part of the vCont packet - // that wasn't supported by the remote GDB server, or it's the reverse - // direction. We need to try and make a simple packet that can do our - // continue. + // that wasn't supported by the remote GDB server. We need to try and + // make a simple packet that can do our continue + const size_t num_continue_c_tids = m_continue_c_tids.size(); + const size_t num_continue_C_tids = m_continue_C_tids.size(); + const size_t num_continue_s_tids = m_continue_s_tids.size(); + const size_t num_continue_S_tids = m_continue_S_tids.size(); if (num_continue_c_tids > 0) { if (num_continue_c_tids == num_threads) { // All threads are resuming... @@ -1374,41 +1363,9 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) { } } - if (direction == RunDirection::eRunReverse && continue_packet_error) { - if (num_continue_C_tids > 0 || num_continue_S_tids > 0) { - LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: Signals not supported"); - return Status::FromErrorString("can't deliver signals while running in reverse"); - } - - if (num_continue_s_tids > 0) { - if (num_continue_s_tids > 1) { - LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: can't step multiple threads"); - return Status::FromErrorString("can't step multiple threads while reverse-stepping"); - } - - if (!m_gdb_comm.GetReverseStepSupported()) { - LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: target does not support reverse-stepping"); - return Status::FromErrorString("target does not support reverse-stepping"); - } - - m_gdb_comm.SetCurrentThreadForRun(m_continue_s_tids.front()); - continue_packet.PutCString("bs"); - } else { - if (!m_gdb_comm.GetReverseContinueSupported()) { - LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: target does not support reverse-continue"); - return Status::FromErrorString("target does not support reverse-continue"); - } - - // All threads continue whether requested or not --- - // we can't change how threads ran in the past. - continue_packet.PutCString("bc"); - } - - continue_packet_error = false; - } - if (continue_packet_error) { - return Status::FromErrorString("can't make continue packet for this resume"); + error = + Status::FromErrorString("can't make continue packet for this resume"); } else { EventSP event_sp; if (!m_async_thread.IsJoinable()) { @@ -1423,7 +1380,7 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) { std::make_shared<EventDataBytes>(continue_packet.GetString()); m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue, data_sp); - if (!listener_sp->GetEvent(event_sp, ResumeTimeout())) { + if (!listener_sp->GetEvent(event_sp, std::chrono::seconds(5))) { error = Status::FromErrorString("Resume timed out."); LLDB_LOGF(log, "ProcessGDBRemote::DoResume: Resume timed out."); } else if (event_sp->BroadcasterIs(&m_async_broadcaster)) { @@ -1906,10 +1863,6 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo( thread_sp->SetStopInfo(StopInfo::CreateStopReasonWithException( *thread_sp, description.c_str())); handled = true; - } else if (reason == "replaylog") { - thread_sp->SetStopInfo(StopInfo::CreateStopReasonHistoryBoundary( - *thread_sp, description.c_str())); - handled = true; } else if (reason == "exec") { did_exec = true; thread_sp->SetStopInfo( @@ -2365,8 +2318,6 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) { description = std::string(ostr.GetString()); } else if (key.compare("swbreak") == 0 || key.compare("hwbreak") == 0) { reason = "breakpoint"; - } else if (key.compare("replaylog") == 0) { - reason = "replaylog"; } else if (key.compare("library") == 0) { auto error = LoadModules(); if (error) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index fa3e1cec76e2..249279585138 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -111,7 +111,7 @@ public: // Process Control Status WillResume() override; - Status DoResume(lldb::RunDirection direction) override; + Status DoResume() override; Status DoHalt(bool &caused_stop) override; diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp index 304c12173dd3..d2111ce877ce 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -182,15 +182,10 @@ void ScriptedProcess::DidResume() { m_pid = GetInterface().GetProcessID(); } -Status ScriptedProcess::DoResume(RunDirection direction) { +Status ScriptedProcess::DoResume() { LLDB_LOGF(GetLog(LLDBLog::Process), "ScriptedProcess::%s resuming process", __FUNCTION__); - if (direction == RunDirection::eRunForward) { - return GetInterface().Resume(); - } else { - return Status::FromErrorStringWithFormatv( - "error: {0} does not support reverse execution of processes", GetPluginName()); - } + return GetInterface().Resume(); } Status ScriptedProcess::DoAttach(const ProcessAttachInfo &attach_info) { diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h index 8ebe4ca5f3d4..0335364b4010 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -52,7 +52,7 @@ public: void DidResume() override; - Status DoResume(lldb::RunDirection direction) override; + Status DoResume() override; Status DoAttachToProcessWithID(lldb::pid_t pid, const ProcessAttachInfo &attach_info) override; |
