changeset 2192dac4ad82 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=2192dac4ad82
description:
        ARM: Make the ARM native tracer stop M5 if control diverges.
        If the control flow of M5's executable and statetrace's target process 
get out
        of sync even a little, there will be a LOT of output, very little of 
which
        will be useful. There's also almost no hope for recovery. In those 
cases, we
        might as well give up and not generate a huge, mostly worthless trace 
file.

diffstat:

3 files changed, 20 insertions(+), 1 deletion(-)
src/arch/arm/ArmNativeTrace.py |    2 ++
src/arch/arm/nativetrace.cc    |    5 +++++
src/arch/arm/nativetrace.hh    |   14 +++++++++++++-

diffs (56 lines):

diff -r 4836ec6b73a1 -r 2192dac4ad82 src/arch/arm/ArmNativeTrace.py
--- a/src/arch/arm/ArmNativeTrace.py    Wed Jul 29 00:15:26 2009 -0700
+++ b/src/arch/arm/ArmNativeTrace.py    Wed Jul 29 00:17:11 2009 -0700
@@ -33,3 +33,5 @@
 class ArmNativeTrace(NativeTrace):
     type = 'ArmNativeTrace'
     cxx_class = 'Trace::ArmNativeTrace'
+    stop_on_pc_error = Param.Bool(True,
+            "Stop M5 if it and statetrace's pcs are different")
diff -r 4836ec6b73a1 -r 2192dac4ad82 src/arch/arm/nativetrace.cc
--- a/src/arch/arm/nativetrace.cc       Wed Jul 29 00:15:26 2009 -0700
+++ b/src/arch/arm/nativetrace.cc       Wed Jul 29 00:17:11 2009 -0700
@@ -162,6 +162,11 @@
         }
         assert(inst);
         record->traceInst(inst, ran);
+
+        bool pcError = (mState.newState[STATE_PC] !=
+                        nState.newState[STATE_PC]);
+        if (stopOnPCError && pcError)
+            panic("Native trace detected an error in control flow!");
     }
 }
 
diff -r 4836ec6b73a1 -r 2192dac4ad82 src/arch/arm/nativetrace.hh
--- a/src/arch/arm/nativetrace.hh       Wed Jul 29 00:15:26 2009 -0700
+++ b/src/arch/arm/nativetrace.hh       Wed Jul 29 00:17:11 2009 -0700
@@ -33,6 +33,7 @@
 
 #include "base/types.hh"
 #include "cpu/nativetrace.hh"
+#include "params/ArmNativeTrace.hh"
 
 namespace Trace {
 
@@ -88,8 +89,19 @@
 
     ThreadState nState, mState;
 
+    bool stopOnPCError;
+
   public:
-    ArmNativeTrace(const Params *p) : NativeTrace(p)
+    typedef ArmNativeTraceParams Params;
+
+    const Params *
+    params() const
+    {
+        return dynamic_cast<const Params *>(_params);
+    }
+
+    ArmNativeTrace(const Params *p) :
+        NativeTrace(p), stopOnPCError(p->stop_on_pc_error)
     {}
 
     void check(NativeTraceRecord *record);
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to