aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-11-19 19:13:39 +0100
committerRaphael Isemann <teemperor@gmail.com>2020-11-19 19:14:04 +0100
commit47b7138b484b8fc94633ac4750a11acad797473e (patch)
treec76ca0b2a2e01fd12937b257bbaa84dcca5836b7 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parent41c9f4c1cea7314c0a6a32f2e59dab60cd575c1f (diff)
downloadllvm-47b7138b484b8fc94633ac4750a11acad797473e.zip
llvm-47b7138b484b8fc94633ac4750a11acad797473e.tar.gz
llvm-47b7138b484b8fc94633ac4750a11acad797473e.tar.bz2
[lldb] Fix incorrect error handling in GDBRemoteCommunicationClient::SendGetSupportedTraceType
GDBRemoteCommunicationClient::SendGetSupportedTraceType is checking whether the response is `!response.IsNormalResponse()` and infers from that that it is an error response. However, it could be either "unsupported" or "error". If we get an unsupported response, the code then tries to generate an llvm::Expected from the non-error response which then asserts. Debugserver doesn't implement `jLLDBTraceSupportedType`, so we get an unsupported response whenever this function is called on macOS. This fixes the TestAproposWithProcess on macOS (where the `apropos` command will query the CommandObjectTraceStart which then sends the trace type query package). Reviewed By: wallace, shafik Differential Revision: https://reviews.llvm.org/D91801
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index d661423..b1552a3 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3465,8 +3465,11 @@ GDBRemoteCommunicationClient::SendGetSupportedTraceType() {
if (SendPacketAndWaitForResponse(escaped_packet.GetString(), response,
true) ==
GDBRemoteCommunication::PacketResult::Success) {
- if (!response.IsNormalResponse())
+ if (response.IsErrorResponse())
return response.GetStatus().ToError();
+ if (response.IsUnsupportedResponse())
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "jLLDBTraceSupportedType is unsupported");
if (llvm::Expected<TraceTypeInfo> type =
llvm::json::parse<TraceTypeInfo>(response.Peek()))