ARM: Make native trace print out what instruction caused an error.
authorGabe Black <gblack@eecs.umich.edu>
Mon, 27 Jul 2009 07:54:09 +0000 (00:54 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Mon, 27 Jul 2009 07:54:09 +0000 (00:54 -0700)
src/arch/arm/nativetrace.cc
src/cpu/NativeTrace.py
src/cpu/nativetrace.cc
src/cpu/nativetrace.hh

index 2dd0b8575c2de60b0d9f82682d6893c1e5bd310b..7301653f426770d25ce659fe6a63cb1969bc6fc2 100644 (file)
@@ -86,6 +86,7 @@ Trace::ArmNativeTrace::check(NativeTraceRecord *record)
     nState.update(this);
     mState.update(record->getThread());
 
+    bool errorFound = false;
     // Regular int regs
     for (int i = 0; i < STATE_NUMVALS; i++) {
         if (nState.changed[i] || mState.changed[i]) {
@@ -104,6 +105,7 @@ Trace::ArmNativeTrace::check(NativeTraceRecord *record)
                                       vergence, regNames[i],
                                       nState.newState[i],
                                       mState.oldState[i], mState.newState[i]);
+                errorFound = true;
             } else if (!mState.changed[i]) {
                 DPRINTF(ExecRegDelta, "%s [%5s] "\
                                       "Native: %#010x => %#010x "\
@@ -111,6 +113,7 @@ Trace::ArmNativeTrace::check(NativeTraceRecord *record)
                                       vergence, regNames[i],
                                       nState.oldState[i], nState.newState[i],
                                       mState.newState[i]);
+                errorFound = true;
             } else if (mState.oldState[i] != nState.oldState[i] ||
                        mState.newState[i] != nState.newState[i]) {
                 DPRINTF(ExecRegDelta, "%s [%5s] "\
@@ -119,9 +122,21 @@ Trace::ArmNativeTrace::check(NativeTraceRecord *record)
                                       vergence, regNames[i],
                                       nState.oldState[i], nState.newState[i],
                                       mState.oldState[i], mState.newState[i]);
+                errorFound = true;
             }
         }
     }
+    if (errorFound) {
+        StaticInstPtr inst = record->getStaticInst();
+        assert(inst);
+        bool ran = true;
+        if (inst->isMicroop()) {
+            ran = false;
+            inst = record->getMacroStaticInst();
+        }
+        assert(inst);
+        record->traceInst(inst, ran);
+    }
 }
 
 } /* namespace Trace */
index 7fd240543b121c8456cafd856140a9b14278a613..dba6de06776aa97baa2a63b516009bdc06c8fe82 100644 (file)
@@ -28,9 +28,9 @@
 
 from m5.SimObject import SimObject
 from m5.params import *
-from InstTracer import InstTracer
+from ExeTracer import ExeTracer
 
-class NativeTrace(InstTracer):
+class NativeTrace(ExeTracer):
     abstract = True
     type = 'NativeTrace'
     cxx_class = 'Trace::NativeTrace'
index 47c58434f3c8e08ddc65aef395d40f07f719d369..8c17eb825fd58f05605bba78af7723abfe407792 100644 (file)
@@ -38,7 +38,7 @@ using namespace std;
 namespace Trace {
 
 NativeTrace::NativeTrace(const Params *p)
-    : InstTracer(p)
+    : ExeTracer(p)
 {
     if (ListenSocket::allDisabled())
         fatal("All listeners are disabled!");
index 34869f263d8f845a1356a924fa46852fd8c7a95f..6ad6b0242a897505aa30d97704352e3bc3979218 100644 (file)
@@ -37,8 +37,8 @@
 #include "base/socket.hh"
 #include "base/trace.hh"
 #include "base/types.hh"
+#include "cpu/exetrace.hh"
 #include "cpu/static_inst.hh"
-#include "sim/insttracer.hh"
 
 class ThreadContext;
 
@@ -46,7 +46,7 @@ namespace Trace {
 
 class NativeTrace;
 
-class NativeTraceRecord : public InstRecord
+class NativeTraceRecord : public ExeTracerRecord
 {
   protected:
     NativeTrace * parent;
@@ -56,7 +56,7 @@ class NativeTraceRecord : public InstRecord
                Tick _when, ThreadContext *_thread,
                const StaticInstPtr _staticInst, Addr _pc, bool spec,
                const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0)
-        : InstRecord(_when, _thread, _staticInst, _pc, spec,
+        : ExeTracerRecord(_when, _thread, _staticInst, _pc, spec,
                 _macroStaticInst, _upc),
         parent(_parent)
     {
@@ -65,7 +65,7 @@ class NativeTraceRecord : public InstRecord
     void dump();
 };
 
-class NativeTrace : public InstTracer
+class NativeTrace : public ExeTracer
 {
   protected:
     int fd;