Skip to content

Commit ff0c4fa

Browse files
mgschossmannppisa
authored andcommitted
CLI: Added CLI option to prevent program execution (and reordered some CLI options)
1 parent 3fadc20 commit ff0c4fa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/cli/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void create_parser(QCommandLineParser &p) {
5252
"all registers.",
5353
"REG" });
5454
p.addOption({ "dump-to-json", "Configure reportor dump to json file.", "FNAME" });
55+
p.addOption({ "only-dump", "Do not start the processor." });
5556
p.addOption({ "disable-console-dump", "Configure reporter not to dump to console." });
5657
p.addOption({ { "dump-registers", "d-regs" }, "Dump registers state at program exit." });
5758
p.addOption({ "dump-cache-stats", "Dump cache statistics at program exit." });
@@ -548,7 +549,11 @@ int main(int argc, char *argv[]) {
548549

549550
load_ranges(machine, p.values("load-range"));
550551

551-
// QTimer::singleShot(0, &machine, &Machine::play); alternative
552-
QMetaObject::invokeMethod(&machine, &Machine::play, Qt::QueuedConnection);
552+
if (p.isSet("only-dump")) {
553+
QMetaObject::invokeMethod(&machine, &Machine::program_exit, Qt::QueuedConnection);
554+
} else {
555+
// QTimer::singleShot(0, &machine, &Machine::play); alternative
556+
QMetaObject::invokeMethod(&machine, &Machine::play, Qt::QueuedConnection);
557+
}
553558
return QCoreApplication::exec();
554559
}

0 commit comments

Comments
 (0)