diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-13 19:26:17 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-13 19:26:17 +0000 | 
| commit | e75e363cb71a7339552b9d943e78ac62b737379b (patch) | |
| tree | 29ec5bd173694acbbcbb8207114ef7ca189436ba /source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | |
| parent | 1b306c26ade71504511d2fa75b03dfaee77f9620 (diff) | |
Notes
Diffstat (limited to 'source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
| -rw-r--r-- | source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 28 | 
1 files changed, 23 insertions, 5 deletions
| diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 33aed7a43c4a..e6fd386b903b 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -86,6 +86,7 @@ GDBRemoteCommunicationClient::GDBRemoteCommunicationClient()        m_supports_jLoadedDynamicLibrariesInfos(eLazyBoolCalculate),        m_supports_jGetSharedCacheInfo(eLazyBoolCalculate),        m_supports_QPassSignals(eLazyBoolCalculate), +      m_supports_error_string_reply(eLazyBoolCalculate),        m_supports_qProcessInfoPID(true), m_supports_qfProcessInfo(true),        m_supports_qUserName(true), m_supports_qGroupName(true),        m_supports_qThreadStopInfo(true), m_supports_z0(true), @@ -596,6 +597,21 @@ bool GDBRemoteCommunicationClient::GetThreadExtendedInfoSupported() {    return m_supports_jThreadExtendedInfo;  } +void GDBRemoteCommunicationClient::EnableErrorStringInPacket() { +  if (m_supports_error_string_reply == eLazyBoolCalculate) { +    StringExtractorGDBRemote response; +    // We try to enable error strings in remote packets +    // but if we fail, we just work in the older way. +    m_supports_error_string_reply = eLazyBoolNo; +    if (SendPacketAndWaitForResponse("QEnableErrorStrings", response, false) == +        PacketResult::Success) { +      if (response.IsOKResponse()) { +        m_supports_error_string_reply = eLazyBoolYes; +      } +    } +  } +} +  bool GDBRemoteCommunicationClient::GetLoadedDynamicLibrariesInfosSupported() {    if (m_supports_jLoadedDynamicLibrariesInfos == eLazyBoolCalculate) {      StringExtractorGDBRemote response; @@ -3181,8 +3197,8 @@ GDBRemoteCommunicationClient::SendStartTracePacket(const TraceOptions &options,                                     true) ==        GDBRemoteCommunication::PacketResult::Success) {      if (!response.IsNormalResponse()) { -      error.SetError(response.GetError(), eErrorTypeGeneric); -      LLDB_LOG(log, "Target does not support Tracing"); +      error = response.GetStatus(); +      LLDB_LOG(log, "Target does not support Tracing , error {0}", error);      } else {        ret_uid = response.GetHexMaxU64(false, LLDB_INVALID_UID);      } @@ -3219,7 +3235,7 @@ GDBRemoteCommunicationClient::SendStopTracePacket(lldb::user_id_t uid,                                     true) ==        GDBRemoteCommunication::PacketResult::Success) {      if (!response.IsOKResponse()) { -      error.SetError(response.GetError(), eErrorTypeGeneric); +      error = response.GetStatus();        LLDB_LOG(log, "stop tracing failed");      }    } else { @@ -3234,6 +3250,7 @@ GDBRemoteCommunicationClient::SendStopTracePacket(lldb::user_id_t uid,  Status GDBRemoteCommunicationClient::SendGetDataPacket(      lldb::user_id_t uid, lldb::tid_t thread_id,      llvm::MutableArrayRef<uint8_t> &buffer, size_t offset) { +    StreamGDBRemote escaped_packet;    escaped_packet.PutCString("jTraceBufferRead:");    return SendGetTraceDataPacket(escaped_packet, uid, thread_id, buffer, offset); @@ -3242,6 +3259,7 @@ Status GDBRemoteCommunicationClient::SendGetDataPacket(  Status GDBRemoteCommunicationClient::SendGetMetaDataPacket(      lldb::user_id_t uid, lldb::tid_t thread_id,      llvm::MutableArrayRef<uint8_t> &buffer, size_t offset) { +    StreamGDBRemote escaped_packet;    escaped_packet.PutCString("jTraceMetaRead:");    return SendGetTraceDataPacket(escaped_packet, uid, thread_id, buffer, offset); @@ -3308,7 +3326,7 @@ GDBRemoteCommunicationClient::SendGetTraceConfigPacket(lldb::user_id_t uid,                    custom_params_sp));        }      } else { -      error.SetError(response.GetError(), eErrorTypeGeneric); +      error = response.GetStatus();      }    } else {      LLDB_LOG(log, "failed to send packet"); @@ -3344,7 +3362,7 @@ Status GDBRemoteCommunicationClient::SendGetTraceDataPacket(        size_t filled_size = response.GetHexBytesAvail(buffer);        buffer = llvm::MutableArrayRef<uint8_t>(buffer.data(), filled_size);      } else { -      error.SetError(response.GetError(), eErrorTypeGeneric); +      error = response.GetStatus();        buffer = buffer.slice(buffer.size());      }    } else { | 
