* ada-lang.c (resolve_subexp): Correct arity of binary operators.
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 59cb151b516dee7b82d0c6b5be27a9d1ae5d0d74..f798710dfb83e3c723d40c8bda0eac9ab8ef16ce 100644 (file)
@@ -55,6 +55,7 @@
 #include "exceptions.h"
 #include "memattr.h"
 #include "ada-lang.h"
+#include "top.h"
 
 #include "gdb-events.h"
 #include "mi/mi-common.h"
@@ -298,14 +299,6 @@ int breakpoint_count;
 /* Pointer to current exception event record */
 static struct exception_event_record *current_exception_event;
 
-/* Indicator of whether exception catchpoints should be nuked between
-   runs of a program.  */
-int deprecated_exception_catchpoints_are_fragile = 0;
-
-/* Indicator of when exception catchpoints set-up should be
-   reinitialized -- e.g. when program is re-run.  */
-int deprecated_exception_support_initialized = 0;
-
 /* This function returns a pointer to the string representation of the
    pathname of the dynamically-linked library that has just been
    loaded.
@@ -714,7 +707,7 @@ read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr, unsigned len)
   CORE_ADDR bp_addr = 0;
   int bp_size = 0;
 
-  if (BREAKPOINT_FROM_PC (&bp_addr, &bp_size) == NULL)
+  if (gdbarch_breakpoint_from_pc (current_gdbarch, &bp_addr, &bp_size) == NULL)
     /* No breakpoints on this machine. */
     return target_read_memory (memaddr, myaddr, len);
 
@@ -971,13 +964,7 @@ Note: automatically using hardware breakpoints for read-only addresses.\n"));
       if (val)
        {
          /* Can't set the breakpoint.  */
-         if (
-#if defined (DISABLE_UNSETTABLE_BREAK)
-             DISABLE_UNSETTABLE_BREAK (bpt->address)
-#else
-             solib_address (bpt->address)
-#endif
-             )
+         if (solib_address (bpt->address))
            {
              /* See also: disable_breakpoints_in_shlibs. */
              val = 0;
@@ -1346,23 +1333,19 @@ reattach_breakpoints (int pid)
   struct bp_location *b;
   int val;
   struct cleanup *old_chain = save_inferior_ptid ();
+  struct ui_file *tmp_error_stream = mem_fileopen ();
+  int dummy1 = 0, dummy2 = 0, dummy3 = 0;
+
+  make_cleanup_ui_file_delete (tmp_error_stream);
 
-  /* Set inferior_ptid; remove_breakpoint uses this global.  */
   inferior_ptid = pid_to_ptid (pid);
   ALL_BP_LOCATIONS (b)
   {
     if (b->inserted)
       {
-       remove_breakpoint (b, mark_inserted);
-       /* Note: since we insert a breakpoint right after removing,
-          any decisions about automatically using hardware breakpoints
-          made in insert_bp_location are preserved.  */
-       if (b->loc_type == bp_loc_hardware_breakpoint)
-         val = target_insert_hw_breakpoint (&b->target_info);
-       else
-         val = target_insert_breakpoint (&b->target_info);
-       /* FIXME drow/2003-10-07: This doesn't handle any other kinds of
-          breakpoints.  It's wrong for watchpoints, for example.  */
+       b->inserted = 0;
+       val = insert_bp_location (b, tmp_error_stream,
+                                 &dummy1, &dummy2, &dummy3);
        if (val != 0)
          {
            do_cleanups (old_chain);
@@ -1423,26 +1406,11 @@ update_breakpoints_after_exec (void)
        on this target, we may not be able to stop when the vfork is
        seen, but only when the subsequent exec is seen.  (And because
        deleting fork catchpoints here but not vfork catchpoints will
-       seem mysterious to users, keep those too.)
-
-       ??rehrauer: Let's hope that merely clearing out this catchpoint's
-       target address field, if any, is sufficient to have it be reset
-       automagically.  Certainly on HP-UX that's true.
-
-       Jim Blandy <jimb@redhat.com>: Actually, zero is a perfectly
-       valid code address on some platforms (like the mn10300
-       simulators).  We shouldn't assign any special interpretation to
-       a breakpoint with a zero address.  And in fact, GDB doesn't ---
-       I can't see what that comment above is talking about.  As far
-       as I can tell, setting the address of a
-       bp_catch_exec/bp_catch_vfork/bp_catch_fork breakpoint to zero
-       is meaningless, since those are implemented with HP-UX kernel
-       hackery, not by storing breakpoint instructions somewhere.  */
+       seem mysterious to users, keep those too.)  */
     if ((b->type == bp_catch_exec) ||
        (b->type == bp_catch_vfork) ||
        (b->type == bp_catch_fork))
       {
-       b->loc->address = (CORE_ADDR) 0;
        continue;
       }
 
@@ -1485,17 +1453,6 @@ update_breakpoints_after_exec (void)
        delete_breakpoint (b);
        continue;
       }
-
-    /* If this breakpoint has survived the above battery of checks, then
-       it must have a symbolic address.  Be sure that it gets reevaluated
-       to a target address, rather than reusing the old evaluation.
-
-       Jim Blandy <jimb@redhat.com>: As explained above in the comment
-       for bp_catch_exec and friends, I'm pretty sure this is entirely
-       unnecessary.  A call to breakpoint_re_set_one always recomputes
-       the breakpoint's address from scratch, or deletes it if it can't.
-       So I think this assignment could be deleted without effect.  */
-    b->loc->address = (CORE_ADDR) 0;
   }
   /* FIXME what about longjmp breakpoints?  Re-create them here?  */
   create_overlay_event_breakpoint ("_ovly_debug_event");
@@ -1719,7 +1676,6 @@ breakpoint_init_inferior (enum inf_context context)
 {
   struct breakpoint *b, *temp;
   struct bp_location *bpt;
-  static int warning_needed = 0;
 
   ALL_BP_LOCATIONS (bpt)
     bpt->inserted = 0;
@@ -1747,7 +1703,7 @@ breakpoint_init_inferior (enum inf_context context)
        /* Likewise for watchpoints on local expressions.  */
        if (b->exp_valid_block != NULL)
          delete_breakpoint (b);
-       if (context == inf_starting) 
+       else if (context == inf_starting) 
          {
            /* Reset val field to force reread of starting value
               in insert_breakpoints.  */
@@ -1757,28 +1713,9 @@ breakpoint_init_inferior (enum inf_context context)
          }
        break;
       default:
-       /* Likewise for exception catchpoints in dynamic-linked
-          executables where required */
-       if (ep_is_exception_catchpoint (b)
-           && deprecated_exception_catchpoints_are_fragile)
-         {
-           warning_needed = 1;
-           delete_breakpoint (b);
-         }
        break;
       }
   }
-
-  if (deprecated_exception_catchpoints_are_fragile)
-    deprecated_exception_support_initialized = 0;
-
-  /* Don't issue the warning unless it's really needed... */
-  if (warning_needed && (context != inf_exited))
-    {
-      warning (_("Exception catchpoints from last run were deleted.\n"
-                "You must reinsert them explicitly."));
-      warning_needed = 0;
-    }
 }
 
 /* breakpoint_here_p (PC) returns non-zero if an enabled breakpoint
@@ -3451,7 +3388,7 @@ print_one_breakpoint (struct breakpoint *b,
 
   /* 2 */
   annotate_field (1);
-  if (((int) b->type > (sizeof (bptypes) / sizeof (bptypes[0])))
+  if (((int) b->type >= (sizeof (bptypes) / sizeof (bptypes[0])))
       || ((int) b->type != bptypes[(int) b->type].type))
     internal_error (__FILE__, __LINE__,
                    _("bptypes table does not describe type #%d."),
@@ -3471,7 +3408,7 @@ print_one_breakpoint (struct breakpoint *b,
   strcpy (wrap_indent, "                           ");
   if (addressprint)
     {
-      if (TARGET_ADDR_BIT <= 32)
+      if (gdbarch_addr_bit (current_gdbarch) <= 32)
        strcat (wrap_indent, "           ");
       else
        strcat (wrap_indent, "                   ");
@@ -3830,7 +3767,7 @@ breakpoint_1 (int bnum, int allflag)
        {
          if (nr_printable_breakpoints > 0)
            annotate_field (4);
-         if (TARGET_ADDR_BIT <= 32)
+         if (gdbarch_addr_bit (current_gdbarch) <= 32)
            ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */
          else
            ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */
@@ -3866,7 +3803,7 @@ breakpoint_1 (int bnum, int allflag)
     {
       /* Compare against (CORE_ADDR)-1 in case some compiler decides
         that a comparison of an unsigned with -1 is always false.  */
-      if (last_addr != (CORE_ADDR) -1)
+      if (last_addr != (CORE_ADDR) -1 && !server_command)
        set_next_address (last_addr);
     }
 
@@ -4511,12 +4448,11 @@ create_solib_event_breakpoint (CORE_ADDR address)
    apply to enabled breakpoints, disabled ones can just stay disabled.  */
 
 void
-disable_breakpoints_in_shlibs (int silent)
+disable_breakpoints_in_shlibs (void)
 {
   struct breakpoint *b;
   int disabled_shlib_breaks = 0;
 
-  /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */
   ALL_BREAKPOINTS (b)
   {
     if (((b->type == bp_breakpoint) || (b->type == bp_hardware_breakpoint))
@@ -4527,19 +4463,7 @@ disable_breakpoints_in_shlibs (int silent)
        && solib_address (b->loc->address)
 #endif
        )
-      {
        b->enable_state = bp_shlib_disabled;
-       if (!silent)
-         {
-           if (!disabled_shlib_breaks)
-             {
-               target_terminal_ours_for_output ();
-               warning (_("Temporarily disabling shared library breakpoints:"));
-             }
-           disabled_shlib_breaks = 1;
-           warning (_("breakpoint #%d "), b->number);
-         }
-      }
   }
 }
 
@@ -4552,7 +4476,6 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
   struct breakpoint *b;
   int disabled_shlib_breaks = 0;
 
-  /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK.  */
   ALL_BREAKPOINTS (b)
   {
     if ((b->loc->loc_type == bp_loc_hardware_breakpoint
@@ -7472,7 +7395,7 @@ breakpoint_re_set (void)
   set_language (save_language);
   input_radix = save_input_radix;
 
-  if (GET_LONGJMP_TARGET_P ())
+  if (gdbarch_get_longjmp_target_p (current_gdbarch))
     {
       create_longjmp_breakpoint ("longjmp");
       create_longjmp_breakpoint ("_longjmp");
@@ -8201,7 +8124,8 @@ breakpoint will be disabled.  The \"Address\" and \"What\" columns indicate the\
 address and file/line number respectively.\n\
 \n\
 Convenience variable \"$_\" and default examine address for \"x\"\n\
-are set to the address of the last breakpoint listed.\n\n\
+are set to the address of the last breakpoint listed unless the command\n\
+is prefixed with \"server \".\n\n\
 Convenience variable \"$bpnum\" contains the number of the last\n\
 breakpoint set."));
     }
@@ -8217,7 +8141,8 @@ breakpoint will be disabled.  The \"Address\" and \"What\" columns indicate the\
 address and file/line number respectively.\n\
 \n\
 Convenience variable \"$_\" and default examine address for \"x\"\n\
-are set to the address of the last breakpoint listed.\n\n\
+are set to the address of the last breakpoint listed unless the command\n\
+is prefixed with \"server \".\n\n\
 Convenience variable \"$bpnum\" contains the number of the last\n\
 breakpoint set."));
 
@@ -8233,7 +8158,8 @@ breakpoint will be disabled.  The \"Address\" and \"What\" columns indicate the\
 address and file/line number respectively.\n\
 \n\
 Convenience variable \"$_\" and default examine address for \"x\"\n\
-are set to the address of the last breakpoint listed.\n\n\
+are set to the address of the last breakpoint listed unless the command\n\
+is prefixed with \"server \".\n\n\
 Convenience variable \"$bpnum\" contains the number of the last\n\
 breakpoint set."));
 
@@ -8252,8 +8178,8 @@ breakpoint will be disabled.  The \"Address\" and \"What\" columns indicate the\
 address and file/line number respectively.\n\
 \n\
 Convenience variable \"$_\" and default examine address for \"x\"\n\
-are set to the address of the last breakpoint listed.\n\
-\n\
+are set to the address of the last breakpoint listed unless the command\n\
+is prefixed with \"server \".\n\n\
 Convenience variable \"$bpnum\" contains the number of the last\n\
 breakpoint set."),
           &maintenanceinfolist);
This page took 0.027146 seconds and 4 git commands to generate.