]> Git Repo - binutils.git/blobdiff - gdb/infrun.c
* snapshots.readme: Add notes for UNIX make and GNU make.
[binutils.git] / gdb / infrun.c
index de2ad56c869a338fb08463ab80294aaadbd31f74..ab4e3e0f986c4c961e22093219396829afe4d5c7 100644 (file)
@@ -103,6 +103,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
 #include <string.h>
+#include <ctype.h>
 #include "symtab.h"
 #include "frame.h"
 #include "inferior.h"
@@ -185,6 +186,16 @@ hook_stop_stub PARAMS ((char *));
 #define IN_SOLIB_TRAMPOLINE(pc,name)   0
 #endif
 
+/* On some systems, the PC may be left pointing at an instruction that  won't
+   actually be executed.  This is usually indicated by a bit in the PSW.  If
+   we find ourselves in such a state, then we step the target beyond the
+   nullified instruction before returning control to the user so as to avoid
+   confusion. */
+
+#ifndef INSTRUCTION_NULLIFIED
+#define INSTRUCTION_NULLIFIED 0
+#endif
+
 #ifdef TDESC
 #include "tdesc.h"
 int safe_to_init_tdesc_context = 0;
@@ -509,6 +520,7 @@ wait_for_inferior ()
   int remove_breakpoints_on_following_step = 0;
   int current_line;
   int handling_longjmp = 0;    /* FIXME */
+  struct symtab *symtab;
 
   sal = find_pc_line(prev_pc, 0);
   current_line = sal.line;
@@ -574,6 +586,15 @@ wait_for_inferior ()
        single_step (0);        /* This actually cleans up the ss */
 #endif /* NO_SINGLE_STEP */
       
+/* If PC is pointing at a nullified instruction, then step beyond it so that
+   the user won't be confused when GDB appears to be ready to execute it. */
+
+      if (INSTRUCTION_NULLIFIED)
+       {
+         resume (1, 0);
+         continue;
+       }
+
       stop_pc = read_pc ();
       set_current_frame ( create_new_frame (read_register (FP_REGNUM),
                                            read_pc ()));
@@ -971,8 +992,9 @@ wait_for_inferior ()
              if (tmp != 0)
                stop_func_start = tmp;
 
-             if (find_pc_function (stop_func_start) != 0)
-               goto step_into_function;
+             symtab = find_pc_symtab (stop_func_start);
+             if (symtab && LINETABLE (symtab))
+               goto step_into_function;
 
 step_over_function:
              /* A subroutine call has happened.  */
@@ -1197,9 +1219,6 @@ save_pc:
 void
 normal_stop ()
 {
-  char *tem;
-  struct cmd_list_element *c;
-
   /* Make sure that the current_frame's pc is correct.  This
      is a correction for setting up the frame info before doing
      DECR_PC_AFTER_BREAK */
@@ -1300,6 +1319,7 @@ hook_stop_stub (cmd)
      char *cmd;
 {
   execute_user_command ((struct cmd_list_element *)cmd, 0);
+  return (0);
 }
 
 \f
@@ -1694,7 +1714,7 @@ Pass means let program see this signal; otherwise program doesn't know.\n\
 Ignore is a synonym for nopass and noignore is a synonym for pass.\n\
 Pass and Stop may be combined.");
 
-  stop_command = add_cmd ("stop", class_pseudo, NO_FUNCTION,
+  stop_command = add_cmd ("stop", class_obscure, not_just_help_class_command,
           "There is no `stop' command, but you can set a hook on `stop'.\n\
 This allows you to set a list of commands to be run each time execution\n\
 of the inferior program stops.", &cmdlist);
This page took 0.030101 seconds and 4 git commands to generate.