projects
/
gem5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sort #includes
[gem5.git]
/
dev
/
simconsole.cc
diff --git
a/dev/simconsole.cc
b/dev/simconsole.cc
index a1505740239490b7385cd468b34e8ee4ce33626a..d8d890e15d69af42b059482558606535fefe7e8d 100644
(file)
--- a/
dev/simconsole.cc
+++ b/
dev/simconsole.cc
@@
-45,12
+45,11
@@
#include "base/misc.hh"
#include "base/socket.hh"
#include "base/trace.hh"
#include "base/misc.hh"
#include "base/socket.hh"
#include "base/trace.hh"
+#include "dev/platform.hh"
#include "dev/simconsole.hh"
#include "dev/simconsole.hh"
+#include "dev/uart.hh"
#include "mem/functional_mem/memory_control.hh"
#include "sim/builder.hh"
#include "mem/functional_mem/memory_control.hh"
#include "sim/builder.hh"
-#include "targetarch/ev5.hh"
-#include "dev/uart.hh"
-#include "dev/platform.hh"
using namespace std;
using namespace std;
@@
-72,27
+71,22
@@
SimConsole::Event::process(int revent)
cons->detach();
}
cons->detach();
}
-SimConsole::SimConsole(const string &name,
const string &file
, int num)
+SimConsole::SimConsole(const string &name,
std::ostream *os
, int num)
: SimObject(name), event(NULL), number(num), in_fd(-1), out_fd(-1),
: SimObject(name), event(NULL), number(num), in_fd(-1), out_fd(-1),
- listener(NULL), txbuf(16384), rxbuf(16384), outfile(
NULL
)
+ listener(NULL), txbuf(16384), rxbuf(16384), outfile(
os
)
#if TRACING_ON == 1
, linebuf(16384)
#endif
{
#if TRACING_ON == 1
, linebuf(16384)
#endif
{
- if (!file.empty())
- outfile = new ofstream(file.c_str());
-
if (outfile)
outfile->setf(ios::unitbuf);
if (outfile)
outfile->setf(ios::unitbuf);
-
}
SimConsole::~SimConsole()
{
close();
}
SimConsole::~SimConsole()
{
close();
-
if (outfile)
if (outfile)
-
delete outfile
;
+
closeOutputStream(outfile)
;
}
void
}
void
@@
-311,7
+305,7
@@
BEGIN_INIT_SIM_OBJECT_PARAMS(SimConsole)
INIT_PARAM(listener, "console listener"),
INIT_PARAM(intr_control, "interrupt controller"),
INIT_PARAM(listener, "console listener"),
INIT_PARAM(intr_control, "interrupt controller"),
- INIT_PARAM
_DFLT(output, "file to dump output to", "
"),
+ INIT_PARAM
(output, "file to dump output to
"),
INIT_PARAM_DFLT(append_name, "append name() to filename", true),
INIT_PARAM_DFLT(number, "console number", 0)
INIT_PARAM_DFLT(append_name, "append name() to filename", true),
INIT_PARAM_DFLT(number, "console number", 0)
@@
-319,18
+313,18
@@
END_INIT_SIM_OBJECT_PARAMS(SimConsole)
CREATE_SIM_OBJECT(SimConsole)
{
CREATE_SIM_OBJECT(SimConsole)
{
- string filename = output;
- if (filename.empty()) {
- if (!outputDirectory.empty())
- filename = outputDirectory + getInstanceName();
+ string filename;
+
+ if (!output.isValid()) {
+ filename = getInstanceName();
+ } else if (append_name) {
+ filename = (string)output + "." + getInstanceName();
} else {
} else {
- if (append_name)
- filename += "." + getInstanceName();
- if (!outputDirectory.empty())
- filename = outputDirectory + filename;
+ filename = output;
}
}
- SimConsole *console = new SimConsole(getInstanceName(), filename, number);
+ SimConsole *console = new SimConsole(getInstanceName(),
+ makeOutputStream(filename), number);
((ConsoleListener *)listener)->add(console);
return console;
((ConsoleListener *)listener)->add(console);
return console;