diff options
author | David Spickett <david.spickett@linaro.org> | 2023-06-22 09:15:34 +0000 |
---|---|---|
committer | David Spickett <david.spickett@linaro.org> | 2023-06-30 09:12:30 +0000 |
commit | dfbe3a79e20f1bc51a59ee858fabce792d59c9ae (patch) | |
tree | 82c2ccedf88f7c654584ad311abfd6c3d8400005 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | |
parent | c442912d736946703b8a9278cb2e323c51dbefcb (diff) | |
download | llvm-dfbe3a79e20f1bc51a59ee858fabce792d59c9ae.zip llvm-dfbe3a79e20f1bc51a59ee858fabce792d59c9ae.tar.gz llvm-dfbe3a79e20f1bc51a59ee858fabce792d59c9ae.tar.bz2 |
[lldb] Check that qLaunchGDBServer packet does not return an error
While looking at https://github.com/llvm/llvm-project/issues/61955
I noticed that when we send qLaunchGDBServer we check that we got a response
but not what kind of response it was.
I think this was why the bug reporter saw:
(lldb) run
error: invalid host:port specification: '[192.168.64.2]'
The missing port is because we went down a path we only should have
chosen if the operation succeeded. Since we didn't check, we went ahead
with an empty port number.
To test this I've done the following:
* Make a temporary copy of lldb-server.
* Run that as a platform.
* Remove the copy.
* Attempt to create and run a target.
This fails because the running lldb-server will try to invoke itself
and it no longer exists.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D153513
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 18aa98bc..36e046d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -2590,6 +2590,9 @@ bool GDBRemoteCommunicationClient::LaunchGDBServer( if (SendPacketAndWaitForResponse(stream.GetString(), response) == PacketResult::Success) { + if (response.IsErrorResponse()) + return false; + llvm::StringRef name; llvm::StringRef value; while (response.GetNameColonValue(name, value)) { |