base,sim: allow m5writeFile with stdout/stderr.
authorNils Asmussen <nils.asmussen@barkhauseninstitut.org>
Fri, 21 Feb 2020 12:58:04 +0000 (13:58 +0100)
committerNils Asmussen <nils.asmussen@barkhauseninstitut.org>
Fri, 8 May 2020 17:36:21 +0000 (17:36 +0000)
commit97d45c5dc70ab50e6273fbc3b812144de6a9dfff
tree749d67b21314df29f9c0275d42f8c27f81fe6bf7
parentf0f79fedf6384b24a0d0a1b1e615289728175a9e
base,sim: allow m5writeFile with stdout/stderr.

If m5writeFile opens stdout/stderr, no file is registered in
OutputDirectory and thus we don't want to search for it on close.

In order to write multiple times to stdout/stderr in a reasonable way,
we also want to prevent seeking. Thus, don't seek if the offset is 0, in
which case this would be a noop anyway (we just opened the file without
append).

Finally, it is helpful for debugging if the stream is flushed on every
write.

Change-Id: I102f82dcd2c63420b6f3fe55d67f03c62349e69d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28727
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/base/output.cc
src/sim/pseudo_inst.cc