Merge zizzer:/bk/m5 into zeep.eecs.umich.edu:/z/saidi/work/m5
[gem5.git] / sim / debug.cc
index bfc5c998703b74047b8d97a0b24a15f872043ff4..3467d16695e37687e13f8f62d380339b043235f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include <string>
 #include <vector>
 
-#include "debug.hh"
-#include "eventq.hh"
-#include "param.hh"
-#include "sim_events.hh"
+#include "sim/debug.hh"
+#include "sim/eventq.hh"
+#include "sim/param.hh"
+#include "sim/sim_events.hh"
 
 using namespace std;
 
 void
 debug_break()
 {
+#ifndef NDEBUG
     kill(getpid(), SIGTRAP);
+#else
+    cprintf("debug_break suppressed, compiled with NDEBUG\n");
+#endif
 }
 
 //
@@ -64,9 +68,10 @@ class DebugBreakEvent : public Event
 // constructor: schedule at specified time
 //
 DebugBreakEvent::DebugBreakEvent(EventQueue *q, Tick _when)
-    : Event(q)
+    : Event(q, Debug_Break_Pri)
 {
-    schedule(_when, -20000);
+    setFlags(AutoDelete);
+    schedule(_when);
 }
 
 //
@@ -76,7 +81,6 @@ void
 DebugBreakEvent::process()
 {
     debug_break();
-    delete this;
 }
 
 
@@ -125,11 +129,6 @@ extern "C" void sched_break_cycle(Tick when)
     new DebugBreakEvent(&mainEventQueue, when);
 }
 
-extern "C" void dump_stats()
-{
-    new DumpStatsEvent();
-}
-
 extern "C" void eventq_dump()
 {
     mainEventQueue.dump();