sim, arch, base: Refactor the base remote GDB class.
[gem5.git] / src / sim / fd_array.cc
index d73707054cab0442e6d894cfef05319d83eaba44..7f3f7dd2478c7f7343b8a936f10de11577408999 100644 (file)
@@ -42,7 +42,7 @@
 #include <memory>
 #include <string>
 
-#include "base/misc.hh"
+#include "base/logging.hh"
 #include "params/Process.hh"
 #include "sim/fd_entry.hh"
 
@@ -131,8 +131,7 @@ FDArray::restoreFileOffsets()
      * possible to guarantee that the simulation will proceed as it should
      * have in the same way that it would have proceeded sans checkpoints.
      */
-    void (*seek)(std::shared_ptr<FileFDEntry>)
-        = [] (std::shared_ptr<FileFDEntry> ffd)
+    auto seek = [] (std::shared_ptr<FileFDEntry> ffd)
     {
         if (lseek(ffd->getSimFD(), ffd->getFileOffset(), SEEK_SET) < 0)
             fatal("Unable to seek to location in %s", ffd->getFileName());
@@ -322,6 +321,13 @@ FDArray::getFDEntry(int tgt_fd)
     return _fdArray[tgt_fd];
 }
 
+void
+FDArray::setFDEntry(int tgt_fd, std::shared_ptr<FDEntry> fdep)
+{
+    assert(0 <= tgt_fd && tgt_fd < _fdArray.size());
+    _fdArray[tgt_fd] = fdep;
+}
+
 int
 FDArray::closeFDEntry(int tgt_fd)
 {