Skip to content

Commit c8a3e84

Browse files
committed
Trying to isolate the Win32 timeout.
1 parent 8141476 commit c8a3e84

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void DAP::Send(const Message &message) {
256256
if (auto *resp = std::get_if<Response>(&message);
257257
resp && debugger.InterruptRequested()) {
258258
// If the debugger was interrupted, convert this response into a 'cancelled'
259-
// response.
259+
// response because we might have a partial result.
260260
Response cancelled = CancelledResponse(resp->request_seq, resp->command);
261261
if (llvm::Error err = transport.Write(cancelled))
262262
DAP_LOG_ERROR(log, std::move(err), "({1}) write failed: {0}",

lldb/tools/lldb-dap/Handler/CancelRequestHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace lldb_dap {
4343
/// The progress that got cancelled still needs to send a `progressEnd` event
4444
/// back.
4545
///
46-
/// A client should not assume that progress just got cancelled after sending
46+
/// A client cannot assume that progress just got cancelled after sending
4747
/// the `cancel` request.
4848
llvm::Expected<CancelResponseBody>
4949
CancelRequestHandler::Run(const CancelArguments &arguments) const {

lldb/tools/lldb-dap/Transport.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,29 @@ ReadFull(IOObject &descriptor, size_t length,
3535
if (!descriptor.IsValid())
3636
return createStringError("transport output is closed");
3737

38-
SelectHelper sh;
38+
bool timeout_supported = true;
3939
// FIXME: SelectHelper does not work with NativeFile on Win32.
4040
#if _WIN32
41-
if (timeout && descriptor.GetFdType() == eFDTypeSocket)
42-
sh.SetTimeout(*timeout);
43-
#else
44-
if (timeout)
45-
sh.SetTimeout(*timeout);
41+
timeout_supported = descriptor.GetFdType() == eFDTypeSocket;
4642
#endif
47-
sh.FDSetRead(descriptor.GetWaitableHandle());
48-
Status status = sh.Select();
49-
if (status.Fail()) {
50-
// Convert timeouts into a specific error.
51-
if (status.GetType() == lldb::eErrorTypePOSIX &&
52-
status.GetError() == ETIMEDOUT)
53-
return make_error<TimeoutError>();
54-
return status.takeError();
43+
44+
if (timeout && timeout_supported) {
45+
SelectHelper sh;
46+
sh.SetTimeout(*timeout);
47+
sh.FDSetRead(descriptor.GetWaitableHandle());
48+
Status status = sh.Select();
49+
if (status.Fail()) {
50+
// Convert timeouts into a specific error.
51+
if (status.GetType() == lldb::eErrorTypePOSIX &&
52+
status.GetError() == ETIMEDOUT)
53+
return make_error<TimeoutError>();
54+
return status.takeError();
55+
}
5556
}
5657

5758
std::string data;
5859
data.resize(length);
59-
status = descriptor.Read(data.data(), length);
60+
Status status = descriptor.Read(data.data(), length);
6061
if (status.Fail())
6162
return status.takeError();
6263

0 commit comments

Comments
 (0)