Index: runtime/vm/simulator_arm64.cc |
=================================================================== |
--- runtime/vm/simulator_arm64.cc (revision 43658) |
+++ runtime/vm/simulator_arm64.cc (working copy) |
@@ -23,9 +23,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."); |
@@ -198,10 +198,6 @@ |
*value = sim_->get_pc(); |
return true; |
} |
- if (strcmp("icount", desc) == 0) { |
- *value = sim_->get_icount(); |
- return true; |
- } |
bool retval = SScanF(desc, "0x%"Px64, value) == 1; |
if (!retval) { |
retval = SScanF(desc, "%"Px64, value) == 1; |
@@ -481,13 +477,16 @@ |
} else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) { |
if (args == 2) { |
uint64_t value; |
- if (GetValue(arg1, &value)) { |
+ if (strcmp(arg1, "icount") == 0) { |
+ value = sim_->get_icount(); |
+ OS::Print("icount: %"Pu64" 0x%"Px64"\n", value, value); |
+ } else if (GetValue(arg1, &value)) { |
OS::Print("%s: %"Pu64" 0x%"Px64"\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, "pf") == 0) || |
(strcmp(cmd, "printfloat") == 0)) { |
@@ -641,11 +640,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) { |
@@ -1064,10 +1063,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; |
} |
@@ -3307,7 +3303,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); |
@@ -3340,7 +3336,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) { |
@@ -3359,10 +3355,10 @@ |
while (program_counter != kEndSimulatingPC) { |
Instr* instr = reinterpret_cast<Instr*>(program_counter); |
icount_++; |
- if (static_cast<intptr_t>(icount_) == FLAG_stop_sim_at) { |
+ 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)) { |