X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=cpu%2Fexetrace.cc;h=ff7e90c9ec670e79bb0be5a2a63584f469de9e41;hb=92533214b611cad77de99576867e6ed765cd5765;hp=c350288bcd0a344fc240eecf74822b6bff7269c9;hpb=de29fec658f6107c20a00c9c30111b253afafeac;p=gem5.git diff --git a/cpu/exetrace.cc b/cpu/exetrace.cc index c350288bc..ff7e90c9e 100644 --- a/cpu/exetrace.cc +++ b/cpu/exetrace.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 The Regents of The University of Michigan + * Copyright (c) 2001-2004 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,11 +48,10 @@ using namespace std; // -const SymbolTable *debugSymbolTable = NULL; - void Trace::InstRecord::dump(ostream &outs) { + if (flags[PRINT_CYCLE]) ccprintf(outs, "%7d: ", cycle); @@ -64,7 +63,18 @@ Trace::InstRecord::dump(ostream &outs) if (flags[PRINT_THREAD_NUM]) outs << "T" << thread << " : "; - outs << "0x" << hex << PC << " : "; + + 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 @@ -74,11 +84,11 @@ Trace::InstRecord::dump(ostream &outs) // There's a bug in gcc 2.x library that prevents setw() // from working properly on strings string mc(staticInst->disassemble(PC, debugSymbolTable)); - while (mc.length() < 25) + while (mc.length() < 26) mc += " "; outs << mc; #else - outs << setw(25) << staticInst->disassemble(PC, debugSymbolTable); + outs << setw(26) << left << staticInst->disassemble(PC, debugSymbolTable); #endif outs << " : "; @@ -120,7 +130,6 @@ Trace::InstRecord::dump(ostream &outs) // End of line... // outs << endl; - outs.flush(); }