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.
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")
}
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!");
}
}
#include "base/types.hh"
#include "cpu/nativetrace.hh"
+#include "params/ArmNativeTrace.hh"
namespace Trace {
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);