Port: Stricter port bind/unbind semantics
[gem5.git] / src / cpu / exetrace.cc
index ea53fb6f5c42ceb4977444738b6b5ad548e9d307..fdefcc98053b97fc589ff7918b7f774176c0d9ac 100644 (file)
 
 #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;
@@ -56,35 +60,40 @@ Trace::ExeTracerRecord::traceInst(StaticInstPtr inst, bool ran)
 {
     ostream &outs = Trace::output();
 
-    if (IsOn(ExecTicks))
+    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)
-#if FULL_SYSTEM
-        && !inUserMode(thread)
-#endif
-        && 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 << "   ";
     }
@@ -96,26 +105,30 @@ Trace::ExeTracerRecord::traceInst(StaticInstPtr inst, bool ran)
     //
 
     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;
     }
 
@@ -136,19 +149,19 @@ Trace::ExeTracerRecord::dump()
      * 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) &&
+    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
 
 ////////////////////////////////////////////////////////////////////////
 //
@@ -158,4 +171,4 @@ Trace::ExeTracer *
 ExeTracerParams::create()
 {
     return new Trace::ExeTracer(this);
-};
+}