Trace: Allow printing ASIDs and selectively tracing based on user/kernel code.
Debug flags are ExecUser, ExecKernel, and ExecAsid. ExecUser and ExecKernel are set by default when Exec is specified. Use minus sign with ExecUser or ExecKernel to remove user or kernel tracing respectively.
This commit is contained in:
parent
5299c75e62
commit
4bf48a11ef
9 changed files with 63 additions and 5 deletions
|
@ -29,7 +29,6 @@
|
|||
* Ali Saidi
|
||||
*/
|
||||
|
||||
#include "arch/alpha/ev5.hh"
|
||||
#include "arch/alpha/utility.hh"
|
||||
|
||||
#if FULL_SYSTEM
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "config/full_system.hh"
|
||||
#include "cpu/static_inst.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "arch/alpha/ev5.hh"
|
||||
|
||||
namespace AlphaISA {
|
||||
|
||||
|
@ -111,6 +112,12 @@ advancePC(PCState &pc, const StaticInstPtr inst)
|
|||
pc.advance();
|
||||
}
|
||||
|
||||
inline uint64_t
|
||||
getExecutingAsid(ThreadContext *tc)
|
||||
{
|
||||
return DTB_ASN_ASN(tc->readMiscRegNoEffect(IPR_DTB_ASN));
|
||||
}
|
||||
|
||||
} // namespace AlphaISA
|
||||
|
||||
#endif // __ARCH_ALPHA_UTILITY_HH__
|
||||
|
|
|
@ -173,7 +173,12 @@ advancePC(PCState &pc, const StaticInstPtr inst)
|
|||
Addr truncPage(Addr addr);
|
||||
Addr roundPage(Addr addr);
|
||||
|
||||
inline uint64_t
|
||||
getExecutingAsid(ThreadContext *tc)
|
||||
{
|
||||
return tc->readMiscReg(MISCREG_CONTEXTIDR);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -120,6 +120,12 @@ advancePC(PCState &pc, const StaticInstPtr inst)
|
|||
pc.advance();
|
||||
}
|
||||
|
||||
inline uint64_t
|
||||
getExecutingAsid(ThreadContext *tc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -78,6 +78,19 @@ advancePC(PCState &pc, const StaticInstPtr inst)
|
|||
pc.advance();
|
||||
}
|
||||
|
||||
static inline bool
|
||||
inUserMode(ThreadContext *tc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline uint64_t
|
||||
getExecutingAsid(ThreadContext *tc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace PowerISA
|
||||
|
||||
|
||||
#endif // __ARCH_POWER_UTILITY_HH__
|
||||
|
|
|
@ -94,6 +94,12 @@ advancePC(PCState &pc, const StaticInstPtr inst)
|
|||
inst->advancePC(pc);
|
||||
}
|
||||
|
||||
inline uint64_t
|
||||
getExecutingAsid(ThreadContext *tc)
|
||||
{
|
||||
return tc->readMiscRegNoEffect(MISCREG_MMU_P_CONTEXT);
|
||||
}
|
||||
|
||||
} // namespace SparcISA
|
||||
|
||||
#endif
|
||||
|
|
|
@ -102,6 +102,13 @@ namespace X86ISA
|
|||
{
|
||||
inst->advancePC(pc);
|
||||
}
|
||||
|
||||
inline uint64_t
|
||||
getExecutingAsid(ThreadContext *tc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // __ARCH_X86_UTILITY_HH__
|
||||
|
|
|
@ -168,6 +168,9 @@ TraceFlag('ExecThread')
|
|||
TraceFlag('ExecTicks')
|
||||
TraceFlag('ExecMicro')
|
||||
TraceFlag('ExecMacro')
|
||||
TraceFlag('ExecUser')
|
||||
TraceFlag('ExecKernel')
|
||||
TraceFlag('ExecAsid')
|
||||
TraceFlag('Fetch')
|
||||
TraceFlag('IntrControl')
|
||||
TraceFlag('PCEvent')
|
||||
|
@ -176,8 +179,11 @@ TraceFlag('Quiesce')
|
|||
CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
|
||||
'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
|
||||
'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
|
||||
'ExecTicks', 'ExecMicro', 'ExecMacro' ])
|
||||
'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
|
||||
'ExecAsid' ])
|
||||
CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
|
||||
'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting' ])
|
||||
'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
|
||||
'ExecUser', 'ExecKernel' ])
|
||||
CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
|
||||
'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting' ])
|
||||
'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
|
||||
'ExecUser', 'ExecKernel' ])
|
||||
|
|
|
@ -60,6 +60,12 @@ Trace::ExeTracerRecord::traceInst(StaticInstPtr inst, bool ran)
|
|||
{
|
||||
ostream &outs = Trace::output();
|
||||
|
||||
if (!Debug::ExecUser || !Debug::ExecKernel) {
|
||||
bool in_user_mode = TheISA::inUserMode(thread);
|
||||
if (in_user_mode && !Debug::ExecUser) return;
|
||||
if (!in_user_mode && !Debug::ExecKernel) return;
|
||||
}
|
||||
|
||||
if (Debug::ExecTicks)
|
||||
dumpTicks(outs);
|
||||
|
||||
|
@ -68,6 +74,9 @@ Trace::ExeTracerRecord::traceInst(StaticInstPtr inst, bool ran)
|
|||
if (Debug::ExecSpeculative)
|
||||
outs << (misspeculating ? "-" : "+") << " ";
|
||||
|
||||
if (Debug::ExecAsid)
|
||||
outs << "A" << dec << TheISA::getExecutingAsid(thread) << " ";
|
||||
|
||||
if (Debug::ExecThread)
|
||||
outs << "T" << thread->threadId() << " : ";
|
||||
|
||||
|
|
Loading…
Reference in a new issue