summaryrefslogtreecommitdiff
path: root/src/cpu/exetrace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/exetrace.cc')
-rw-r--r--src/cpu/exetrace.cc82
1 files changed, 62 insertions, 20 deletions
diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc
index 0118dbde1..ea53fb6f5 100644
--- a/src/cpu/exetrace.cc
+++ b/src/cpu/exetrace.cc
@@ -46,12 +46,18 @@ using namespace TheISA;
namespace Trace {
void
-Trace::ExeTracerRecord::dump()
+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);
+ dumpTicks(outs);
outs << thread->getCpuPtr()->name() << " ";
@@ -59,46 +65,59 @@ Trace::ExeTracerRecord::dump()
outs << (misspeculating ? "-" : "+") << " ";
if (IsOn(ExecThread))
- outs << "T" << thread->getThreadNum() << " : ";
-
+ outs << "T" << thread->threadId() << " : ";
std::string sym_str;
Addr sym_addr;
if (debugSymbolTable
&& IsOn(ExecSymbol)
+#if FULL_SYSTEM
+ && !inUserMode(thread)
+#endif
&& debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr)) {
if (PC != sym_addr)
sym_str += csprintf("+%d", PC - sym_addr);
- outs << "@" << sym_str << " : ";
+ outs << "@" << sym_str;
}
else {
- outs << "0x" << hex << PC << " : ";
+ outs << "0x" << hex << PC;
}
+ if (inst->isMicroop()) {
+ outs << "." << setw(2) << dec << upc;
+ } else {
+ outs << " ";
+ }
+
+ outs << " : ";
+
//
// Print decoded instruction
//
outs << setw(26) << left;
- outs << staticInst->disassemble(PC, debugSymbolTable);
- outs << " : ";
+ outs << inst->disassemble(PC, debugSymbolTable);
- if (IsOn(ExecOpClass)) {
- outs << Enums::OpClassStrings[staticInst->opClass()] << " : ";
- }
+ if (ran) {
+ outs << " : ";
- if (IsOn(ExecResult) && data_status != DataInvalid) {
- ccprintf(outs, " D=%#018x", data.as_int);
- }
+ if (IsOn(ExecOpClass)) {
+ outs << Enums::OpClassStrings[inst->opClass()] << " : ";
+ }
+
+ if (IsOn(ExecResult) && data_status != DataInvalid) {
+ ccprintf(outs, " D=%#018x", data.as_int);
+ }
- if (IsOn(ExecEffAddr) && addr_valid)
- outs << " A=0x" << hex << addr;
+ if (IsOn(ExecEffAddr) && addr_valid)
+ outs << " A=0x" << hex << addr;
- if (IsOn(ExecFetchSeq) && fetch_seq_valid)
- outs << " FetchSeq=" << dec << fetch_seq;
+ if (IsOn(ExecFetchSeq) && fetch_seq_valid)
+ outs << " FetchSeq=" << dec << fetch_seq;
- if (IsOn(ExecCPSeq) && cp_seq_valid)
- outs << " CPSeq=" << dec << cp_seq;
+ if (IsOn(ExecCPSeq) && cp_seq_valid)
+ outs << " CPSeq=" << dec << cp_seq;
+ }
//
// End of line...
@@ -106,6 +125,29 @@ Trace::ExeTracerRecord::dump()
outs << endl;
}
+void
+Trace::ExeTracerRecord::dump()
+{
+ /*
+ * The behavior this check tries to achieve is that if ExecMacro is on,
+ * the macroop will be printed. If it's on and microops are also on, it's
+ * printed before the microops start printing to give context. If the
+ * microops aren't printed, then it's printed only when the final microop
+ * 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()))) {
+ traceInst(macroStaticInst, false);
+ }
+ if (IsOn(ExecMicro) || !staticInst->isMicroop()) {
+ traceInst(staticInst, true);
+ }
+}
+
/* namespace Trace */ }
////////////////////////////////////////////////////////////////////////