Commit 6903ecbf authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS: Use portable Printf formats.

BUG=

Review URL: https://codereview.chromium.org/1895843002

Cr-Commit-Position: refs/heads/master@{#35591}
parent 10413402
......@@ -586,7 +586,7 @@ void MipsDebugger::Debug() {
}
while (cur < end) {
PrintF(" 0x%08x: 0x%08x %10d",
PrintF(" 0x%08" PRIxPTR ": 0x%08x %10d",
reinterpret_cast<intptr_t>(cur), *cur, *cur);
HeapObject* obj = reinterpret_cast<HeapObject*>(*cur);
int value = *cur;
......@@ -649,8 +649,8 @@ void MipsDebugger::Debug() {
while (cur < end) {
dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08x %s\n",
reinterpret_cast<intptr_t>(cur), buffer.start());
PrintF(" 0x%08" PRIxPTR " %s\n", reinterpret_cast<intptr_t>(cur),
buffer.start());
cur += Instruction::kInstrSize;
}
} else if (strcmp(cmd, "gdb") == 0) {
......@@ -771,8 +771,8 @@ void MipsDebugger::Debug() {
while (cur < end) {
dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08x %s\n",
reinterpret_cast<intptr_t>(cur), buffer.start());
PrintF(" 0x%08" PRIxPTR " %s\n", reinterpret_cast<intptr_t>(cur),
buffer.start());
cur += Instruction::kInstrSize;
}
} else if ((strcmp(cmd, "h") == 0) || (strcmp(cmd, "help") == 0)) {
......@@ -1786,8 +1786,8 @@ void Simulator::TraceMemWr(int32_t addr, int32_t value, TraceType t) {
int Simulator::ReadW(int32_t addr, Instruction* instr) {
if (addr >=0 && addr < 0x400) {
// This has to be a NULL-dereference, drop into debugger.
PrintF("Memory read from bad address: 0x%08x, pc=0x%08x\n",
addr, reinterpret_cast<intptr_t>(instr));
PrintF("Memory read from bad address: 0x%08x, pc=0x%08" PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
MipsDebugger dbg(this);
dbg.Debug();
}
......@@ -1808,8 +1808,8 @@ int Simulator::ReadW(int32_t addr, Instruction* instr) {
void Simulator::WriteW(int32_t addr, int value, Instruction* instr) {
if (addr >= 0 && addr < 0x400) {
// This has to be a NULL-dereference, drop into debugger.
PrintF("Memory write to bad address: 0x%08x, pc=0x%08x\n",
addr, reinterpret_cast<intptr_t>(instr));
PrintF("Memory write to bad address: 0x%08x, pc=0x%08" PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
MipsDebugger dbg(this);
dbg.Debug();
}
......@@ -1953,7 +1953,7 @@ uintptr_t Simulator::StackLimit(uintptr_t c_limit) const {
// Unsupported instructions use Format to print an error and stop execution.
void Simulator::Format(Instruction* instr, const char* format) {
PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n",
PrintF("Simulator found unsupported instruction:\n 0x%08" PRIxPTR ": %s\n",
reinterpret_cast<intptr_t>(instr), format);
UNIMPLEMENTED_MIPS();
}
......@@ -4413,8 +4413,9 @@ void Simulator::InstructionDecode(Instruction* instr) {
UNSUPPORTED();
}
if (::v8::internal::FLAG_trace_sim) {
PrintF(" 0x%08x %-44s %s\n", reinterpret_cast<intptr_t>(instr),
buffer.start(), trace_buf_.start());
PrintF(" 0x%08" PRIxPTR " %-44s %s\n",
reinterpret_cast<intptr_t>(instr), buffer.start(),
trace_buf_.start());
}
if (!pc_modified_) {
set_register(pc, reinterpret_cast<int32_t>(instr) +
......
......@@ -375,7 +375,8 @@ void Decoder::PrintXImm26(Instruction* instr) {
uint64_t target = static_cast<uint64_t>(instr->Imm26Value())
<< kImmFieldShift;
target = (reinterpret_cast<uint64_t>(instr) & ~0xfffffff) | target;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%lx", target);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "0x%" PRIx64, target);
}
......@@ -801,16 +802,14 @@ int Decoder::DecodeBreakInstr(Instruction* instr) {
if (instr->Bits(25, 6) == static_cast<int>(kMaxStopCode)) {
// This is stop(msg).
Format(instr, "break, code: 'code");
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"\n%p %08lx stop msg: %s",
static_cast<void*>
(reinterpret_cast<int32_t*>(instr
+ Instruction::kInstrSize)),
reinterpret_cast<uint64_t>
(*reinterpret_cast<char**>(instr
+ Instruction::kInstrSize)),
*reinterpret_cast<char**>(instr
+ Instruction::kInstrSize));
out_buffer_pos_ += SNPrintF(
out_buffer_ + out_buffer_pos_,
"\n%p %08" PRIx64 " stop msg: %s",
static_cast<void*>(
reinterpret_cast<int32_t*>(instr + Instruction::kInstrSize)),
reinterpret_cast<uint64_t>(
*reinterpret_cast<char**>(instr + Instruction::kInstrSize)),
*reinterpret_cast<char**>(instr + Instruction::kInstrSize));
// Size 3: the break_ instr, plus embedded 64-bit char pointer.
return 3 * Instruction::kInstrSize;
} else {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment