Author: Charles Zablit Date: 2026-06-08T12:49:05+01:00 New Revision: ff30f94035b465503b94dd807ca41a4adb8c85ec
URL: https://github.com/llvm/llvm-project/commit/ff30f94035b465503b94dd807ca41a4adb8c85ec DIFF: https://github.com/llvm/llvm-project/commit/ff30f94035b465503b94dd807ca41a4adb8c85ec.diff LOG: [lldb][gdb-remote] Plumb interrupt_timeout through SendStdinNotification (#201884) Added: Modified: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 391b2e6a78d66..8f7bf296e0d95 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1521,13 +1521,14 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) { return m_qHostInfo_is_valid == eLazyBoolYes; } -int GDBRemoteCommunicationClient::SendStdinNotification(const char *data, - size_t data_len) { +int GDBRemoteCommunicationClient::SendStdinNotification( + const char *data, size_t data_len, std::chrono::seconds interrupt_timeout) { StreamString packet; packet.PutCString("I"); packet.PutBytesAsRawHex8(data, data_len); StringExtractorGDBRemote response; - if (SendPacketAndWaitForResponse(packet.GetString(), response) == + if (SendPacketAndWaitForResponse(packet.GetString(), response, + interrupt_timeout) == PacketResult::Success) { return 0; } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index 235121d88c9a8..5fa7057be2625 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -128,10 +128,17 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase { /// \param[in] data_len /// The number of bytes available at \a data. /// + /// \param[in] interrupt_timeout + /// If the inferior is running, how long to wait for a `\x03` BREAK + /// to interrupt it before giving up. Pass zero only when the caller knows + /// the inferior is stopped. + /// /// \return /// Zero if the attach was successful, or an error indicating /// an error code. - int SendStdinNotification(const char *data, size_t data_len); + int SendStdinNotification( + const char *data, size_t data_len, + std::chrono::seconds interrupt_timeout = std::chrono::seconds(0)); /// Sets the path to use for stdin/out/err for a process /// that will be launched with the 'A' packet. diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index c21257113622a..77506275d3e13 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -3359,7 +3359,7 @@ size_t ProcessGDBRemote::PutSTDIN(const char *src, size_t src_len, ConnectionStatus status; m_stdio_communication.WriteAll(src, src_len, status, nullptr); } else if (m_stdin_forward) { - m_gdb_comm.SendStdinNotification(src, src_len); + m_gdb_comm.SendStdinNotification(src, src_len, GetInterruptTimeout()); } return 0; } _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
