This commit is contained in:
Nav
2021-12-22 23:11:18 +00:00
parent 3e0aebd9a1
commit bfea6b7c8f
4 changed files with 9 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ Checks: >
readability-*,
-modernize-use-trailing-return-type,
-modernize-avoid-bind,
-modernize-pass-by-value,
-readability-named-parameter,
-readability-magic-numbers,
-readability-convert-member-functions-to-static,

View File

@@ -419,17 +419,18 @@ void GdbRspDebugServer::waitForConnection() {
throw Exception("Failed to listen on server socket");
}
std::array<struct epoll_event, 5> events = {};
constexpr int maxEvents = 5;
std::array<struct epoll_event, maxEvents> events = {};
int eventCount = ::epoll_wait(
this->eventFileDescriptor,
events.data(),
5,
maxEvents,
-1
);
if (eventCount > 0) {
for (size_t i = 0; i < eventCount; i++) {
auto fileDescriptor = events[i].data.fd;
auto fileDescriptor = events.at(i).data.fd;
if (fileDescriptor == this->interruptEventNotifier->getFileDescriptor()) {
// Interrupted

View File

@@ -9,13 +9,9 @@ namespace Bloom::Exceptions
public:
explicit Exception(): std::runtime_error("") {}
explicit Exception(const std::string& message): std::runtime_error(message.c_str()) {
this->message = message;
}
explicit Exception(const std::string& message): std::runtime_error(message.c_str()), message(message) {}
explicit Exception(const char* message): std::runtime_error(message) {
this->message = std::string(message);
}
explicit Exception(const char* message): std::runtime_error(message), message(std::string(message)) {}
const char* what() const noexcept override {
return this->message.c_str();

View File

@@ -224,10 +224,9 @@ namespace Bloom
if (std::holds_alternative<SharedEventPointer<TargetControllerErrorOccurred>>(responseEvent.value())) {
auto& tcErrorEvent = std::get<SharedEventPointer<TargetControllerErrorOccurred>>(responseEvent.value());
throw Bloom::Exceptions::Exception(tcErrorEvent->errorMessage);
} else {
throw Bloom::Exceptions::Exception("Unexpected response from TargetController");
}
throw Bloom::Exceptions::Exception("Unexpected response from TargetController");
}
return std::get<SharedEventPointer<ResponseEventType>>(responseEvent.value());