aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2024-05-03 12:14:45 -0700
committerGitHub <noreply@github.com>2024-05-03 12:14:45 -0700
commitca8b064973b5bf31168a60b41ee9c071cf321777 (patch)
tree5ac4f94fdd2bddb361ea3d933563ea83ad62f83a /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parentf561daf989cfe011dd0edafc4621fac5ed421435 (diff)
downloadllvm-ca8b064973b5bf31168a60b41ee9c071cf321777.zip
llvm-ca8b064973b5bf31168a60b41ee9c071cf321777.tar.gz
llvm-ca8b064973b5bf31168a60b41ee9c071cf321777.tar.bz2
Revert "[lldb] Unify CalculateMD5 return types" (#90998)
Reverts llvm/llvm-project#90921
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index db9fb37..7498a070c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3418,8 +3418,8 @@ bool GDBRemoteCommunicationClient::GetFileExists(
return true;
}
-llvm::ErrorOr<llvm::MD5::MD5Result> GDBRemoteCommunicationClient::CalculateMD5(
- const lldb_private::FileSpec &file_spec) {
+bool GDBRemoteCommunicationClient::CalculateMD5(
+ const lldb_private::FileSpec &file_spec, uint64_t &low, uint64_t &high) {
std::string path(file_spec.GetPath(false));
lldb_private::StreamString stream;
stream.PutCString("vFile:MD5:");
@@ -3428,11 +3428,11 @@ llvm::ErrorOr<llvm::MD5::MD5Result> GDBRemoteCommunicationClient::CalculateMD5(
if (SendPacketAndWaitForResponse(stream.GetString(), response) ==
PacketResult::Success) {
if (response.GetChar() != 'F')
- return std::make_error_code(std::errc::illegal_byte_sequence);
+ return false;
if (response.GetChar() != ',')
- return std::make_error_code(std::errc::illegal_byte_sequence);
+ return false;
if (response.Peek() && *response.Peek() == 'x')
- return std::make_error_code(std::errc::no_such_file_or_directory);
+ return false;
// GDBRemoteCommunicationServerCommon::Handle_vFile_MD5 concatenates low and
// high hex strings. We can't use response.GetHexMaxU64 because that can't
@@ -3455,33 +3455,25 @@ llvm::ErrorOr<llvm::MD5::MD5Result> GDBRemoteCommunicationClient::CalculateMD5(
auto part =
response.GetStringRef().substr(response.GetFilePos(), MD5_HALF_LENGTH);
if (part.size() != MD5_HALF_LENGTH)
- return std::make_error_code(std::errc::illegal_byte_sequence);
+ return false;
response.SetFilePos(response.GetFilePos() + part.size());
- uint64_t low;
if (part.getAsInteger(/*radix=*/16, low))
- return std::make_error_code(std::errc::illegal_byte_sequence);
+ return false;
// Get high part
part =
response.GetStringRef().substr(response.GetFilePos(), MD5_HALF_LENGTH);
if (part.size() != MD5_HALF_LENGTH)
- return std::make_error_code(std::errc::illegal_byte_sequence);
+ return false;
response.SetFilePos(response.GetFilePos() + part.size());
- uint64_t high;
if (part.getAsInteger(/*radix=*/16, high))
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- llvm::MD5::MD5Result result;
- llvm::support::endian::write<uint64_t, llvm::endianness::little>(
- result.data(), low);
- llvm::support::endian::write<uint64_t, llvm::endianness::little>(
- result.data() + 8, high);
+ return false;
- return result;
+ return true;
}
- return std::make_error_code(std::errc::operation_canceled);
+ return false;
}
bool GDBRemoteCommunicationClient::AvoidGPackets(ProcessGDBRemote *process) {