Removed EventNotifier object management from GDB Connection class
This commit is contained in:
@@ -116,7 +116,7 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Clear any previous interrupts that are still hanging around
|
// Clear any previous interrupts that are still hanging around
|
||||||
this->interruptEventNotifier->clear();
|
this->interruptEventNotifier.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,11 +135,11 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
|
|
||||||
if (eventCount > 0) {
|
if (eventCount > 0) {
|
||||||
for (size_t i = 0; i < eventCount; i++) {
|
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()) {
|
if (fileDescriptor == this->interruptEventNotifier.getFileDescriptor()) {
|
||||||
// Interrupted
|
// Interrupted
|
||||||
this->interruptEventNotifier->clear();
|
this->interruptEventNotifier.clear();
|
||||||
throw DebugServerInterrupted();
|
throw DebugServerInterrupted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
if (::epoll_ctl(
|
if (::epoll_ctl(
|
||||||
this->eventFileDescriptor,
|
this->eventFileDescriptor,
|
||||||
EPOLL_CTL_DEL,
|
EPOLL_CTL_DEL,
|
||||||
this->interruptEventNotifier->getFileDescriptor(),
|
this->interruptEventNotifier.getFileDescriptor(),
|
||||||
NULL) != 0
|
NULL) != 0
|
||||||
) {
|
) {
|
||||||
throw Exception("Failed to disable GDB client connection read interrupts - epoll_ctl failed");
|
throw Exception("Failed to disable GDB client connection read interrupts - epoll_ctl failed");
|
||||||
@@ -205,7 +205,7 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Connection::enableReadInterrupts() {
|
void Connection::enableReadInterrupts() {
|
||||||
auto interruptFileDescriptor = this->interruptEventNotifier->getFileDescriptor();
|
auto interruptFileDescriptor = this->interruptEventNotifier.getFileDescriptor();
|
||||||
struct epoll_event event = {};
|
struct epoll_event event = {};
|
||||||
event.events = EPOLLIN;
|
event.events = EPOLLIN;
|
||||||
event.data.fd = interruptFileDescriptor;
|
event.data.fd = interruptFileDescriptor;
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
class Connection
|
class Connection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Connection(std::shared_ptr<EventNotifier> interruptEventNotifier)
|
|
||||||
: interruptEventNotifier(std::move(interruptEventNotifier))
|
explicit Connection(EventNotifier& interruptEventNotifier)
|
||||||
|
: interruptEventNotifier(interruptEventNotifier)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +84,7 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
* The interruptEventNotifier allows us to interrupt blocking IO calls on the GDB debug server.
|
* The interruptEventNotifier allows us to interrupt blocking IO calls on the GDB debug server.
|
||||||
* Under the hood, this is just a wrapper for a Linux event notifier. See the EventNotifier class for more.
|
* Under the hood, this is just a wrapper for a Linux event notifier. See the EventNotifier class for more.
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<EventNotifier> interruptEventNotifier = nullptr;
|
EventNotifier& interruptEventNotifier;
|
||||||
bool readInterruptEnabled = false;
|
bool readInterruptEnabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user