From 128ce1ee2115b54d43db1334e12410b1cc216f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 1 Jan 2018 20:43:42 +0100 Subject: cli: extend tracer and implement reporter --- qtmips_cli/reporter.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 qtmips_cli/reporter.h (limited to 'qtmips_cli/reporter.h') diff --git a/qtmips_cli/reporter.h b/qtmips_cli/reporter.h new file mode 100644 index 0000000..8dcc5f1 --- /dev/null +++ b/qtmips_cli/reporter.h @@ -0,0 +1,40 @@ +#ifndef REPORTER_H +#define REPORTER_H + +#include +#include +#include "qtmipsmachine.h" + +class Reporter : QObject { + Q_OBJECT +public: + Reporter(QCoreApplication *app, machine::QtMipsMachine *machine); + + void regs(); // Report status of registers + // TODO + + enum FailReason { + FR_I = (1<<0), // Unsupported Instruction + FR_A = (1<<1), // Unsupported ALU operation + FR_O = (1<<2), // Overflow/underflow of numerical operation + FR_J = (1<<3), // Unaligned jump + }; + static const enum FailReason FailAny = (enum FailReason)(FR_I | FR_A | FR_O | FR_J); + + void expect_fail(enum FailReason reason); + +private slots: + void machine_exit(); + void machine_trap(machine::QtMipsException &e); + +private: + QCoreApplication *app; + machine::QtMipsMachine *machine; + + bool e_regs; + enum FailReason e_fail; + + void report(); +}; + +#endif // REPORTER_H -- cgit v1.2.3