@@ -52,10 +52,13 @@ 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." });
56+ p.addOption ({ " disable-console-dump" , " Configure reporter not to dump to console." });
5557 p.addOption ({ { " dump-registers" , " d-regs" }, " Dump registers state at program exit." });
5658 p.addOption ({ " dump-cache-stats" , " Dump cache statistics at program exit." });
5759 p.addOption ({ " dump-cycles" , " Dump number of CPU cycles till program end." });
5860 p.addOption ({ " dump-range" , " Dump memory range." , " START,LENGTH,FNAME" });
61+ p.addOption ({ " dump-symbol-table" , " Dump the symbol table." });
5962 p.addOption ({ " load-range" , " Load memory range." , " START,FNAME" });
6063 p.addOption ({ " expect-fail" , " Expect that program causes CPU trap and fail if it doesn't." });
6164 p.addOption ({ " fail-match" ,
@@ -139,7 +142,7 @@ void configure_cache(CacheConfig &cacheconf, const QStringList &cachearg, const
139142 cacheconf.set_write_policy (CacheConfig::WP_THROUGH_ALLOC);
140143 } else {
141144 fprintf (
142- stderr, " Write policy for %s cache is incorrect (correct wb/wt/wtna/wta). \n " ,
145+ stderr, " Write policy for %s cache is incorrect (correct wb/wt/wtna/wta).\n " ,
143146 qPrintable (which));
144147 exit (EXIT_FAILURE);
145148 }
@@ -161,7 +164,7 @@ void parse_u32_option(
161164 (config.*setter)(value);
162165 } else {
163166 fprintf (
164- stderr, " Value of option %s is not a valid unsigned integer." ,
167+ stderr, " Value of option %s is not a valid unsigned integer.\n " ,
165168 qPrintable (option_name));
166169 exit (EXIT_FAILURE);
167170 }
@@ -291,9 +294,13 @@ void configure_reporter(QCommandLineParser &p, Reporter &r, const SymbolTable *s
291294 r.dump_format = (DumpFormat)(r.dump_format | DumpFormat::JSON);
292295 r.dump_file_json = p.value (" dump-to-json" );
293296 }
297+ if (p.isSet (" disable-console-dump" )) {
298+ r.dump_format = (DumpFormat)(r.dump_format & ~(DumpFormat::CONSOLE));
299+ }
294300 if (p.isSet (" dump-registers" )) { r.enable_regs_reporting (); }
295301 if (p.isSet (" dump-cache-stats" )) { r.enable_cache_stats (); }
296302 if (p.isSet (" dump-cycles" )) { r.enable_cycles_reporting (); }
303+ if (p.isSet (" dump-symbol-table" )) { r.enable_symbol_table_reporting (); }
297304
298305 QStringList fail = p.values (" fail-match" );
299306 for (const auto & i : fail) {
@@ -542,6 +549,11 @@ int main(int argc, char *argv[]) {
542549
543550 load_ranges (machine, p.values (" load-range" ));
544551
545- machine.play ();
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+ }
546558 return QCoreApplication::exec ();
547559}
0 commit comments