Reviewers: baptiste.afsa1,

Description:
A64: Fix 'step instruction' ('si') in debugger

Fix step instruction, disassemble the instructions executed by it, and add a
blank line after disassembling an instruction to separate it from the
instruction at the pc.

BUG=none

Please review this at https://codereview.chromium.org/143413018/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64

Affected files (+22, -19 lines):
  M src/a64/simulator-a64.cc


Index: src/a64/simulator-a64.cc
diff --git a/src/a64/simulator-a64.cc b/src/a64/simulator-a64.cc
index b47c5bf7985c13a6502719e1f008cc133dd9ee25..fb2232b3f3d76578b466d0ddea1de682841754cb 100644
--- a/src/a64/simulator-a64.cc
+++ b/src/a64/simulator-a64.cc
@@ -2746,28 +2746,30 @@ void Simulator::Debug() {

// stepi / si ------------------------------------------------------------
       if ((strcmp(cmd, "si") == 0) || (strcmp(cmd, "stepi") == 0)) {
-        int64_t number_of_instructions_to_execute = 1;
-        if (argc >= 2) {
-          GetValue(arg1, &number_of_instructions_to_execute);
-        }
-        // Prevent from printing the next instruction twice.
-        if (log_parameters_ & LOG_DISASM) {
-          set_log_parameters(log_parameters_ & ~LOG_DISASM);
-          cleared_log_disasm_bit = true;
-        }
-        if (number_of_instructions_to_execute > 1) {
-          // Execute one instruction and restore LOG_DISASM if necessary.
+        // We are about to execute instructions, after which by default we
+        // should increment the pc_. If it was set when reaching this debug
+ // instruction, it has not been cleared because this instruction has not
+        // completed yet. So clear it manually.
+        pc_modified_ = false;
+
+        if (argc == 1) {
           ExecuteInstruction();
-          --number_of_instructions_to_execute;
-          if (cleared_log_disasm_bit == true) {
-            set_log_parameters(log_parameters_ | LOG_DISASM);
-            cleared_log_disasm_bit = false;
+        } else {
+          int64_t number_of_instructions_to_execute = 1;
+          GetValue(arg1, &number_of_instructions_to_execute);
+
+          set_log_parameters(log_parameters() | LOG_DISASM);
+          while (number_of_instructions_to_execute-- > 0) {
+            ExecuteInstruction();
           }
+          set_log_parameters(log_parameters() & ~LOG_DISASM);
+          PrintF("\n");
         }
-        // Execute the instructions.
-        while (number_of_instructions_to_execute-- > 0) {
-          ExecuteInstruction();
-        }
+
+ // If it was necessary, the pc has already been updated or incremented + // when executing the instruction. So we do not want it to be updated
+        // again. It will be cleared when exiting.
+        pc_modified_ = true;

// next / n --------------------------------------------------------------
       } else if ((strcmp(cmd, "next") == 0) || (strcmp(cmd, "n") == 0)) {
@@ -2799,6 +2801,7 @@ void Simulator::Debug() {
         // Disassemble.
         PrintInstructionsAt(reinterpret_cast<Instruction*>(address),
                             n_of_instrs_to_disasm);
+        PrintF("\n");

// print / p -------------------------------------------------------------
       } else if ((strcmp(cmd, "print") == 0) || (strcmp(cmd, "p") == 0)) {


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to