Index: runtime/vm/simulator_arm.cc |
=================================================================== |
--- runtime/vm/simulator_arm.cc (revision 43658) |
+++ runtime/vm/simulator_arm.cc (working copy) |
@@ -24,9 +24,9 @@ |
namespace dart { |
-DEFINE_FLAG(int, trace_sim_after, -1, |
+DEFINE_FLAG(uint64_t, trace_sim_after, ULLONG_MAX, |
"Trace simulator execution after instruction count reached."); |
-DEFINE_FLAG(int, stop_sim_at, -1, |
+DEFINE_FLAG(uint64_t, stop_sim_at, ULLONG_MAX, |
"Instruction address or instruction count to stop simulator at."); |
@@ -200,10 +200,6 @@ |
return true; |
} |
} |
- if (strcmp("icount", desc) == 0) { |
- *value = sim_->get_icount(); |
- return true; |
- } |
bool retval = SScanF(desc, "0x%x", value) == 1; |
if (!retval) { |
retval = SScanF(desc, "%x", value) == 1; |
@@ -462,13 +458,16 @@ |
} else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) { |
if (args == 2) { |
uint32_t value; |
- if (GetValue(arg1, &value)) { |
+ if (strcmp(arg1, "icount") == 0) { |
+ const uint64_t icount = sim_->get_icount(); |
+ OS::Print("icount: %"Pu64" 0x%"Px64"\n", icount, icount); |
+ } else if (GetValue(arg1, &value)) { |
OS::Print("%s: %u 0x%x\n", arg1, value, value); |
} else { |
OS::Print("%s unrecognized\n", arg1); |
} |
} else { |
- OS::Print("print <reg or value or *addr>\n"); |
+ OS::Print("print <reg or icount or value or *addr>\n"); |
} |
} else if ((strcmp(cmd, "ps") == 0) || |
(strcmp(cmd, "printsingle") == 0)) { |
@@ -595,11 +594,11 @@ |
OS::Print("Not at debugger stop.\n"); |
} |
} else if (strcmp(cmd, "trace") == 0) { |
- if (FLAG_trace_sim_after == -1) { |
+ if (FLAG_trace_sim_after == ULLONG_MAX) { |
FLAG_trace_sim_after = sim_->get_icount(); |
OS::Print("execution tracing on\n"); |
} else { |
- FLAG_trace_sim_after = -1; |
+ FLAG_trace_sim_after = ULLONG_MAX; |
OS::Print("execution tracing off\n"); |
} |
} else if (strcmp(cmd, "bt") == 0) { |
@@ -1186,10 +1185,7 @@ |
bool Simulator::IsTracingExecution() const { |
- // Integer flag values are signed, so we must cast to unsigned. |
- // The default of -1 hence becomes the maximum unsigned value. |
- return (static_cast<uintptr_t>(icount_) > |
- static_cast<uintptr_t>(FLAG_trace_sim_after)); |
+ return icount_ > FLAG_trace_sim_after; |
} |
@@ -3591,7 +3587,7 @@ |
void Simulator::InstructionDecode(Instr* instr) { |
pc_modified_ = false; |
if (IsTracingExecution()) { |
- OS::Print("%" Pd " ", icount_); |
+ OS::Print("%"Pu64, icount_); |
const uword start = reinterpret_cast<uword>(instr); |
const uword end = start + Instr::kInstrSize; |
Disassembler::Disassemble(start, end); |
@@ -3656,7 +3652,7 @@ |
// raw PC value and not the one used as input to arithmetic instructions. |
uword program_counter = get_pc(); |
- if (FLAG_stop_sim_at == 0) { |
+ if (FLAG_stop_sim_at == ULLONG_MAX) { |
// Fast version of the dispatch loop without checking whether the simulator |
// should be stopping at a particular executed instruction. |
while (program_counter != kEndSimulatingPC) { |
@@ -3678,7 +3674,7 @@ |
if (icount_ == FLAG_stop_sim_at) { |
SimulatorDebugger dbg(this); |
dbg.Stop(instr, "Instruction count reached"); |
- } else if (reinterpret_cast<intptr_t>(instr) == FLAG_stop_sim_at) { |
+ } else if (reinterpret_cast<uint64_t>(instr) == FLAG_stop_sim_at) { |
SimulatorDebugger dbg(this); |
dbg.Stop(instr, "Instruction address reached"); |
} else if (IsIllegalAddress(program_counter)) { |