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.
This commit is contained in:
Gabe Black 2009-07-29 00:17:11 -07:00
parent 2871a13ab3
commit 1e04b6281d
3 changed files with 20 additions and 1 deletions

View file

@ -33,3 +33,5 @@ from NativeTrace import NativeTrace
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")

View file

@ -162,6 +162,11 @@ Trace::ArmNativeTrace::check(NativeTraceRecord *record)
}
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!");
}
}

View file

@ -33,6 +33,7 @@
#include "base/types.hh"
#include "cpu/nativetrace.hh"
#include "params/ArmNativeTrace.hh"
namespace Trace {
@ -88,8 +89,19 @@ class ArmNativeTrace : public NativeTrace
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);