Index: lldb/docs/lldb-platform-packets.txt =================================================================== --- lldb/docs/lldb-platform-packets.txt +++ lldb/docs/lldb-platform-packets.txt @@ -369,7 +369,7 @@ // are the constant values in enum OpenOptions from lldb's File.h // 3. mode bits, base 16 // -// response is F followed by the opened file descriptor in base 10. +// response is F followed by the opened file descriptor in base 16. // "F-1,errno" with the errno if an error occurs. // //---------------------------------------------------------------------- @@ -383,7 +383,7 @@ // receive: vFile:close:7 // send: F0 // -// File descriptor is in base 10. +// File descriptor is in base 16. // "F-1,errno" with the errno if an error occurs. @@ -399,17 +399,12 @@ // send: F4;a'b\00 // // request packet has the fields: -// 1. file descriptor, base 10 -// 2. number of bytes to be read, base 10 -// 3. offset into file to start from, base 10 +// 1. file descriptor, base 16 +// 2. number of bytes to be read, base 16 +// 3. offset into file to start from, base 16 // -// Response is F, followed by the number of bytes read (base 10), a +// Response is F, followed by the number of bytes read (base 16), a // semicolon, followed by the data in the binary-escaped-data encoding. -// -// COMPATIBILITY -// The gdb-remote serial protocol documentation says that numbers -// in "vFile:" packets should be hexadecimal. Instead lldb uses -// decimal. //---------------------------------------------------------------------- @@ -424,16 +419,11 @@ // send: F1024 // // request packet has the fields: -// 1. file descriptor, base 10 -// 2. offset into file to start from, base 10 +// 1. file descriptor, base 16 +// 2. offset into file to start from, base 16 // 3. binary-escaped-data to be written // -// Response is F, followed by the number of bytes written (base 10) -// -// COMPATIBILITY -// The gdb-remote serial protocol documentation says that numbers -// in "vFile:" packets should be hexadecimal. Instead lldb uses -// decimal. +// Response is F, followed by the number of bytes written (base 16) Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -2959,7 +2959,7 @@ if (response.GetChar() != 'F') return Status("invalid response to '%s' packet", packet.str().c_str()); - return Status(response.GetU32(UINT32_MAX), eErrorTypePOSIX); + return Status(response.GetHexMaxU32(false, UINT32_MAX), eErrorTypePOSIX); } Status @@ -2980,7 +2980,7 @@ if (response.GetChar() != 'F') return Status("invalid response to '%s' packet", stream.GetData()); - return Status(response.GetU32(UINT32_MAX), eErrorTypePOSIX); + return Status(response.GetHexMaxU32(false, UINT32_MAX), eErrorTypePOSIX); } static uint64_t ParseHostIOPacketResponse(StringExtractorGDBRemote &response, @@ -2988,11 +2988,11 @@ response.SetFilePos(0); if (response.GetChar() != 'F') return fail_result; - int32_t result = response.GetS32(-2); + int32_t result = response.GetS32(-2, 16); if (result == -2) return fail_result; if (response.GetChar() == ',') { - int result_errno = response.GetS32(-2); + int result_errno = response.GetS32(-2, 16); if (result_errno != -2) error.SetError(result_errno, eErrorTypePOSIX); else @@ -3026,7 +3026,7 @@ bool GDBRemoteCommunicationClient::CloseFile(lldb::user_id_t fd, Status &error) { lldb_private::StreamString stream; - stream.Printf("vFile:close:%i", (int)fd); + stream.Printf("vFile:close:%x", (int)fd); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response) == PacketResult::Success) { @@ -3093,10 +3093,10 @@ error.SetErrorStringWithFormat("invalid response to '%s' packet", stream.GetData()); } else { - const uint32_t mode = response.GetS32(-1); + const uint32_t mode = response.GetS32(-1, 16); if (static_cast(mode) == -1) { if (response.GetChar() == ',') { - int response_errno = response.GetS32(-1); + int response_errno = response.GetS32(-1, 16); if (response_errno > 0) error.SetError(response_errno, lldb::eErrorTypePOSIX); else @@ -3119,7 +3119,7 @@ uint64_t dst_len, Status &error) { lldb_private::StreamString stream; - stream.Printf("vFile:pread:%i,%" PRId64 ",%" PRId64, (int)fd, dst_len, + stream.Printf("vFile:pread:%x,%" PRIx64 ",%" PRIx64, (int)fd, dst_len, offset); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response) == @@ -3153,7 +3153,7 @@ uint64_t src_len, Status &error) { lldb_private::StreamGDBRemote stream; - stream.Printf("vFile:pwrite:%i,%" PRId64 ",", (int)fd, offset); + stream.Printf("vFile:pwrite:%x,%" PRIx64 ",", (int)fd, offset); stream.PutEscapedBytes(src, src_len); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response) == @@ -3166,7 +3166,7 @@ if (bytes_written == UINT64_MAX) { error.SetErrorToGenericError(); if (response.GetChar() == ',') { - int response_errno = response.GetS32(-1); + int response_errno = response.GetS32(-1, 16); if (response_errno > 0) error.SetError(response_errno, lldb::eErrorTypePOSIX); } @@ -3194,11 +3194,11 @@ if (SendPacketAndWaitForResponse(stream.GetString(), response) == PacketResult::Success) { if (response.GetChar() == 'F') { - uint32_t result = response.GetU32(UINT32_MAX); + uint32_t result = response.GetHexMaxU32(false, UINT32_MAX); if (result != 0) { error.SetErrorToGenericError(); if (response.GetChar() == ',') { - int response_errno = response.GetS32(-1); + int response_errno = response.GetS32(-1, 16); if (response_errno > 0) error.SetError(response_errno, lldb::eErrorTypePOSIX); } @@ -3225,11 +3225,11 @@ if (SendPacketAndWaitForResponse(stream.GetString(), response) == PacketResult::Success) { if (response.GetChar() == 'F') { - uint32_t result = response.GetU32(UINT32_MAX); + uint32_t result = response.GetHexMaxU32(false, UINT32_MAX); if (result != 0) { error.SetErrorToGenericError(); if (response.GetChar() == ',') { - int response_errno = response.GetS32(-1); + int response_errno = response.GetS32(-1, 16); if (response_errno > 0) error.SetError(response_errno, lldb::eErrorTypePOSIX); } Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -522,9 +522,9 @@ StreamString response; response.PutChar('F'); - response.Printf("%i", descriptor); + response.Printf("%x", descriptor); if (save_errno) - response.Printf(",%i", save_errno); + response.Printf(",%x", save_errno); return SendPacketNoLock(response.GetString()); } } @@ -536,7 +536,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Close( StringExtractorGDBRemote &packet) { packet.SetFilePos(::strlen("vFile:close:")); - int fd = packet.GetS32(-1); + int fd = packet.GetS32(-1, 16); int err = -1; int save_errno = 0; if (fd >= 0) { @@ -549,9 +549,9 @@ } StreamString response; response.PutChar('F'); - response.Printf("%i", err); + response.Printf("%x", err); if (save_errno) - response.Printf(",%i", save_errno); + response.Printf(",%x", save_errno); return SendPacketNoLock(response.GetString()); } @@ -560,13 +560,13 @@ StringExtractorGDBRemote &packet) { StreamGDBRemote response; packet.SetFilePos(::strlen("vFile:pread:")); - int fd = packet.GetS32(-1); + int fd = packet.GetS32(-1, 16); if (packet.GetChar() == ',') { - size_t count = packet.GetU64(SIZE_MAX); + size_t count = packet.GetHexMaxU64(false, SIZE_MAX); if (packet.GetChar() == ',') { - off_t offset = packet.GetU64(UINT32_MAX); + off_t offset = packet.GetHexMaxU32(false, UINT32_MAX); if (count == SIZE_MAX) { - response.Printf("F-1:%i", EINVAL); + response.Printf("F-1:%x", EINVAL); return SendPacketNoLock(response.GetString()); } @@ -576,9 +576,9 @@ const ssize_t bytes_read = error.Success() ? count : -1; const int save_errno = error.GetError(); response.PutChar('F'); - response.Printf("%zi", bytes_read); + response.Printf("%zx", bytes_read); if (save_errno) - response.Printf(",%i", save_errno); + response.Printf(",%x", save_errno); else { response.PutChar(';'); response.PutEscapedBytes(&buffer[0], bytes_read); @@ -597,9 +597,9 @@ StreamGDBRemote response; response.PutChar('F'); - int fd = packet.GetU32(UINT32_MAX); + int fd = packet.GetS32(-1, 16); if (packet.GetChar() == ',') { - off_t offset = packet.GetU64(UINT32_MAX); + off_t offset = packet.GetHexMaxU32(false, UINT32_MAX); if (packet.GetChar() == ',') { std::string buffer; if (packet.GetEscapedBinaryData(buffer)) { @@ -609,11 +609,11 @@ file.Write(static_cast(&buffer[0]), count, offset); const ssize_t bytes_written = error.Success() ? count : -1; const int save_errno = error.GetError(); - response.Printf("%zi", bytes_written); + response.Printf("%zx", bytes_written); if (save_errno) - response.Printf(",%i", save_errno); + response.Printf(",%x", save_errno); } else { - response.Printf("-1,%i", EINVAL); + response.Printf("-1,%x", EINVAL); } return SendPacketNoLock(response.GetString()); } @@ -655,9 +655,9 @@ std::error_code ec; const uint32_t mode = FileSystem::Instance().GetPermissions(file_spec, ec); StreamString response; - response.Printf("F%u", mode); + response.Printf("F%x", mode); if (mode == 0 || ec) - response.Printf(",%i", (int)Status(ec).GetError()); + response.Printf(",%x", (int)Status(ec).GetError()); return SendPacketNoLock(response.GetString()); } return SendErrorResponse(23); @@ -697,7 +697,7 @@ Status error = FileSystem::Instance().Symlink(src_spec, FileSpec(dst)); StreamString response; - response.Printf("F%u,%u", error.GetError(), error.GetError()); + response.Printf("F%x,%x", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetString()); } @@ -709,7 +709,7 @@ packet.GetHexByteString(path); Status error(llvm::sys::fs::remove(path)); StreamString response; - response.Printf("F%u,%u", error.GetError(), error.GetError()); + response.Printf("F%x,%x", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetString()); } @@ -791,7 +791,7 @@ Status error(llvm::sys::fs::create_directory(path, mode)); StreamGDBRemote response; - response.Printf("F%u", error.GetError()); + response.Printf("F%x", error.GetError()); return SendPacketNoLock(response.GetString()); } @@ -811,7 +811,7 @@ Status error(llvm::sys::fs::setPermissions(path, perms)); StreamGDBRemote response; - response.Printf("F%u", error.GetError()); + response.Printf("F%x", error.GetError()); return SendPacketNoLock(response.GetString()); } Index: llvm/utils/lit/lit/main.py =================================================================== --- llvm/utils/lit/lit/main.py +++ llvm/utils/lit/lit/main.py @@ -171,7 +171,9 @@ random.shuffle(tests) else: assert order == TestOrder.DEFAULT, 'Unknown TestOrder value' + print([(x.previous_failure, -x.previous_elapsed, x.getFullName()) for x in tests]) tests.sort(key=lambda t: (not t.previous_failure, -t.previous_elapsed, t.getFullName())) + print([x.getFullName() for x in tests]) def filter_by_shard(tests, run, shards, lit_config):