Index: src/arm/simulator-arm.cc |
diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc |
index 542cc302d30f09c8db016b977930181ae76304a8..b4458000fc6a229ec6fb4a74818e78f736b69dee 100644 |
--- a/src/arm/simulator-arm.cc |
+++ b/src/arm/simulator-arm.cc |
@@ -53,7 +53,7 @@ namespace internal { |
// code. |
class ArmDebugger { |
public: |
- explicit ArmDebugger(Simulator* sim); |
+ explicit ArmDebugger(Simulator* sim) : sim_(sim) { }; |
~ArmDebugger(); |
void Stop(Instruction* instr); |
@@ -84,11 +84,6 @@ class ArmDebugger { |
}; |
-ArmDebugger::ArmDebugger(Simulator* sim) { |
- sim_ = sim; |
-} |
- |
- |
ArmDebugger::~ArmDebugger() { |
} |
@@ -296,6 +291,13 @@ void ArmDebugger::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, |
@@ -611,7 +613,6 @@ void ArmDebugger::Debug() { |
PrintF("Unknown command: %s\n", cmd); |
} |
} |
- DeleteArray(line); |
} |
// Add all the breakpoints back to stop execution and enter the debugger |
@@ -645,6 +646,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) { |
@@ -781,6 +788,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { |
registers_[pc] = bad_lr; |
registers_[lr] = bad_lr; |
InitializeCoverage(); |
+ |
+ last_debugger_input_ = NULL; |
} |