Revision: 9937
Author:   [email protected]
Date:     Wed Nov  9 06:37:04 2011
Log: Repeat last debugger command in the arm simulator when command input is empty.

Review URL: http://codereview.chromium.org/8506015
http://code.google.com/p/v8/source/detail?r=9937

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

=======================================
--- /branches/bleeding_edge/src/arm/simulator-arm.cc Tue Oct 18 07:41:45 2011 +++ /branches/bleeding_edge/src/arm/simulator-arm.cc Wed Nov 9 06:37:04 2011
@@ -53,7 +53,7 @@
 // code.
 class ArmDebugger {
  public:
-  explicit ArmDebugger(Simulator* sim);
+  explicit ArmDebugger(Simulator* sim) : sim_(sim) { };
   ~ArmDebugger();

   void Stop(Instruction* instr);
@@ -84,11 +84,6 @@
 };


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

@@ -296,6 +291,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,
@@ -611,7 +613,6 @@
         PrintF("Unknown command: %s\n", cmd);
       }
     }
-    DeleteArray(line);
   }

   // Add all the breakpoints back to stop execution and enter the debugger
@@ -643,6 +644,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,
@@ -781,6 +788,8 @@
   registers_[pc] = bad_lr;
   registers_[lr] = bad_lr;
   InitializeCoverage();
+
+  last_debugger_input_ = NULL;
 }


=======================================
--- /branches/bleeding_edge/src/arm/simulator-arm.h     Thu May  5 11:55:31 2011
+++ /branches/bleeding_edge/src/arm/simulator-arm.h     Wed Nov  9 06:37:04 2011
@@ -193,6 +193,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,
@@ -360,6 +364,9 @@
   bool pc_modified_;
   int icount_;

+  // 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