diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/pseudo_inst.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc index 12df08f2d..44fe2fcae 100644 --- a/src/sim/pseudo_inst.cc +++ b/src/sim/pseudo_inst.cc @@ -592,7 +592,6 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset, { DPRINTF(PseudoInst, "PseudoInst::writefile(0x%x, 0x%x, 0x%x, 0x%x)\n", vaddr, len, offset, filename_addr); - ostream *os; // copy out target filename char fn[100]; @@ -600,16 +599,18 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset, CopyStringOut(tc, fn, filename_addr, 100); filename = std::string(fn); + OutputStream *out; if (offset == 0) { // create a new file (truncate) - os = simout.create(filename, true, true); + out = simout.create(filename, true, true); } else { // do not truncate file if offset is non-zero // (ios::in flag is required as well to keep the existing data // intact, otherwise existing data will be zeroed out.) - os = simout.openFile(simout.directory() + filename, - ios::in | ios::out | ios::binary, true); + out = simout.open(filename, ios::in | ios::out | ios::binary, true); } + + ostream *os(out->stream()); if (!os) panic("could not open file %s\n", filename); @@ -623,7 +624,7 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset, if (os->fail() || os->bad()) panic("Error while doing writefile!\n"); - simout.close(os); + simout.close(out); delete [] buf; |