diff --git a/.clang-tidy b/.clang-tidy index a39ab3a0..2eafd329 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -25,6 +25,10 @@ Checks: > -cppcoreguidelines-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes, -bugprone-easily-swappable-parameters, + +# Disabling this until https://github.com/llvm/llvm-project/issues/47384 is fixed. + -cppcoreguidelines-avoid-non-const-global-variables, + CheckOptions: - key: readability-function-cognitive-complexity.DescribeBasicIncrements value: 1 diff --git a/src/DebugServer/Gdb/Connection.cpp b/src/DebugServer/Gdb/Connection.cpp index 06ae6b7e..1aee5b08 100644 --- a/src/DebugServer/Gdb/Connection.cpp +++ b/src/DebugServer/Gdb/Connection.cpp @@ -184,19 +184,17 @@ namespace Bloom::DebugServer::Gdb std::array buffer = {}; ssize_t bytesRead = 0; - if (interruptible) { - if (this->readInterruptEnabled != interruptible) { + if (this->readInterruptEnabled != interruptible) { + if (interruptible) { this->enableReadInterrupts(); } else { - // Clear any previous interrupts that are still hanging around - this->interruptEventNotifier.clear(); + this->disableReadInterrupts(); } } - if (this->readInterruptEnabled != interruptible && !interruptible) { - this->disableReadInterrupts(); - } + // Clear any previous interrupts that are still hanging around + this->interruptEventNotifier.clear(); const auto eventFileDescriptor = this->epollInstance.waitForEvent(timeout); diff --git a/src/DebugServer/Gdb/GdbRspDebugServer.cpp b/src/DebugServer/Gdb/GdbRspDebugServer.cpp index 32f5e1b9..3ae2c070 100644 --- a/src/DebugServer/Gdb/GdbRspDebugServer.cpp +++ b/src/DebugServer/Gdb/GdbRspDebugServer.cpp @@ -133,7 +133,7 @@ namespace Bloom::DebugServer::Gdb auto connection = this->waitForConnection(); if (!connection.has_value()) { - // Likely an interrupt + // Likely an interrupt - return control to DebugServerComponent::run() so it can process any events return; } @@ -228,7 +228,7 @@ namespace Bloom::DebugServer::Gdb std::unique_ptr GdbRspDebugServer::resolveCommandPacket(const RawPacketType& rawPacket) { if (rawPacket.size() == 5 && rawPacket[1] == 0x03) { - // This is an interrupt request - create a fake packet for it + // Interrupt request return std::make_unique(rawPacket); } diff --git a/src/DebugServer/README.md b/src/DebugServer/README.md index 9fc35d30..56bd2cdd 100644 --- a/src/DebugServer/README.md +++ b/src/DebugServer/README.md @@ -42,7 +42,7 @@ Key points: [eventfd object](https://man7.org/linux/man-pages/man2/eventfd.2.html). It implements the [`NotifierInterface`](../Helpers/NotifierInterface.hpp). An event can be recorded against the eventfd object via a call to `EventFdNotifier::notify()`. -- The [`EventListener`](../EventManager/EventListener.hpp) class can accept an `NotifierInterface` object via +- The [`EventListener`](../EventManager/EventListener.hpp) class can accept a `NotifierInterface` object via `EventListener::setInterruptEventNotifier()`. If a `NotifierInterface` has been set on an `EventListener`, the `EventListener` will call `NotifierInterface::notify()` everytime an event is registered for that listener. - The `EpollInstance` class is an RAII wrapper for a Linux