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