Change exetrace code for working with my trace tool to use stream io rather than sprintf which was breaking on 64 bit hosts.

--HG--
extra : convert_revision : 184d751392dfcc8c80ac1a6c0ebc3061ff0a3f20
This commit is contained in:
Gabe Black 2006-11-10 04:11:46 -05:00
parent 4aea5deccb
commit 1d70dda6d7

View file

@ -68,7 +68,6 @@ Trace::InstRecord::dump(ostream &outs)
if (flags[PRINT_REG_DELTA]) if (flags[PRINT_REG_DELTA])
{ {
#if THE_ISA == SPARC_ISA #if THE_ISA == SPARC_ISA
#if 0
//Don't print what happens for each micro-op, just print out //Don't print what happens for each micro-op, just print out
//once at the last op, and for regular instructions. //once at the last op, and for regular instructions.
if(!staticInst->isMicroOp() || staticInst->isLastMicroOp()) if(!staticInst->isMicroOp() || staticInst->isLastMicroOp())
@ -84,23 +83,19 @@ Trace::InstRecord::dump(ostream &outs)
uint64_t newVal; uint64_t newVal;
static const char * prefixes[4] = {"G", "O", "L", "I"}; static const char * prefixes[4] = {"G", "O", "L", "I"};
char buf[256]; outs << hex;
sprintf(buf, "PC = 0x%016llx", thread->readNextPC()); outs << "PC = " << thread->readNextPC();
outs << buf; outs << " NPC = " << thread->readNextNPC();
sprintf(buf, " NPC = 0x%016llx", thread->readNextNPC());
outs << buf;
newVal = thread->readMiscReg(SparcISA::MISCREG_CCR); newVal = thread->readMiscReg(SparcISA::MISCREG_CCR);
if(newVal != ccr) if(newVal != ccr)
{ {
sprintf(buf, " CCR = 0x%016llx", newVal); outs << " CCR = " << newVal;
outs << buf;
ccr = newVal; ccr = newVal;
} }
newVal = thread->readMiscReg(SparcISA::MISCREG_Y); newVal = thread->readMiscReg(SparcISA::MISCREG_Y);
if(newVal != y) if(newVal != y)
{ {
sprintf(buf, " Y = 0x%016llx", newVal); outs << " Y = " << newVal;
outs << buf;
y = newVal; y = newVal;
} }
for(int y = 0; y < 4; y++) for(int y = 0; y < 4; y++)
@ -111,8 +106,7 @@ Trace::InstRecord::dump(ostream &outs)
newVal = thread->readIntReg(index); newVal = thread->readIntReg(index);
if(regs[index] != newVal) if(regs[index] != newVal)
{ {
sprintf(buf, " %s%d = 0x%016llx", prefixes[y], x, newVal); outs << " " << prefixes[y] << dec << x << " = " << hex << newVal;
outs << buf;
regs[index] = newVal; regs[index] = newVal;
} }
} }
@ -122,14 +116,12 @@ Trace::InstRecord::dump(ostream &outs)
newVal = thread->readFloatRegBits(2 * y, 64); newVal = thread->readFloatRegBits(2 * y, 64);
if(floats[y] != newVal) if(floats[y] != newVal)
{ {
sprintf(buf, " F%d = 0x%016llx", 2 * y, newVal); outs << " F" << dec << (2 * y) << " = " << hex << newVal;
outs << buf;
floats[y] = newVal; floats[y] = newVal;
} }
} }
outs << endl; outs << dec << endl;
} }
#endif
#endif #endif
} }
else if (flags[INTEL_FORMAT]) { else if (flags[INTEL_FORMAT]) {