diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -575,6 +575,10 @@ /// of CommandObject like CommandObjectRaw, CommandObjectParsed, /// or CommandObjectMultiword. virtual CommandObject *GetPluginCommandObject() { return nullptr; } + + /// The underlying plugin might store the low-level communication history for + /// this session. Dump it into the provided stream. + virtual void DumpPluginHistory(Stream &s) { return; } /// Launch a new process. /// diff --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp --- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp +++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp @@ -744,6 +744,7 @@ } } } + thread.GetProcess()->DumpPluginHistory(s); llvm::report_fatal_error(s.GetData()); lldbassert( false && diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -457,7 +457,7 @@ if (log) { if (log->GetVerbose()) { StreamString strm; - gdb_comm.DumpHistory(strm); + process->DumpPluginHistory(strm); LLDB_LOGF(log, "error: failed to get packet sequence mutex, not sending " "write register for \"%s\":\n%s", @@ -566,7 +566,7 @@ if (log) { if (log->GetVerbose()) { StreamString strm; - gdb_comm.DumpHistory(strm); + process->DumpPluginHistory(strm); LLDB_LOGF(log, "error: failed to get packet sequence mutex, not sending " "read all registers:\n%s", @@ -741,7 +741,7 @@ if (log) { if (log->GetVerbose()) { StreamString strm; - gdb_comm.DumpHistory(strm); + process->DumpPluginHistory(strm); LLDB_LOGF(log, "error: failed to get packet sequence mutex, not sending " "write all registers:\n%s", diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -77,6 +77,8 @@ bool plugin_specified_by_name) override; CommandObject *GetPluginCommandObject() override; + + void DumpPluginHistory(Stream &s) override; // Creating a new process, or attaching to an existing one Status DoWillLaunch(Module *module) override; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -113,7 +113,7 @@ return; } StreamFile stream(std::move(file.get())); - ((ProcessGDBRemote *)p)->GetGDBRemote().DumpHistory(stream); + ((Process *)p)->DumpPluginHistory(stream); } } // namespace lldb @@ -205,6 +205,11 @@ return process_sp; } +void ProcessGDBRemote::DumpPluginHistory(Stream &s) { + GDBRemoteCommunicationClient &gdb_comm(GetGDBRemote()); + gdb_comm.DumpHistory(s); +} + std::chrono::seconds ProcessGDBRemote::GetPacketTimeout() { return std::chrono::seconds(GetGlobalPluginProperties().GetPacketTimeout()); } @@ -5217,7 +5222,7 @@ ProcessGDBRemote *process = (ProcessGDBRemote *)m_interpreter.GetExecutionContext().GetProcessPtr(); if (process) { - process->GetGDBRemote().DumpHistory(result.GetOutputStream()); + process->DumpPluginHistory(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); return true; }