Revision: 9946
Author:   [email protected]
Date:     Thu Nov 10 00:01:23 2011
Log: 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 <[email protected]>.
http://code.google.com/p/v8/source/detail?r=9946

Modified:
 /branches/bleeding_edge/src/mips/simulator-mips.cc
 /branches/bleeding_edge/src/mips/simulator-mips.h

=======================================
--- /branches/bleeding_edge/src/mips/simulator-mips.cc Tue Oct 18 07:41:45 2011 +++ /branches/bleeding_edge/src/mips/simulator-mips.cc Thu Nov 10 00:01:23 2011
@@ -72,7 +72,7 @@
 // code.
 class MipsDebugger {
  public:
-  explicit MipsDebugger(Simulator* sim);
+  explicit MipsDebugger(Simulator* sim) : sim_(sim) { }
   ~MipsDebugger();

   void Stop(Instruction* instr);
@@ -105,10 +105,6 @@
   void RedoBreakpoints();
 };

-MipsDebugger::MipsDebugger(Simulator* sim) {
-  sim_ = sim;
-}
-

 MipsDebugger::~MipsDebugger() {
 }
@@ -391,6 +387,13 @@
     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 @@
         PrintF("Unknown command: %s\n", cmd);
       }
     }
-    DeleteArray(line);
   }

   // Add all the breakpoints back to stop execution and enter the debugger
@@ -789,6 +791,12 @@
   intptr_t end_page = ((start + size) & ~CachePage::kPageMask);
   return start_page == end_page;
 }
+
+
+void Simulator::set_last_debugger_input(char* input) {
+  DeleteArray(last_debugger_input_);
+  last_debugger_input_ = input;
+}


 void Simulator::FlushICache(v8::internal::HashMap* i_cache,
@@ -911,6 +919,8 @@
   for (int i = 0; i < kNumExceptions; i++) {
     exceptions[i] = 0;
   }
+
+  last_debugger_input_ = NULL;
 }


=======================================
--- /branches/bleeding_edge/src/mips/simulator-mips.h Thu May 26 00:46:18 2011 +++ /branches/bleeding_edge/src/mips/simulator-mips.h Thu Nov 10 00:01:23 2011
@@ -220,6 +220,10 @@

   // Pop an address from the JS stack.
   uintptr_t PopAddress();
+
+  // Debugger input.
+  void set_last_debugger_input(char* input);
+  char* last_debugger_input() { return last_debugger_input_; }

   // ICache checking.
   static void FlushICache(v8::internal::HashMap* i_cache, void* start,
@@ -358,6 +362,9 @@
   int icount_;
   int break_count_;

+  // Debugger input.
+  char* last_debugger_input_;
+
   // Icache simulation.
   v8::internal::HashMap* i_cache_;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to