Commit 462f6b16 authored by yangguo@chromium.org's avatar yangguo@chromium.org

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

Port r9937 (c263a9e).

BUG=
TEST=

Review URL: http://codereview.chromium.org/8509015
Patch from Gergely Kis <gergely@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9946 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0ec3ba8f
...@@ -72,7 +72,7 @@ uint32_t get_fcsr_condition_bit(uint32_t cc) { ...@@ -72,7 +72,7 @@ uint32_t get_fcsr_condition_bit(uint32_t cc) {
// code. // code.
class MipsDebugger { class MipsDebugger {
public: public:
explicit MipsDebugger(Simulator* sim); explicit MipsDebugger(Simulator* sim) : sim_(sim) { }
~MipsDebugger(); ~MipsDebugger();
void Stop(Instruction* instr); void Stop(Instruction* instr);
...@@ -105,10 +105,6 @@ class MipsDebugger { ...@@ -105,10 +105,6 @@ class MipsDebugger {
void RedoBreakpoints(); void RedoBreakpoints();
}; };
MipsDebugger::MipsDebugger(Simulator* sim) {
sim_ = sim;
}
MipsDebugger::~MipsDebugger() { MipsDebugger::~MipsDebugger() {
} }
...@@ -391,6 +387,13 @@ void MipsDebugger::Debug() { ...@@ -391,6 +387,13 @@ void MipsDebugger::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,
...@@ -757,7 +760,6 @@ void MipsDebugger::Debug() { ...@@ -757,7 +760,6 @@ void MipsDebugger::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
...@@ -791,6 +793,12 @@ static bool AllOnOnePage(uintptr_t start, int size) { ...@@ -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 Simulator::FlushICache(v8::internal::HashMap* i_cache,
void* start_addr, void* start_addr,
size_t size) { size_t size) {
...@@ -911,6 +919,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { ...@@ -911,6 +919,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
for (int i = 0; i < kNumExceptions; i++) { for (int i = 0; i < kNumExceptions; i++) {
exceptions[i] = 0; exceptions[i] = 0;
} }
last_debugger_input_ = NULL;
} }
......
...@@ -221,6 +221,10 @@ class Simulator { ...@@ -221,6 +221,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);
...@@ -358,6 +362,9 @@ class Simulator { ...@@ -358,6 +362,9 @@ class Simulator {
int icount_; int icount_;
int break_count_; int break_count_;
// 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