cpu: remove unnecessary data ptr from O3 internal read() funcs
[gem5.git] / src / sim / debug.cc
index e866c13e77f157dd88f1ae1e64567e8a4e69b5d1..9fab75108de50c2db024d0185f01afd026c985a6 100644 (file)
  *          Steve Reinhardt
  */
 
-#include <Python.h>
-
 #include <string>
 #include <vector>
 
 #include "base/debug.hh"
 #include "sim/debug.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
+#include "sim/global_event.hh"
 #include "sim/sim_events.hh"
+#include "sim/sim_exit.hh"
+#include "cpu/pc_event.hh"
+#include "sim/system.hh"
 
 using namespace std;
 
@@ -45,9 +47,9 @@ using namespace std;
 // Debug event: place a breakpoint on the process function and
 // schedule the event to break at a particular cycle
 //
-struct DebugBreakEvent : public Event
+struct DebugBreakEvent : public GlobalEvent
 {
-    DebugBreakEvent();
+    DebugBreakEvent(Tick when);
     void process();     // process event
     virtual const char *description() const;
 };
@@ -55,10 +57,9 @@ struct DebugBreakEvent : public Event
 //
 // constructor: schedule at specified time
 //
-DebugBreakEvent::DebugBreakEvent()
-    : Event(Debug_Break_Pri)
+DebugBreakEvent::DebugBreakEvent(Tick when)
+    : GlobalEvent(when, Debug_Break_Pri, AutoDelete)
 {
-    setFlags(AutoDelete);
 }
 
 //
@@ -82,33 +83,43 @@ DebugBreakEvent::description() const
 // (callable from debugger)
 //
 void
-schedBreakCycle(Tick when)
+schedBreak(Tick when)
 {
-    mainEventQueue.schedule(new DebugBreakEvent, when);
+    new DebugBreakEvent(when);
     warn("need to stop all queues");
 }
 
 void
-eventqDump()
+schedRelBreak(Tick delta)
+{
+    schedBreak(curTick() + delta);
+}
+
+void
+breakAtKernelFunction(const char* funcName)
 {
-    mainEventQueue.dump();
-    warn("need to dump all queues");
+    System* curSystem = System::systemList[0];
+    curSystem->addKernelFuncEvent<BreakPCEvent>(funcName,
+                                                "GDB scheduled break", true);
 }
 
+///
+/// Function to cause the simulator to take a checkpoint from the debugger
+///
 void
-py_interact()
+takeCheckpoint(Tick when)
+{
+    if (!when)
+        when = curTick() + 1;
+    exitSimLoop("checkpoint", 0, when, 0);
+}
+
+void
+eventqDump()
 {
-    PyObject *globals;
-    PyObject *locals;
-
-    globals = PyEval_GetGlobals();
-    Py_INCREF(globals);
-    locals = PyDict_New();
-    PyRun_String("import code", Py_file_input, globals, locals);
-    PyRun_String("code.interact(local=globals())", Py_file_input,
-                 globals, locals);
-    Py_DECREF(globals);
-    Py_DECREF(locals);
+    for (uint32_t i = 0; i < numMainEventQueues; ++i) {
+        mainEventQueue[i]->dump();
+    }
 }
 
 int remote_gdb_base_port = 7000;