exetrace.cc (3059:470bc7016218) exetrace.cc (3064:e907dd767a63)
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 52 unchanged lines hidden (view full) ---

61 0, 0, 0, 0, 0, 0, 0, 0};
62 static uint64_t ccr = 0;
63 static uint64_t y = 0;
64 static uint64_t floats[32];
65 uint64_t newVal;
66 static const char * prefixes[4] = {"G", "O", "L", "I"};
67 if (flags[PRINT_REG_DELTA])
68 {
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 52 unchanged lines hidden (view full) ---

61 0, 0, 0, 0, 0, 0, 0, 0};
62 static uint64_t ccr = 0;
63 static uint64_t y = 0;
64 static uint64_t floats[32];
65 uint64_t newVal;
66 static const char * prefixes[4] = {"G", "O", "L", "I"};
67 if (flags[PRINT_REG_DELTA])
68 {
69 ThreadContext * context = cpu->threadContexts[0];
70 char buf[256];
69 char buf[256];
71 sprintf(buf, "PC = 0x%016llx", context->readNextPC());
70 sprintf(buf, "PC = 0x%016llx", thread->readNextPC());
72 outs << buf;
71 outs << buf;
73 sprintf(buf, " NPC = 0x%016llx", context->readNextNPC());
72 sprintf(buf, " NPC = 0x%016llx", thread->readNextNPC());
74 outs << buf;
73 outs << buf;
75 newVal = context->readMiscReg(SparcISA::MISCREG_CCR);
74 newVal = thread->readMiscReg(SparcISA::MISCREG_CCR);
76 if(newVal != ccr)
77 {
78 sprintf(buf, " CCR = 0x%016llx", newVal);
79 outs << buf;
80 ccr = newVal;
81 }
75 if(newVal != ccr)
76 {
77 sprintf(buf, " CCR = 0x%016llx", newVal);
78 outs << buf;
79 ccr = newVal;
80 }
82 newVal = context->readMiscReg(SparcISA::MISCREG_Y);
81 newVal = thread->readMiscReg(SparcISA::MISCREG_Y);
83 if(newVal != y)
84 {
85 sprintf(buf, " Y = 0x%016llx", newVal);
86 outs << buf;
87 y = newVal;
88 }
89 for(int y = 0; y < 4; y++)
90 {
91 for(int x = 0; x < 8; x++)
92 {
93 int index = x + 8 * y;
82 if(newVal != y)
83 {
84 sprintf(buf, " Y = 0x%016llx", newVal);
85 outs << buf;
86 y = newVal;
87 }
88 for(int y = 0; y < 4; y++)
89 {
90 for(int x = 0; x < 8; x++)
91 {
92 int index = x + 8 * y;
94 newVal = context->readIntReg(index);
93 newVal = thread->readIntReg(index);
95 if(regs[index] != newVal)
96 {
97 sprintf(buf, " %s%d = 0x%016llx", prefixes[y], x, newVal);
98 outs << buf;
99 regs[index] = newVal;
100 }
101 }
102 }
103 for(int y = 0; y < 32; y++)
104 {
94 if(regs[index] != newVal)
95 {
96 sprintf(buf, " %s%d = 0x%016llx", prefixes[y], x, newVal);
97 outs << buf;
98 regs[index] = newVal;
99 }
100 }
101 }
102 for(int y = 0; y < 32; y++)
103 {
105 newVal = context->readFloatRegBits(2 * y, 64);
104 newVal = thread->readFloatRegBits(2 * y, 64);
106 if(floats[y] != newVal)
107 {
108 sprintf(buf, " F%d = 0x%016llx", y, newVal);
109 outs << buf;
110 floats[y] = newVal;
111 }
112 }
113 outs << endl;
105 if(floats[y] != newVal)
106 {
107 sprintf(buf, " F%d = 0x%016llx", y, newVal);
108 outs << buf;
109 floats[y] = newVal;
110 }
111 }
112 outs << endl;
114 /*
115 int numSources = staticInst->numSrcRegs();
116 int numDests = staticInst->numDestRegs();
117 outs << "Sources:";
118 for(int x = 0; x < numSources; x++)
119 {
120 int sourceNum = staticInst->srcRegIdx(x);
121 if(sourceNum < FP_Base_DepTag)
122 outs << " " << getIntRegName(sourceNum);
123 else if(sourceNum < Ctrl_Base_DepTag)
124 outs << " " << getFloatRegName(sourceNum - FP_Base_DepTag);
125 else
126 outs << " " << getMiscRegName(sourceNum - Ctrl_Base_DepTag);
127 }
128 outs << endl;
129 outs << "Destinations:";
130 for(int x = 0; x < numDests; x++)
131 {
132 int destNum = staticInst->destRegIdx(x);
133 if(destNum < FP_Base_DepTag)
134 outs << " " << getIntRegName(destNum);
135 else if(destNum < Ctrl_Base_DepTag)
136 outs << " " << getFloatRegName(destNum - FP_Base_DepTag);
137 else
138 outs << " " << getMiscRegName(destNum - Ctrl_Base_DepTag);
139 }
140 outs << endl;*/
141 }
142 else if (flags[INTEL_FORMAT]) {
143#if FULL_SYSTEM
113 }
114 else if (flags[INTEL_FORMAT]) {
115#if FULL_SYSTEM
144 bool is_trace_system = (cpu->system->name() == trace_system);
116 bool is_trace_system = (thread->getCpuPtr()->system->name() == trace_system);
145#else
146 bool is_trace_system = true;
147#endif
148 if (is_trace_system) {
149 ccprintf(outs, "%7d ) ", cycle);
150 outs << "0x" << hex << PC << ":\t";
151 if (staticInst->isLoad()) {
152 outs << "<RD 0x" << hex << addr;
153 outs << ">";
154 } else if (staticInst->isStore()) {
155 outs << "<WR 0x" << hex << addr;
156 outs << ">";
157 }
158 outs << endl;
159 }
160 } else {
161 if (flags[PRINT_CYCLE])
162 ccprintf(outs, "%7d: ", cycle);
163
117#else
118 bool is_trace_system = true;
119#endif
120 if (is_trace_system) {
121 ccprintf(outs, "%7d ) ", cycle);
122 outs << "0x" << hex << PC << ":\t";
123 if (staticInst->isLoad()) {
124 outs << "<RD 0x" << hex << addr;
125 outs << ">";
126 } else if (staticInst->isStore()) {
127 outs << "<WR 0x" << hex << addr;
128 outs << ">";
129 }
130 outs << endl;
131 }
132 } else {
133 if (flags[PRINT_CYCLE])
134 ccprintf(outs, "%7d: ", cycle);
135
164 outs << cpu->name() << " ";
136 outs << thread->getCpuPtr()->name() << " ";
165
166 if (flags[TRACE_MISSPEC])
167 outs << (misspeculating ? "-" : "+") << " ";
168
169 if (flags[PRINT_THREAD_NUM])
137
138 if (flags[TRACE_MISSPEC])
139 outs << (misspeculating ? "-" : "+") << " ";
140
141 if (flags[PRINT_THREAD_NUM])
170 outs << "T" << thread << " : ";
142 outs << "T" << thread->getThreadNum() << " : ";
171
172
173 std::string sym_str;
174 Addr sym_addr;
175 if (debugSymbolTable
176 && debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr)
177 && flags[PC_SYMBOL]) {
178 if (PC != sym_addr)

--- 146 unchanged lines hidden ---
143
144
145 std::string sym_str;
146 Addr sym_addr;
147 if (debugSymbolTable
148 && debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr)
149 && flags[PC_SYMBOL]) {
150 if (PC != sym_addr)

--- 146 unchanged lines hidden ---