Index: src/mips/simulator-mips.cc |
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc |
index 0ec3e283c6617139a39387d80d8a1e83260e5a01..f70775d86be2bf50182958b523b607b5488c5a96 100644 |
--- a/src/mips/simulator-mips.cc |
+++ b/src/mips/simulator-mips.cc |
@@ -72,7 +72,7 @@ uint32_t get_fcsr_condition_bit(uint32_t cc) { |
// code. |
class MipsDebugger { |
public: |
- explicit MipsDebugger(Simulator* sim); |
+ explicit MipsDebugger(Simulator* sim) : sim_(sim) { } |
~MipsDebugger(); |
void Stop(Instruction* instr); |
@@ -105,10 +105,6 @@ class MipsDebugger { |
void RedoBreakpoints(); |
}; |
-MipsDebugger::MipsDebugger(Simulator* sim) { |
- sim_ = sim; |
-} |
- |
MipsDebugger::~MipsDebugger() { |
} |
@@ -391,6 +387,13 @@ void MipsDebugger::Debug() { |
if (line == NULL) { |
break; |
} else { |
+ char* last_input = sim_->last_debugger_input(); |
+ if (strcmp(line, "\n") == 0 && last_input != NULL) { |
+ line = last_input; |
+ } else { |
+ // Ownership is transferred to sim_; |
+ sim_->set_last_debugger_input(line); |
+ } |
// Use sscanf to parse the individual parts of the command line. At the |
// moment no command expects more than two parameters. |
int argc = SScanF(line, |
@@ -757,7 +760,6 @@ void MipsDebugger::Debug() { |
PrintF("Unknown command: %s\n", cmd); |
} |
} |
- DeleteArray(line); |
} |
// Add all the breakpoints back to stop execution and enter the debugger |
@@ -791,6 +793,12 @@ static bool AllOnOnePage(uintptr_t start, int size) { |
} |
+void Simulator::set_last_debugger_input(char* input) { |
+ DeleteArray(last_debugger_input_); |
+ last_debugger_input_ = input; |
+} |
+ |
+ |
void Simulator::FlushICache(v8::internal::HashMap* i_cache, |
void* start_addr, |
size_t size) { |
@@ -911,6 +919,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { |
for (int i = 0; i < kNumExceptions; i++) { |
exceptions[i] = 0; |
} |
+ |
+ last_debugger_input_ = NULL; |
} |