aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2020-10-09 11:23:17 +0200
committerPavel Labath <pavel@labath.sk>2020-10-12 13:46:17 +0200
commite2f1fe361a9c7616a1d6459b036d15f47da4a073 (patch)
treec692c3ce81370af66faccddf07e2f52014e495b5 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
parent8f1de22c7681a21fcdbe2d8c39de7698baab724a (diff)
downloadllvm-e2f1fe361a9c7616a1d6459b036d15f47da4a073.zip
llvm-e2f1fe361a9c7616a1d6459b036d15f47da4a073.tar.gz
llvm-e2f1fe361a9c7616a1d6459b036d15f47da4a073.tar.bz2
[lldb/Utility] Introduce UnimplementedError
This is essentially a replacement for the PacketUnimplementedError previously present in the gdb-remote server code. The reason I am introducing a generic error is because I wanted the native process classes to be able to signal that they do not support some functionality. They could not use PacketUnimplementedError as they are independent of a specific transport protocol. Putting the error class in the the native process code was also not ideal because the gdb-remote code is also used for lldb-server's platform mode, which does not (should not) know how to debug individual processes. I'm putting it under Utility, as I think it can be generally useful for notifying about unsupported/unimplemented functionality (and in particular, for programatically testing whether something is unsupported). Differential Revision: https://reviews.llvm.org/D89121
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index b78f091..60548ef 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -12,11 +12,11 @@
#include "GDBRemoteCommunicationServer.h"
-#include <cstring>
-
#include "ProcessGDBRemoteLog.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StringExtractorGDBRemote.h"
+#include "lldb/Utility/UnimplementedError.h"
+#include <cstring>
using namespace lldb;
using namespace lldb_private;
@@ -113,18 +113,17 @@ GDBRemoteCommunicationServer::SendErrorResponse(const Status &error) {
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServer::SendErrorResponse(llvm::Error error) {
+ assert(error);
std::unique_ptr<llvm::ErrorInfoBase> EIB;
- std::unique_ptr<PacketUnimplementedError> PUE;
+ std::unique_ptr<UnimplementedError> UE;
llvm::handleAllErrors(
std::move(error),
- [&](std::unique_ptr<PacketUnimplementedError> E) { PUE = std::move(E); },
+ [&](std::unique_ptr<UnimplementedError> E) { UE = 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"));
+ return SendUnimplementedResponse("");
}
GDBRemoteCommunication::PacketResult
@@ -152,5 +151,3 @@ GDBRemoteCommunicationServer::SendOKResponse() {
bool GDBRemoteCommunicationServer::HandshakeWithClient() {
return GetAck() == PacketResult::Success;
}
-
-char PacketUnimplementedError::ID;