Fix the sampler for real this time
[gem5.git] / cpu / exetrace.cc
index e31c3590cd52e05c83a42e316faaee9dc67e9e37..ff7e90c9ec670e79bb0be5a2a63584f469de9e41 100644 (file)
@@ -48,8 +48,6 @@ using namespace std;
 //
 
 
-SymbolTable *debugSymbolTable = NULL;
-
 void
 Trace::InstRecord::dump(ostream &outs)
 {
@@ -66,11 +64,17 @@ Trace::InstRecord::dump(ostream &outs)
         outs << "T" << thread << " : ";
 
 
-    std::string str;
-    if ((debugSymbolTable) && (debugSymbolTable->findNearestSymbol(PC, str)))
-        outs << "@" << setw(17) << str << " : ";
-    else
+    std::string sym_str;
+    Addr sym_addr;
+    if (debugSymbolTable
+        && debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr)) {
+        if (PC != sym_addr)
+            sym_str += csprintf("+%d", PC - sym_addr);
+        outs << "@" << sym_str << " : ";
+    }
+    else {
         outs << "0x" << hex << PC << " : ";
+    }
 
     //
     //  Print decoded instruction