From 3f368b10e7cefb1b56aa73694f5894ba11d66382 Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 16 Apr 2022 21:20:13 +0100 Subject: [PATCH] Fixed bug in GDB Connection::read() function, where timeouts where being incorrectly treated as interrupts. --- src/DebugServer/Gdb/Connection.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/DebugServer/Gdb/Connection.cpp b/src/DebugServer/Gdb/Connection.cpp index 48bbba71..06ae6b7e 100644 --- a/src/DebugServer/Gdb/Connection.cpp +++ b/src/DebugServer/Gdb/Connection.cpp @@ -200,10 +200,12 @@ namespace Bloom::DebugServer::Gdb const auto eventFileDescriptor = this->epollInstance.waitForEvent(timeout); - if ( - !eventFileDescriptor.has_value() - || eventFileDescriptor.value() == this->interruptEventNotifier.getFileDescriptor() - ) { + if (!eventFileDescriptor.has_value()) { + // Timed out + return output; + } + + if (eventFileDescriptor.value() == this->interruptEventNotifier.getFileDescriptor()) { // Interrupted this->interruptEventNotifier.clear(); throw DebugServerInterrupted();