Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: runtime/vm/simulator_mips.cc

Issue 789903002: Complete and clean up breakpoint support in all 3 debuggers embedded in MIPS, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/simulator_arm64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_mips.cc
===================================================================
--- runtime/vm/simulator_mips.cc (revision 42212)
+++ runtime/vm/simulator_mips.cc (working copy)
@@ -105,10 +105,6 @@
bool is_inlined);
void PrintBacktrace();
- static const int32_t kSimulatorBreakpointInstruction =
- Instr::kBreakPointInstruction |
- (Instr::kSimulatorBreakCode << kBreakCodeShift);
-
// Set or delete a breakpoint. Returns true if successful.
bool SetBreakpoint(Instr* breakpc);
bool DeleteBreakpoint(Instr* breakpc);
@@ -393,7 +389,7 @@
void SimulatorDebugger::RedoBreakpoints() {
if (sim_->break_pc_ != NULL) {
- sim_->break_pc_->SetInstructionBits(kSimulatorBreakpointInstruction);
+ sim_->break_pc_->SetInstructionBits(Instr::kSimulatorBreakpointInstruction);
}
}
@@ -540,11 +536,11 @@
end = start + (10 * Instr::kInstrSize);
} else if (args == 2) {
if (GetValue(arg1, &start)) {
- // no length parameter passed, assume 10 instructions
+ // No length parameter passed, assume 10 instructions.
if (Simulator::IsIllegalAddress(start)) {
- // If start isn't a valid address, warn and use PC instead
+ // If start isn't a valid address, warn and use PC instead.
OS::Print("First argument yields invalid address: 0x%x\n", start);
- OS::Print("Using PC instead");
+ OS::Print("Using PC instead\n");
start = sim_->get_pc();
}
end = start + (10 * Instr::kInstrSize);
@@ -553,7 +549,7 @@
uint32_t length;
if (GetValue(arg1, &start) && GetValue(arg2, &length)) {
if (Simulator::IsIllegalAddress(start)) {
- // If start isn't a valid address, warn and use PC instead
+ // If start isn't a valid address, warn and use PC instead.
OS::Print("First argument yields invalid address: 0x%x\n", start);
OS::Print("Using PC instead\n");
start = sim_->get_pc();
@@ -561,8 +557,11 @@
end = start + (length * Instr::kInstrSize);
}
}
-
- Disassembler::Disassemble(start, end);
+ if ((start > 0) && (end > start)) {
+ Disassembler::Disassemble(start, end);
+ } else {
+ OS::Print("disasm [<address> [<number_of_instructions>]]\n");
+ }
} else if (strcmp(cmd, "gdb") == 0) {
OS::Print("relinquishing control to gdb\n");
OS::DebugBreak();
@@ -781,9 +780,6 @@
}
private:
- static const int32_t kRedirectInstruction =
- Instr::kBreakPointInstruction | (Instr::kRedirectCode << kBreakCodeShift);
-
Redirection(uword external_function,
Simulator::CallKind call_kind,
int argument_count)
@@ -790,7 +786,7 @@
: external_function_(external_function),
call_kind_(call_kind),
argument_count_(argument_count),
- break_instruction_(kRedirectInstruction),
+ break_instruction_(Instr::kSimulatorRedirectInstruction),
next_(list_) {
list_ = this;
}
@@ -1118,7 +1114,7 @@
bool result = false;
for (int i = 0; i < kNumAddressTags; i++) {
if (exclusive_access_state_[i].isolate == isolate) {
- // Check whether the current isolates address reservation matches.
+ // Check whether the current isolate's address reservation matches.
if (exclusive_access_state_[i].addr == addr) {
result = true;
}
@@ -1203,7 +1199,7 @@
dbg.Stop(instr, message);
// Adjust for extra pc increment.
set_pc(get_pc() - Instr::kInstrSize);
- } else if (instr->BreakCodeField() == Instr::kMsgMessageCode) {
+ } else if (instr->BreakCodeField() == Instr::kSimulatorMessageCode) {
const char* message = *reinterpret_cast<const char**>(
reinterpret_cast<intptr_t>(instr) - Instr::kInstrSize);
if (FLAG_trace_sim) {
@@ -1212,7 +1208,7 @@
OS::PrintErr("Bad break code: 0x%x\n", instr->InstructionBits());
UnimplementedInstruction(instr);
}
- } else if (instr->BreakCodeField() == Instr::kRedirectCode) {
+ } else if (instr->BreakCodeField() == Instr::kSimulatorRedirectCode) {
SimulatorSetjmpBuffer buffer(this);
if (!setjmp(buffer.buffer_)) {
@@ -2299,20 +2295,18 @@
// FLAG_stop_sim_at is at the non-default value. Stop in the debugger when
// we reach the particular instruction count or address.
while (pc_ != kEndSimulatingPC) {
+ Instr* instr = Instr::At(pc_);
icount_++;
- Instr* instr = Instr::At(pc_);
- if (static_cast<int>(icount_) == FLAG_stop_sim_at) {
+ if (static_cast<intptr_t>(icount_) == FLAG_stop_sim_at) {
SimulatorDebugger dbg(this);
dbg.Stop(instr, "Instruction count reached");
- } else if (reinterpret_cast<int>(instr) == FLAG_stop_sim_at) {
+ } else if (reinterpret_cast<intptr_t>(instr) == FLAG_stop_sim_at) {
SimulatorDebugger dbg(this);
dbg.Stop(instr, "Instruction address reached");
+ } else if (IsIllegalAddress(pc_)) {
+ HandleIllegalAccess(pc_, instr);
} else {
- if (IsIllegalAddress(pc_)) {
- HandleIllegalAccess(pc_, instr);
- } else {
- InstructionDecode(instr);
- }
+ InstructionDecode(instr);
}
}
}
« no previous file with comments | « runtime/vm/simulator_arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698