Switching tracing order to prevent skipping traces of branch instructions.

This commit is contained in:
Ben Vanik
2013-09-06 23:21:08 -07:00
parent 1a3fed942d
commit d5b8a2091a
3 changed files with 25 additions and 25 deletions

View File

@@ -117,28 +117,6 @@ void _cdecl XeTraceInstruction(
buffer[0] = 0;
int offset = 0;
ppc::InstrData i;
i.address = (uint32_t)cia;
i.code = (uint32_t)data;
i.type = ppc::GetInstrType(i.code);
if (i.type && i.type->disassemble) {
ppc::InstrDisasm d;
i.type->disassemble(i, d);
std::string disasm;
d.Dump(disasm);
offset += xesnprintfa(buffer + offset, XECOUNT(buffer) - offset,
"%.8X %.8X %s %s",
i.address, i.code,
i.type && i.type->emit ? " " : "X",
disasm.c_str());
} else {
offset += xesnprintfa(buffer + offset, XECOUNT(buffer) - offset,
"%.8X %.8X %s %s",
i.address, i.code,
i.type && i.type->emit ? " " : "X",
i.type ? i.type->name : "<unknown>");
}
if (FLAGS_trace_registers) {
offset += xesnprintfa(buffer + offset, XECOUNT(buffer) - offset,
"\n"
@@ -162,6 +140,28 @@ void _cdecl XeTraceInstruction(
state->r[28], state->r[29], state->r[30], state->r[31]);
}
ppc::InstrData i;
i.address = (uint32_t)cia;
i.code = (uint32_t)data;
i.type = ppc::GetInstrType(i.code);
if (i.type && i.type->disassemble) {
ppc::InstrDisasm d;
i.type->disassemble(i, d);
std::string disasm;
d.Dump(disasm);
offset += xesnprintfa(buffer + offset, XECOUNT(buffer) - offset,
"%.8X %.8X %s %s",
i.address, i.code,
i.type && i.type->emit ? " " : "X",
disasm.c_str());
} else {
offset += xesnprintfa(buffer + offset, XECOUNT(buffer) - offset,
"%.8X %.8X %s %s",
i.address, i.code,
i.type && i.type->emit ? " " : "X",
i.type ? i.type->name : "<unknown>");
}
uint32_t thread_id = state->thread_state->thread_id();
xe_log_line("", thread_id, "XeTraceInstruction", 't', buffer);