From bf296ca0643fa445b83d8bd45eefa3fca02d9921 Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Fri, 27 Mar 2020 10:25:20 +0000 Subject: Write execution logs to a named log file (#409) This patch adds a --log argument to spike. If not given, the behaviour is unchanged: messages logging execution of instructions and (if commit logging is enabled) commits go to stderr. If --log=P is given, Spike now writes these messages to a log file at the path P. This is nice, because they are no longer tangled up with other errors and warnings. The code is mostly plumbing: passing a FILE* object through to the functions that were using stderr. I've written a simple "log_file_t" class, which opens a log file if necessary and yields it or stderr. --- spike_main/spike-log-parser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spike_main/spike-log-parser.cc') diff --git a/spike_main/spike-log-parser.cc b/spike_main/spike-log-parser.cc index 5de6220..d174afc 100644 --- a/spike_main/spike-log-parser.cc +++ b/spike_main/spike-log-parser.cc @@ -27,7 +27,7 @@ int main(int argc, char** argv) parser.option(0, "isa", 1, [&](const char* s){isa = s;}); parser.parse(argv); - processor_t p(isa, DEFAULT_PRIV, DEFAULT_VARCH, 0, 0); + processor_t p(isa, DEFAULT_PRIV, DEFAULT_VARCH, 0, 0, false, nullptr); if (extension) { p.register_extension(extension()); } -- cgit v1.1