Commit 97798860 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Repeat last debugger command in the arm simulator when command input is empty.

Review URL: http://codereview.chromium.org/8506015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9937 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 61575629
...@@ -53,7 +53,7 @@ namespace internal { ...@@ -53,7 +53,7 @@ namespace internal {
// code. // code.
class ArmDebugger { class ArmDebugger {
public: public:
explicit ArmDebugger(Simulator* sim); explicit ArmDebugger(Simulator* sim) : sim_(sim) { };
~ArmDebugger(); ~ArmDebugger();
void Stop(Instruction* instr); void Stop(Instruction* instr);
...@@ -84,11 +84,6 @@ class ArmDebugger { ...@@ -84,11 +84,6 @@ class ArmDebugger {
}; };
ArmDebugger::ArmDebugger(Simulator* sim) {
sim_ = sim;
}
ArmDebugger::~ArmDebugger() { ArmDebugger::~ArmDebugger() {
} }
...@@ -296,6 +291,13 @@ void ArmDebugger::Debug() { ...@@ -296,6 +291,13 @@ void ArmDebugger::Debug() {
if (line == NULL) { if (line == NULL) {
break; break;
} else { } 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 // Use sscanf to parse the individual parts of the command line. At the
// moment no command expects more than two parameters. // moment no command expects more than two parameters.
int argc = SScanF(line, int argc = SScanF(line,
...@@ -611,7 +613,6 @@ void ArmDebugger::Debug() { ...@@ -611,7 +613,6 @@ void ArmDebugger::Debug() {
PrintF("Unknown command: %s\n", cmd); PrintF("Unknown command: %s\n", cmd);
} }
} }
DeleteArray(line);
} }
// Add all the breakpoints back to stop execution and enter the debugger // Add all the breakpoints back to stop execution and enter the debugger
...@@ -645,6 +646,12 @@ static bool AllOnOnePage(uintptr_t start, int size) { ...@@ -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 Simulator::FlushICache(v8::internal::HashMap* i_cache,
void* start_addr, void* start_addr,
size_t size) { size_t size) {
...@@ -781,6 +788,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { ...@@ -781,6 +788,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
registers_[pc] = bad_lr; registers_[pc] = bad_lr;
registers_[lr] = bad_lr; registers_[lr] = bad_lr;
InitializeCoverage(); InitializeCoverage();
last_debugger_input_ = NULL;
} }
......
...@@ -194,6 +194,10 @@ class Simulator { ...@@ -194,6 +194,10 @@ class Simulator {
// Pop an address from the JS stack. // Pop an address from the JS stack.
uintptr_t PopAddress(); uintptr_t PopAddress();
// Debugger input.
void set_last_debugger_input(char* input);
char* last_debugger_input() { return last_debugger_input_; }
// ICache checking. // ICache checking.
static void FlushICache(v8::internal::HashMap* i_cache, void* start, static void FlushICache(v8::internal::HashMap* i_cache, void* start,
size_t size); size_t size);
...@@ -360,6 +364,9 @@ class Simulator { ...@@ -360,6 +364,9 @@ class Simulator {
bool pc_modified_; bool pc_modified_;
int icount_; int icount_;
// Debugger input.
char* last_debugger_input_;
// Icache simulation // Icache simulation
v8::internal::HashMap* i_cache_; v8::internal::HashMap* i_cache_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment