infcmd.c (step_1),
[deliverable/binutils-gdb.git] / gdb / infrun.c
index 3656c98ed9489bb68fea7250b849099b2ca6f7b5..e7d2c4221ea55eeab66f643edede2267339f7259 100644 (file)
@@ -481,6 +481,13 @@ wait_for_inferior ()
   sal = find_pc_line(prev_pc, 0);
   current_line = sal.line;
 
+  /* Are we stepping?  */
+#define CURRENTLY_STEPPING() ((step_resume_breakpoint == NULL \
+                              && !handling_longjmp \
+                              && (step_range_end \
+                                  || trap_expected)) \
+                             || bpstat_should_step ())
+
   while (1)
     {
       /* Clean up saved state that will become invalid.  */
@@ -696,25 +703,24 @@ wait_for_inferior ()
          else
            {
              /* See if there is a breakpoint at the current PC.  */
+             stop_bpstat = bpstat_stop_status
+               (&stop_pc, stop_frame_address,
 #if DECR_PC_AFTER_BREAK
-             /* Notice the case of stepping through a jump
-                that lands just after a breakpoint.
-                Don't confuse that with hitting the breakpoint.
-                What we check for is that 1) stepping is going on
-                and 2) the pc before the last insn does not match
-                the address of the breakpoint before the current pc.  */
-             if (prev_pc == stop_pc - DECR_PC_AFTER_BREAK
-                 || !step_range_end
-                 || step_resume_breakpoint != NULL
-                 || handling_longjmp /* FIXME */)
-#endif /* DECR_PC_AFTER_BREAK not zero */
-               {
-                 stop_bpstat =
-                   bpstat_stop_status (&stop_pc, stop_frame_address);
-                 /* Following in case break condition called a
-                    function.  */
-                 stop_print_frame = 1;
-               }
+                /* Notice the case of stepping through a jump
+                   that lands just after a breakpoint.
+                   Don't confuse that with hitting the breakpoint.
+                   What we check for is that 1) stepping is going on
+                   and 2) the pc before the last insn does not match
+                   the address of the breakpoint before the current pc.  */
+                (prev_pc != stop_pc - DECR_PC_AFTER_BREAK
+                 && CURRENTLY_STEPPING ())
+#else /* DECR_PC_AFTER_BREAK zero */
+                0
+#endif /* DECR_PC_AFTER_BREAK zero */
+                );
+             /* Following in case break condition called a
+                function.  */
+             stop_print_frame = 1;
            }
 
          if (stop_signal == SIGTRAP)
@@ -1207,10 +1213,7 @@ step_into_function:
          /* We took a signal (which we are supposed to pass through to
             the inferior, else we'd have done a break above) and we
             haven't yet gotten our trap.  Simply continue.  */
-         resume ((step_range_end && step_resume_breakpoint == NULL)
-                 || (trap_expected && step_resume_breakpoint == NULL)
-                 || bpstat_should_step (),
-                 stop_signal);
+         resume (CURRENTLY_STEPPING (), stop_signal);
        }
       else
        {
@@ -1256,23 +1259,10 @@ step_into_function:
           if (!bpstat_explains_signal (stop_bpstat)
              && (stop_signal != SIGCLD) 
               && !stopped_by_random_signal)
-            {
-            CORE_ADDR pc_contents = read_register (PC_REGNUM);
-            CORE_ADDR npc_contents = read_register (NPC_REGNUM);
-            if (pc_contents != npc_contents)
-              {
-              write_register (NNPC_REGNUM, npc_contents);
-              write_register (NPC_REGNUM, pc_contents);
-             }
-            }
+            SHIFT_INST_REGS();
 #endif /* SHIFT_INST_REGS */
 
-         resume ((step_resume_breakpoint == NULL
-                  && !handling_longjmp
-                  && (step_range_end
-                      || trap_expected))
-                 || bpstat_should_step (),
-                 stop_signal);
+         resume (CURRENTLY_STEPPING (), stop_signal);
        }
     }
 
This page took 0.025625 seconds and 4 git commands to generate.