blob: 62404145e14bdf39336b639a25d88bbc89de071d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <QCoreApplication>
#include <QCommandLineParser>
#include <iostream>
#include "tracer.h"
void create_parser(QCommandLineParser &p) {
p.setApplicationDescription("QtMips CLI machine simulator");
p.addHelpOption();
p.addVersionOption();
p.addPositionalArgument("FILE", "Input ELF executable file");
}
void configure_machine(QCommandLineParser &p, MachineConfig &cc) {
QStringList pa = p.positionalArguments();
if (pa.size() != 1) {
std::cerr << "Single ELF file has to be specified" << std::endl;
exit(1);
}
cc.set_elf(pa[0]);
// TODO
}
void configure_tracer(QCommandLineParser &p, Tracer &tr) {
// TODO
tr.reg_pc();
}
int main(int argc, char *argv[]) {
QCoreApplication app(argc, argv);
app.setApplicationName("qtmips_cli");
app.setApplicationVersion("0.1");
QCommandLineParser p;
create_parser(p);
p.process(app);
MachineConfig cc;
configure_machine(p, cc);
QtMipsMachine machine(cc);
app.connect(&machine, SIGNAL(program_exit()), &app, SLOT(quit()));
Tracer tr(&machine);
configure_tracer(p, tr);
machine.play(); // Run machine
return app.exec();
}
|