@@ -275,7 +275,6 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
275275 m_supports_vCont_s = eLazyBoolCalculate;
276276 m_supports_vCont_S = eLazyBoolCalculate;
277277 m_supports_p = eLazyBoolCalculate;
278- m_supports_x = eLazyBoolCalculate;
279278 m_supports_QSaveRegisterState = eLazyBoolCalculate;
280279 m_qHostInfo_is_valid = eLazyBoolCalculate;
281280 m_curr_pid_is_valid = eLazyBoolCalculate;
@@ -295,6 +294,7 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
295294 m_supports_qXfer_siginfo_read = eLazyBoolCalculate;
296295 m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate;
297296 m_uses_native_signals = eLazyBoolCalculate;
297+ m_x_packet_state.reset ();
298298 m_supports_qProcessInfoPID = true ;
299299 m_supports_qfProcessInfo = true ;
300300 m_supports_qUserName = true ;
@@ -348,6 +348,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
348348 m_supports_memory_tagging = eLazyBoolNo;
349349 m_supports_qSaveCore = eLazyBoolNo;
350350 m_uses_native_signals = eLazyBoolNo;
351+ m_x_packet_state.reset ();
351352
352353 m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if
353354 // not, we assume no limit
@@ -401,6 +402,8 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
401402 m_supports_qSaveCore = eLazyBoolYes;
402403 else if (x == " native-signals+" )
403404 m_uses_native_signals = eLazyBoolYes;
405+ else if (x == " binary-upload+" )
406+ m_x_packet_state = xPacketState::Prefixed;
404407 // Look for a list of compressions in the features list e.g.
405408 // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib-
406409 // deflate,lzma
@@ -715,19 +718,20 @@ Status GDBRemoteCommunicationClient::WriteMemoryTags(
715718 return status;
716719}
717720
718- bool GDBRemoteCommunicationClient::GetxPacketSupported () {
719- if (m_supports_x == eLazyBoolCalculate) {
721+ GDBRemoteCommunicationClient::xPacketState
722+ GDBRemoteCommunicationClient::GetxPacketState () {
723+ if (!m_x_packet_state)
724+ GetRemoteQSupported ();
725+ if (!m_x_packet_state) {
720726 StringExtractorGDBRemote response;
721- m_supports_x = eLazyBoolNo;
722- char packet[256 ];
723- snprintf (packet, sizeof (packet), " x0,0" );
724- if (SendPacketAndWaitForResponse (packet, response) ==
727+ m_x_packet_state = xPacketState::Unimplemented;
728+ if (SendPacketAndWaitForResponse (" x0,0" , response) ==
725729 PacketResult::Success) {
726730 if (response.IsOKResponse ())
727- m_supports_x = eLazyBoolYes ;
731+ m_x_packet_state = xPacketState::Bare ;
728732 }
729733 }
730- return m_supports_x ;
734+ return *m_x_packet_state ;
731735}
732736
733737lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID (bool allow_lazy) {
0 commit comments