sim, arch, base: Refactor the base remote GDB class.
[gem5.git] / src / sim / sim_object.hh
index 17714740bc2a5a0ba4c4ff2e2376449846e4d936..42a19bbe7cc8ddfafca16a960a6ee96dac01c008 100644 (file)
 #ifndef __SIM_OBJECT_HH__
 #define __SIM_OBJECT_HH__
 
-#include <iostream>
-#include <list>
-#include <map>
 #include <string>
 #include <vector>
 
-#include "enums/MemoryMode.hh"
 #include "params/SimObject.hh"
 #include "sim/drain.hh"
+#include "sim/eventq.hh"
 #include "sim/eventq_impl.hh"
 #include "sim/serialize.hh"
 
-class BaseCPU;
-class Event;
+class EventManager;
 class ProbeManager;
+
 /**
  * Abstract superclass for simulation objects.  Represents things that
  * correspond to physical components and can be specified via the
@@ -181,11 +178,10 @@ class SimObject : public EventManager, public Serializable, public Drainable
     virtual void startup();
 
     /**
-     * Provide a default implementation of the drain interface that
-     * simply returns 0 (draining completed) and sets the drain state
-     * to Drained.
+     * Provide a default implementation of the drain interface for
+     * objects that don't need draining.
      */
-    unsigned int drain(DrainManager *drainManger);
+    DrainState drain() override { return DrainState::Drained; }
 
     /**
      * Write back dirty buffers to memory using functional writes.
@@ -210,8 +206,8 @@ class SimObject : public EventManager, public Serializable, public Drainable
      */
     virtual void memInvalidate() {};
 
-    void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE {};
-    void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE {};
+    void serialize(CheckpointOut &cp) const override {};
+    void unserialize(CheckpointIn &cp) override {};
 
     /**
      * Serialize all SimObjects in the system.
@@ -232,6 +228,21 @@ class SimObject : public EventManager, public Serializable, public Drainable
     static SimObject *find(const char *name);
 };
 
+/**
+ * Base class to wrap object resolving functionality.
+ *
+ * This can be provided to the serialization framework to allow it to
+ * map object names onto C++ objects.
+ */
+class SimObjectResolver
+{
+  public:
+    virtual ~SimObjectResolver() { }
+
+    // Find a SimObject given a full path name
+    virtual SimObject *resolveSimObject(const std::string &name) = 0;
+};
+
 #ifdef DEBUG
 void debugObjectBreak(const char *objs);
 #endif