diff options
author | Pavel Labath <pavel@labath.sk> | 2025-01-31 09:07:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-31 09:07:11 +0100 |
commit | 13d0318a9848ec322ceea4f37fb6b421d70407b0 (patch) | |
tree | 10bc0882b54863e4fd0d900386885672fc75d871 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | |
parent | c242c7c13919ed273292d52fd464201105a76b53 (diff) | |
download | llvm-13d0318a9848ec322ceea4f37fb6b421d70407b0.zip llvm-13d0318a9848ec322ceea4f37fb6b421d70407b0.tar.gz llvm-13d0318a9848ec322ceea4f37fb6b421d70407b0.tar.bz2 |
[lldb] Add support for gdb-style 'x' packet (#124733)
See also
https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288
and https://sourceware.org/pipermail/gdb/2025-January/051705.html
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index b3f1c6f..581dd8f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -275,7 +275,6 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { m_supports_vCont_s = eLazyBoolCalculate; m_supports_vCont_S = eLazyBoolCalculate; m_supports_p = eLazyBoolCalculate; - m_supports_x = eLazyBoolCalculate; m_supports_QSaveRegisterState = eLazyBoolCalculate; m_qHostInfo_is_valid = eLazyBoolCalculate; m_curr_pid_is_valid = eLazyBoolCalculate; @@ -295,6 +294,7 @@ 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_x_packet_state.reset(); m_supports_qProcessInfoPID = true; m_supports_qfProcessInfo = true; m_supports_qUserName = true; @@ -348,6 +348,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_memory_tagging = eLazyBoolNo; m_supports_qSaveCore = eLazyBoolNo; m_uses_native_signals = eLazyBoolNo; + m_x_packet_state.reset(); m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if // not, we assume no limit @@ -401,6 +402,8 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_qSaveCore = eLazyBoolYes; else if (x == "native-signals+") m_uses_native_signals = eLazyBoolYes; + else if (x == "binary-upload+") + m_x_packet_state = xPacketState::Prefixed; // Look for a list of compressions in the features list e.g. // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib- // deflate,lzma @@ -715,19 +718,20 @@ Status GDBRemoteCommunicationClient::WriteMemoryTags( return status; } -bool GDBRemoteCommunicationClient::GetxPacketSupported() { - if (m_supports_x == eLazyBoolCalculate) { +GDBRemoteCommunicationClient::xPacketState +GDBRemoteCommunicationClient::GetxPacketState() { + if (!m_x_packet_state) + GetRemoteQSupported(); + if (!m_x_packet_state) { StringExtractorGDBRemote response; - m_supports_x = eLazyBoolNo; - char packet[256]; - snprintf(packet, sizeof(packet), "x0,0"); - if (SendPacketAndWaitForResponse(packet, response) == + m_x_packet_state = xPacketState::Unimplemented; + if (SendPacketAndWaitForResponse("x0,0", response) == PacketResult::Success) { if (response.IsOKResponse()) - m_supports_x = eLazyBoolYes; + m_x_packet_state = xPacketState::Bare; } } - return m_supports_x; + return *m_x_packet_state; } lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) { |