* config/m68k/monitor.mt (TDEPFILE): Add remote-es.o.
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index e078064c45468f840b0da29e11096d7d7d249caa..717335fcc879b2e45c2971b1b0eb49faf879da62 100644 (file)
@@ -154,7 +154,7 @@ static int executing_breakpoint_commands;
 
 /* Chain of all breakpoints defined.  */
 
-struct breakpoint *breakpoint_chain;
+static struct breakpoint *breakpoint_chain;
 
 /* Number of last breakpoint made.  */
 
@@ -450,6 +450,7 @@ insert_breakpoints ()
                b->enable = disabled;
                if (!disabled_breaks)
                  {
+                   target_terminal_ours_for_output ();
                    fprintf_unfiltered (gdb_stderr,
                         "Cannot insert breakpoint %d:\n", b->number);
                    printf_filtered ("Disabling shared library breakpoints:\n");
@@ -460,6 +461,7 @@ insert_breakpoints ()
            else
 #endif
              {
+               target_terminal_ours_for_output ();
                fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number);
 #ifdef ONE_PROCESS_WRITETEXT
                fprintf_unfiltered (gdb_stderr,
@@ -482,10 +484,6 @@ remove_breakpoints ()
   register struct breakpoint *b;
   int val;
 
-#ifdef BREAKPOINT_DEBUG
-  printf_unfiltered ("Removing breakpoints.\n");
-#endif /* BREAKPOINT_DEBUG */
-
   ALL_BREAKPOINTS (b)
     if (b->type != bp_watchpoint && b->inserted)
       {
@@ -493,14 +491,6 @@ remove_breakpoints ()
        if (val)
          return val;
        b->inserted = 0;
-#ifdef BREAKPOINT_DEBUG
-       printf_unfiltered ("Removed breakpoint at %s",
-               local_hex_string((unsigned long) b->address));
-       printf_unfiltered (", shadow %s",
-               local_hex_string((unsigned long) b->shadow_contents[0]));
-       printf_unfiltered (", %s.\n",
-               local_hex_string((unsigned long) b->shadow_contents[1]));
-#endif /* BREAKPOINT_DEBUG */
       }
 
   return 0;
@@ -554,6 +544,37 @@ breakpoint_here_p (pc)
   return 0;
 }
 
+/* Return nonzero if FRAME is a dummy frame.  We can't use PC_IN_CALL_DUMMY
+   because figuring out the saved SP would take too much time, at least using
+   get_saved_register on the 68k.  This means that for this function to
+   work right a port must use the bp_call_dummy breakpoint.  */
+
+int
+frame_in_dummy (frame)
+     FRAME frame;
+{
+  struct breakpoint *b;
+
+#ifdef CALL_DUMMY
+  ALL_BREAKPOINTS (b)
+    {
+      static unsigned LONGEST dummy[] = CALL_DUMMY;
+
+      if (b->type == bp_call_dummy
+         && b->frame == frame->frame
+
+         /* We need to check the PC as well as the frame on the sparc,
+            for signals.exp in the testsuite.  */
+         && (frame->pc
+             >= (b->address
+                 - sizeof (dummy) / sizeof (LONGEST) * REGISTER_SIZE))
+         && frame->pc <= b->address)
+       return 1;
+    }
+#endif /* CALL_DUMMY */
+  return 0;
+}
+
 /* breakpoint_match_thread (PC, PID) returns true if the breakpoint at PC
    is valid for process/thread PID.  */
 
@@ -1243,6 +1264,9 @@ bpstat_what (bs)
     /* We hit the longjmp_resume breakpoint.  */
     long_resume,
 
+    /* We hit the step_resume breakpoint.  */
+    step_resume,
+
     /* This is just used to count how many enums there are.  */
     class_last
     };
@@ -1257,6 +1281,8 @@ bpstat_what (bs)
 #define setlr BPSTAT_WHAT_SET_LONGJMP_RESUME
 #define clrlr BPSTAT_WHAT_CLEAR_LONGJMP_RESUME
 #define clrlrs BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE
+#define sr BPSTAT_WHAT_STEP_RESUME
+
 /* "Can't happen."  Might want to print an error message.
    abort() is not out of the question, but chances are GDB is just
    a bit confused, not unusable.  */
@@ -1269,20 +1295,26 @@ bpstat_what (bs)
      (BPSTAT_WHAT_SINGLE type stuff) is handled in proceed() without
      reference to how we stopped.  We retain separate wp_silent and bp_silent
      codes in case we want to change that someday.  */
+
+  /* step_resume entries: a step resume breakpoint overrides another
+     breakpoint of signal handling (see comment in wait_for_inferior
+     at first IN_SIGTRAMP where we set the step_resume breakpoint).  */
+
   static const enum bpstat_what_main_action
     table[(int)class_last][(int)BPSTAT_WHAT_LAST] =
       {
        /*                              old action */
-       /*       keep_c  stop_s  stop_n  single  setlr   clrlr   clrlrs */
-
-/*no_effect*/  {keep_c, stop_s, stop_n, single, setlr , clrlr , clrlrs},
-/*wp_silent*/  {stop_s, stop_s, stop_n, stop_s, stop_s, stop_s, stop_s},
-/*wp_noisy*/    {stop_n, stop_n, stop_n, stop_n, stop_n, stop_n, stop_n},
-/*bp_nostop*/  {single, stop_s, stop_n, single, setlr , clrlrs, clrlrs},
-/*bp_silent*/  {stop_s, stop_s, stop_n, stop_s, stop_s, stop_s, stop_s},
-/*bp_noisy*/    {stop_n, stop_n, stop_n, stop_n, stop_n, stop_n, stop_n},
-/*long_jump*/  {setlr , stop_s, stop_n, setlr , err   , err   , err   },
-/*long_resume*/        {clrlr , stop_s, stop_n, clrlrs, err   , err   , err   }
+       /*       keep_c  stop_s  stop_n  single  setlr   clrlr   clrlrs  sr */
+
+/*no_effect*/  {keep_c, stop_s, stop_n, single, setlr , clrlr , clrlrs, sr},
+/*wp_silent*/  {stop_s, stop_s, stop_n, stop_s, stop_s, stop_s, stop_s, sr},
+/*wp_noisy*/    {stop_n, stop_n, stop_n, stop_n, stop_n, stop_n, stop_n, sr},
+/*bp_nostop*/  {single, stop_s, stop_n, single, setlr , clrlrs, clrlrs, sr},
+/*bp_silent*/  {stop_s, stop_s, stop_n, stop_s, stop_s, stop_s, stop_s, sr},
+/*bp_noisy*/    {stop_n, stop_n, stop_n, stop_n, stop_n, stop_n, stop_n, sr},
+/*long_jump*/  {setlr , stop_s, stop_n, setlr , err   , err   , err   , sr},
+/*long_resume*/        {clrlr , stop_s, stop_n, clrlrs, err   , err   , err   , sr},
+/*step_resume*/        {sr    , sr    , sr    , sr    , sr    , sr    , sr    , sr}
              };
 #undef keep_c
 #undef stop_s
@@ -1296,7 +1328,6 @@ bpstat_what (bs)
   struct bpstat_what retval;
 
   retval.call_dummy = 0;
-  retval.step_resume = 0;
   for (; bs != NULL; bs = bs->next)
     {
       enum class bs_class = no_effect;
@@ -1347,9 +1378,7 @@ bpstat_what (bs)
          if (bs->stop)
            {
 #endif
-             retval.step_resume = 1;
-             /* We don't handle this via the main_action.  */
-             bs_class = no_effect;
+             bs_class = step_resume;
 #if 0
            }
          else
@@ -1465,8 +1494,10 @@ breakpoint_1 (bnum, allflag)
        printf_filtered ("\n");
 
        if (b->frame)
-         printf_filtered ("\tstop only in stack frame at %s\n",
-                          local_hex_string((unsigned long) b->frame));
+         {
+           printf_filtered ("\tstop only in stack frame at ");
+           print_address_numeric (b->frame, gdb_stdout);
+           printf_filtered ("\n");
        if (b->cond)
          {
            printf_filtered ("\tstop only if ");
@@ -1545,17 +1576,20 @@ describe_other_breakpoints (pc)
       others++;
   if (others > 0)
     {
-      printf_unfiltered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
+      printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
       ALL_BREAKPOINTS (b)
        if (b->address == pc)
          {
            others--;
-           printf_unfiltered ("%d%s%s ",
-                   b->number,
-                   (b->enable == disabled) ? " (disabled)" : "",
-                   (others > 1) ? "," : ((others == 1) ? " and" : ""));
+           printf_filtered
+             ("%d%s%s ",
+              b->number,
+              (b->enable == disabled) ? " (disabled)" : "",
+              (others > 1) ? "," : ((others == 1) ? " and" : ""));
          }
-      printf_unfiltered ("also set at pc %s.\n", local_hex_string((unsigned long) pc));
+      printf_filtered ("also set at pc ");
+      print_address_numeric (pc, gdb_stdout);
+      printf_filtered (".\n");
     }
 }
 \f
@@ -1789,8 +1823,8 @@ mention (b)
       print_expression (b->exp, gdb_stdout);
       break;
     case bp_breakpoint:
-      printf_filtered ("Breakpoint %d at %s", b->number,
-                      local_hex_string((unsigned long) b->address));
+      printf_filtered ("Breakpoint %d at ", b->number);
+      print_address_numeric (b->address);
       if (b->source_file)
        printf_filtered (": file %s, line %d.",
                         b->source_file, b->line_number);
@@ -2014,8 +2048,8 @@ break_command_1 (arg, tempflag, from_tty)
 
   if (sals.nelts > 1)
     {
-      printf_unfiltered ("Multiple breakpoints were set.\n");
-      printf_unfiltered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
+      printf_filtered ("Multiple breakpoints were set.\n");
+      printf_filtered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
     }
   do_cleanups (old_chain);
 }
@@ -2149,7 +2183,7 @@ until_break_command (arg, from_tty)
       make_cleanup(delete_breakpoint, breakpoint);
     }
   
-  proceed (-1, -1, 0);
+  proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
   do_cleanups(old_chain);
 }
 \f
@@ -2619,6 +2653,7 @@ delete_breakpoint (bpt)
            val = target_insert_breakpoint (b->address, b->shadow_contents);
            if (val != 0)
              {
+               target_terminal_ours_for_output ();
                fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number);
                memory_error (val, b->address); /* which bombs us out */
              }
@@ -2640,10 +2675,14 @@ delete_breakpoint (bpt)
     free (bpt->source_file);
 
   if (xgdb_verbose && bpt->type == bp_breakpoint)
-    printf_unfiltered ("breakpoint #%d deleted\n", bpt->number);
+    {
+      target_terminal_ours_for_output ();
+      printf_unfiltered ("breakpoint #%d deleted\n", bpt->number);
+    }
 
   /* Be sure no bpstat's are pointing at it after it's been freed.  */
-  /* FIXME, how can we find all bpstat's?  We just check stop_bpstat for now. */
+  /* FIXME, how can we find all bpstat's?
+     We just check stop_bpstat for now.  */
   for (bs = stop_bpstat; bs; bs = bs->next)
     if (bs->breakpoint_at == bpt)
       bs->breakpoint_at = NULL;
This page took 0.026056 seconds and 4 git commands to generate.