#include <iomanip>
+#include "arch/isa_traits.hh"
+#include "arch/utility.hh"
#include "base/loader/symtab.hh"
+#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/exetrace.hh"
#include "cpu/static_inst.hh"
#include "cpu/thread_context.hh"
+#include "debug/ExecAll.hh"
#include "enums/OpClass.hh"
using namespace std;
namespace Trace {
+void
+ExeTracerRecord::dumpTicks(ostream &outs)
+{
+ ccprintf(outs, "%7d: ", when);
+}
+
void
Trace::ExeTracerRecord::traceInst(StaticInstPtr inst, bool ran)
{
ostream &outs = Trace::output();
- if (IsOn(ExecTicks))
- ccprintf(outs, "%7d: ", when);
+ 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);
outs << thread->getCpuPtr()->name() << " ";
- if (IsOn(ExecSpeculative))
+ if (Debug::ExecSpeculative)
outs << (misspeculating ? "-" : "+") << " ";
- if (IsOn(ExecThread))
+ if (Debug::ExecAsid)
+ outs << "A" << dec << TheISA::getExecutingAsid(thread) << " ";
+
+ if (Debug::ExecThread)
outs << "T" << thread->threadId() << " : ";
std::string sym_str;
Addr sym_addr;
- if (debugSymbolTable
- && IsOn(ExecSymbol)
- && debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr)) {
- if (PC != sym_addr)
- sym_str += csprintf("+%d", PC - sym_addr);
+ Addr cur_pc = pc.instAddr();
+ if (debugSymbolTable && Debug::ExecSymbol && !inUserMode(thread)
+ && debugSymbolTable->findNearestSymbol(cur_pc, sym_str, sym_addr)) {
+ if (cur_pc != sym_addr)
+ sym_str += csprintf("+%d",cur_pc - sym_addr);
outs << "@" << sym_str;
- }
- else {
- outs << "0x" << hex << PC;
+ } else {
+ outs << "0x" << hex << cur_pc;
}
if (inst->isMicroop()) {
- outs << "." << setw(2) << dec << upc;
+ outs << "." << setw(2) << dec << pc.microPC();
} else {
outs << " ";
}
//
outs << setw(26) << left;
- outs << inst->disassemble(PC, debugSymbolTable);
+ outs << inst->disassemble(cur_pc, debugSymbolTable);
if (ran) {
outs << " : ";
- if (IsOn(ExecOpClass)) {
+ if (Debug::ExecOpClass) {
outs << Enums::OpClassStrings[inst->opClass()] << " : ";
}
- if (IsOn(ExecResult) && data_status != DataInvalid) {
+ if (Debug::ExecResult && predicate == false) {
+ outs << "Predicated False";
+ }
+
+ if (Debug::ExecResult && data_status != DataInvalid) {
ccprintf(outs, " D=%#018x", data.as_int);
}
- if (IsOn(ExecEffAddr) && addr_valid)
+ if (Debug::ExecEffAddr && addr_valid)
outs << " A=0x" << hex << addr;
- if (IsOn(ExecFetchSeq) && fetch_seq_valid)
+ if (Debug::ExecFetchSeq && fetch_seq_valid)
outs << " FetchSeq=" << dec << fetch_seq;
- if (IsOn(ExecCPSeq) && cp_seq_valid)
+ if (Debug::ExecCPSeq && cp_seq_valid)
outs << " CPSeq=" << dec << cp_seq;
}
* finishes. Macroops then behave like regular instructions and don't
* complete/print when they fault.
*/
- if (IsOn(ExecMacro) && staticInst->isMicroop() &&
- (IsOn(ExecMicro) &&
- macroStaticInst && staticInst->isFirstMicroop()) ||
- (!IsOn(ExecMicro) &&
- macroStaticInst && staticInst->isLastMicroop())) {
+ if (Debug::ExecMacro && staticInst->isMicroop() &&
+ ((Debug::ExecMicro &&
+ macroStaticInst && staticInst->isFirstMicroop()) ||
+ (!Debug::ExecMicro &&
+ macroStaticInst && staticInst->isLastMicroop()))) {
traceInst(macroStaticInst, false);
}
- if (IsOn(ExecMicro) || !staticInst->isMicroop()) {
+ if (Debug::ExecMicro || !staticInst->isMicroop()) {
traceInst(staticInst, true);
}
}
-/* namespace Trace */ }
+} // namespace Trace
////////////////////////////////////////////////////////////////////////
//
ExeTracerParams::create()
{
return new Trace::ExeTracer(this);
-};
+}