Abort system calls on reset
The application could go into an undefined state if reset was pressed during the execution of a syscall, i.e., I/O reading.
MODIFY
src/processorhandler.cpp
src/processorhandler.cpp
@@ -240,6 +240,7 @@ void ProcessorHandler::_reset() {
return;
}
+ SystemIO::abortSyscall();
getProcessorNonConst()->resetProcessor();
// Rewrite register initializations
@@ -378,7 +379,7 @@ void ProcessorHandler::setStopRunFlag() {
if (m_runWatcher.isRunning()) {
m_stopRunningFlag = true;
// We might be currently trapping for user I/O. Signal to abort the trap, in this avoiding a deadlock.
- SystemIO::abortSyscall(true);
+ SystemIO::abortSyscall();
}
}
@@ -386,7 +387,6 @@ void ProcessorHandler::_stopRun() {
setStopRunFlag();
m_runWatcher.waitForFinished();
m_stopRunningFlag = false;
- SystemIO::abortSyscall(false);
}
bool ProcessorHandler::_isExecutableAddress(AInt address) const {

MODIFY
src/syscall/systemio.h
src/syscall/systemio.h
@@ -312,6 +312,7 @@ public:
* @return number of bytes read, 0 on EOF, or -1 on error
*/
static int readFromFile(int fd, QByteArray& myBuffer, int lengthRequested) {
+ s_abortSyscall = false; // Reset any stale abort requests
SystemIO::get(); // Ensure that SystemIO is constructed
/////////////// DPS 8-Jan-2013 //////////////////////////////////////////////////
/// Read from STDIN file descriptor while using IDE - get input from Messages pane.
@@ -404,7 +405,7 @@ public:
static void printString(const QString& string) { emit get().doPrint(string); }
static void reset() { FileIOData::resetFiles(); }
- static void abortSyscall(bool state) { s_abortSyscall = state; }
+ static void abortSyscall() { s_abortSyscall = true; }
signals:
void doPrint(const QString&);

Abort system calls on reset

The application could go into an undefined state if reset was pressed during the execution of a syscall, i.e., I/O reading.