While the default option is to dump the Terminal content in a file (e.g.
m5out/system.terminal), with this patch it will be possible to choose to
dump it to standard output.
Change-Id: If51c2fd671fa3eb0867a855b5f7d3b0df9cad025
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20639
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
+# Copyright (c) 2019 ARM Limited
+# All rights reserved.
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder. You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
# Copyright (c) 2005-2007 The Regents of The University of Michigan
# All rights reserved.
#
from m5.objects.Serial import SerialDevice
+class TerminalDump(Enum): vals = ["none", "stdout", "stderr", "file"]
+
class Terminal(SerialDevice):
type = 'Terminal'
cxx_header = "dev/serial/terminal.hh"
port = Param.TcpPort(3456, "listen port")
number = Param.Int(0, "terminal number")
- output = Param.Bool(True, "Enable output dump to file")
+ outfile = Param.TerminalDump("file",
+ "Selects if and where the terminal is dumping its output")
/*
+ * Copyright (c) 2019 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
* Copyright (c) 2001-2005 The Regents of The University of Michigan
* All rights reserved.
*
Terminal::Terminal(const Params *p)
: SerialDevice(p), listenEvent(NULL), dataEvent(NULL),
number(p->number), data_fd(-1), txbuf(16384), rxbuf(16384),
- outfile(p->output ? simout.findOrCreate(p->name) : NULL)
+ outfile(terminalDump(p))
#if TRACING_ON == 1
, linebuf(16384)
#endif
delete dataEvent;
}
+OutputStream *
+Terminal::terminalDump(const TerminalParams* p)
+{
+ switch (p->outfile) {
+ case Enums::TerminalDump::none:
+ return nullptr;
+ case Enums::TerminalDump::stdout:
+ return simout.findOrCreate("stdout");
+ case Enums::TerminalDump::stderr:
+ return simout.findOrCreate("stderr");
+ case Enums::TerminalDump::file:
+ return simout.findOrCreate(p->name);
+ default:
+ panic("Invalid option\n");
+ }
+}
///////////////////////////////////////////////////////////////////////
// socket creation and terminal attach
/*
+ * Copyright (c) 2019 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
* Copyright (c) 2001-2005 The Regents of The University of Michigan
* All rights reserved.
*
typedef TerminalParams Params;
Terminal(const Params *p);
~Terminal();
+ OutputStream * terminalDump(const TerminalParams* p);
protected:
ListenSocket listener;