diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index f27573a2f9e..49cbeb023fd 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -113,6 +113,22 @@ GDBRemoteCommunicationServer::SendErrorResponse(const Status &error) { } GDBRemoteCommunication::PacketResult +GDBRemoteCommunicationServer::SendErrorResponse(llvm::Error error) { + std::unique_ptr<llvm::ErrorInfoBase> EIB; + std::unique_ptr<PacketUnimplementedError> PUE; + llvm::handleAllErrors( + std::move(error), + [&](std::unique_ptr<PacketUnimplementedError> E) { PUE = std::move(E); }, + [&](std::unique_ptr<llvm::ErrorInfoBase> E) { EIB = std::move(E); }); + + if (EIB) + return SendErrorResponse(Status(llvm::Error(std::move(EIB)))); + if (PUE) + return SendUnimplementedResponse(PUE->message().c_str()); + return SendErrorResponse(Status("Unknown Error")); +} + +GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServer::Handle_QErrorStringEnable( StringExtractorGDBRemote &packet) { m_send_error_strings = true; @@ -138,3 +154,5 @@ GDBRemoteCommunicationServer::SendOKResponse() { bool GDBRemoteCommunicationServer::HandshakeWithClient() { return GetAck() == PacketResult::Success; } + +char PacketUnimplementedError::ID; |