2005-01-15 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 9858176707f65b71e85f0999333b023da3a2aa09..690ec5d218a4f9c6f81b4b1df850c14246df7e31 100644 (file)
@@ -1,7 +1,7 @@
 /* Everything about breakpoints, for GDB.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -49,6 +49,9 @@
 #include "cli/cli-script.h"
 #include "gdb_assert.h"
 #include "block.h"
+#include "solist.h"
+#include "observer.h"
+#include "exceptions.h"
 
 #include "gdb-events.h"
 
@@ -84,11 +87,6 @@ static void watch_command (char *, int);
 
 static int can_use_hardware_watchpoint (struct value *);
 
-extern void break_at_finish_command (char *, int);
-extern void break_at_finish_at_depth_command (char *, int);
-
-extern void tbreak_at_finish_command (char *, int);
-
 static int break_command_1 (char *, int, int, struct breakpoint *);
 
 static void mention (struct breakpoint *);
@@ -120,8 +118,6 @@ static void condition_command (char *, int);
 
 static int get_number_trailer (char **, int);
 
-static int do_captured_parse_breakpoint (struct ui_out *, void *);
-
 void set_breakpoint_count (int);
 
 typedef enum
@@ -179,11 +175,6 @@ static void create_fork_vfork_event_catchpoint (int tempflag,
                                                char *cond_string,
                                                enum bptype bp_kind);
 
-static void break_at_finish_at_depth_command_1 (char *arg,
-                                               int flag, int from_tty);
-
-static void break_at_finish_command_1 (char *arg, int flag, int from_tty);
-
 static void stop_command (char *arg, int from_tty);
 
 static void stopin_command (char *arg, int from_tty);
@@ -323,7 +314,7 @@ int deprecated_exception_support_initialized = 0;
    unloaded.  */
 
 #ifndef SOLIB_CREATE_CATCH_UNLOAD_HOOK
-#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid,tempflag,filename,cond_string) \
+#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid, tempflag, filename, cond_string) \
    error ("catch of library unloads not yet implemented on this platform")
 #endif
 
@@ -399,7 +390,7 @@ get_number_trailer (char **pp, int trailer)
       strncpy (varname, start, p - start);
       varname[p - start] = '\0';
       val = value_of_internalvar (lookup_internalvar (varname));
-      if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT)
+      if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT)
        retval = (int) value_as_long (val);
       else
        {
@@ -718,7 +709,7 @@ deprecated_read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
 \f
 
 /* A wrapper function for inserting catchpoints.  */
-static int
+static void
 insert_catchpoint (struct ui_out *uo, void *args)
 {
   struct breakpoint *b = (struct breakpoint *) args;
@@ -741,9 +732,7 @@ insert_catchpoint (struct ui_out *uo, void *args)
     }
 
   if (val < 0)
-    throw_exception (RETURN_ERROR);
-
-  return 0;
+    throw_reason (RETURN_ERROR);
 }
 
 /* Helper routine: free the value chain for a breakpoint (watchpoint).  */
@@ -960,7 +949,7 @@ insert_bp_location (struct bp_location *bpt,
              if (VALUE_LVAL (v) == lval_memory
                  && ! VALUE_LAZY (v))
                {
-                 struct type *vtype = check_typedef (VALUE_TYPE (v));
+                 struct type *vtype = check_typedef (value_type (v));
 
                  /* We only watch structs and arrays if user asked
                     for it explicitly, never if they just happen to
@@ -972,8 +961,8 @@ insert_bp_location (struct bp_location *bpt,
                      CORE_ADDR addr;
                      int len, type;
 
-                     addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
-                     len = TYPE_LENGTH (VALUE_TYPE (v));
+                     addr = VALUE_ADDRESS (v) + value_offset (v);
+                     len = TYPE_LENGTH (value_type (v));
                      type = hw_write;
                      if (bpt->owner->type == bp_read_watchpoint)
                        type = hw_read;
@@ -1082,13 +1071,11 @@ insert_bp_location (struct bp_location *bpt,
           || bpt->owner->type == bp_catch_vfork
           || bpt->owner->type == bp_catch_exec)
     {
-      char *prefix = xstrprintf ("warning: inserting catchpoint %d: ",
-                                bpt->owner->number);
-      struct cleanup *cleanups = make_cleanup (xfree, prefix);
-      val = catch_exceptions (uiout, insert_catchpoint, bpt->owner, prefix,
-                             RETURN_MASK_ERROR);
-      do_cleanups (cleanups);
-      if (val < 0)
+      struct exception e = catch_exception (uiout, insert_catchpoint,
+                                           bpt->owner, RETURN_MASK_ERROR);
+      exception_fprintf (gdb_stderr, e, "warning: inserting catchpoint %d: ",
+                        bpt->owner->number);
+      if (e.reason < 0)
        bpt->owner->enable_state = bp_disabled;
       else
        bpt->inserted = 1;
@@ -1493,7 +1480,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
          if (VALUE_LVAL (v) == lval_memory
              && ! VALUE_LAZY (v))
            {
-             struct type *vtype = check_typedef (VALUE_TYPE (v));
+             struct type *vtype = check_typedef (value_type (v));
 
              if (v == b->owner->val_chain
                  || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -1502,8 +1489,8 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
                  CORE_ADDR addr;
                  int len, type;
 
-                 addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
-                 len = TYPE_LENGTH (VALUE_TYPE (v));
+                 addr = VALUE_ADDRESS (v) + value_offset (v);
+                 len = TYPE_LENGTH (value_type (v));
                  type   = hw_write;
                  if (b->owner->type == bp_read_watchpoint)
                    type = hw_read;
@@ -2739,15 +2726,14 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
        struct value *v;
        int found = 0;
 
-       addr = target_stopped_data_address ();
-       if (addr == 0)
+       if (!target_stopped_data_address (&current_target, &addr))
          continue;
        for (v = b->val_chain; v; v = v->next)
          {
            if (VALUE_LVAL (v) == lval_memory
                && ! VALUE_LAZY (v))
              {
-               struct type *vtype = check_typedef (VALUE_TYPE (v));
+               struct type *vtype = check_typedef (value_type (v));
 
                if (v == b->val_chain
                    || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2755,11 +2741,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
                  {
                    CORE_ADDR vaddr;
 
-                   vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
+                   vaddr = VALUE_ADDRESS (v) + value_offset (v);
                    /* Exact match not required.  Within range is
                        sufficient.  */
                    if (addr >= vaddr &&
-                       addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v)))
+                       addr < vaddr + TYPE_LENGTH (value_type (v)))
                      found = 1;
                  }
              }
@@ -3611,14 +3597,14 @@ do_captured_breakpoint_query (struct ui_out *uiout, void *data)
 }
 
 enum gdb_rc
-gdb_breakpoint_query (struct ui_out *uiout, int bnum)
+gdb_breakpoint_query (struct ui_out *uiout, int bnum, char **error_message)
 {
   struct captured_breakpoint_query_args args;
   args.bnum = bnum;
   /* For the moment we don't trust print_one_breakpoint() to not throw
      an error. */
-  return catch_exceptions (uiout, do_captured_breakpoint_query, &args,
-                          NULL, RETURN_MASK_ALL);
+  return catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args,
+                                   error_message, RETURN_MASK_ALL);
 }
 
 /* Return non-zero if B is user settable (breakpoints, watchpoints,
@@ -3923,8 +3909,8 @@ breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
   char astr1[40];
   char astr2[40];
 
-  strcpy (astr1, local_hex_string_custom ((unsigned long) from_addr, "08l"));
-  strcpy (astr2, local_hex_string_custom ((unsigned long) to_addr, "08l"));
+  strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
+  strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
   if (have_bnum)
     warning ("Breakpoint %d address previously adjusted from %s to %s.",
              bnum, astr1, astr2);
@@ -4388,6 +4374,46 @@ disable_breakpoints_in_shlibs (int silent)
   }
 }
 
+/* Disable any breakpoints that are in in an unloaded shared library.  Only
+   apply to enabled breakpoints, disabled ones can just stay disabled.  */
+
+void
+disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
+{
+  struct breakpoint *b;
+  int disabled_shlib_breaks = 0;
+
+#if defined (PC_SOLIB)
+  /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK.  */
+  ALL_BREAKPOINTS (b)
+  {
+    if ((b->loc->loc_type == bp_loc_hardware_breakpoint
+       || b->loc->loc_type == bp_loc_software_breakpoint)
+       && breakpoint_enabled (b) 
+       && !b->loc->duplicate)
+      {
+       char *so_name = PC_SOLIB (b->loc->address);
+       if (so_name 
+           && !strcmp (so_name, solib->so_name))
+          {
+           b->enable_state = bp_shlib_disabled;
+           /* At this point, we cannot rely on remove_breakpoint
+              succeeding so we must mark the breakpoint as not inserted
+              to prevent future errors occurring in remove_breakpoints.  */
+           b->loc->inserted = 0;
+           if (!disabled_shlib_breaks)
+             {
+               target_terminal_ours_for_output ();
+               warning ("Temporarily disabling breakpoints for unloaded shared library \"%s\"",
+                         so_name);
+             }
+           disabled_shlib_breaks = 1;
+         }
+      }
+  }
+#endif
+}
+
 /* Try to reenable any breakpoints in shared libraries.  */
 void
 re_enable_breakpoints_in_shlibs (void)
@@ -4429,8 +4455,9 @@ solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
   char **canonical = (char **) NULL;
   int thread = -1;             /* All threads. */
 
-  /* Set a breakpoint on the specified hook. */
-  sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical, NULL);
+  /* Set a breakpoint on the specified hook.  */
+  sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 
+                       0, &canonical, NULL);
   addr_end = hookname;
 
   if (sals.nelts == 0)
@@ -4504,7 +4531,7 @@ void
 create_solib_unload_event_breakpoint (char *hookname, int tempflag,
                                      char *dll_pathname, char *cond_string)
 {
-  solib_load_unload_1 (hookname,tempflag, dll_pathname, 
+  solib_load_unload_1 (hookname, tempflag, dll_pathname, 
                       cond_string, bp_catch_unload);
 }
 
@@ -5046,15 +5073,13 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
     }
 }
 
-static int
+static void
 do_captured_parse_breakpoint (struct ui_out *ui, void *data)
 {
   struct captured_parse_breakpoint_args *args = data;
   
   parse_breakpoint_sals (args->arg_p, args->sals_p, args->addr_string_p, 
                         args->not_found_ptr);
-
-  return GDB_RC_OK;
 }
 
 /* Set a breakpoint according to ARG (function, linenum or *address)
@@ -5067,6 +5092,7 @@ do_captured_parse_breakpoint (struct ui_out *ui, void *data)
 static int
 break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_bp)
 {
+  struct exception e;
   int tempflag, hardwareflag;
   struct symtabs_and_lines sals;
   struct expression **cond = 0;
@@ -5079,7 +5105,7 @@ break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_b
   struct cleanup *old_chain;
   struct cleanup *breakpoint_chain = NULL;
   struct captured_parse_breakpoint_args parse_args;
-  int i, rc;
+  int i;
   int pending = 0;
   int thread = -1;
   int ignore_count = 0;
@@ -5097,51 +5123,57 @@ break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_b
   parse_args.addr_string_p = &addr_string;
   parse_args.not_found_ptr = &not_found;
 
-  rc = catch_exceptions_with_msg (uiout, do_captured_parse_breakpoint, 
-                                 &parse_args, NULL, &err_msg, 
-                                 RETURN_MASK_ALL);
+  e = catch_exception (uiout, do_captured_parse_breakpoint, 
+                      &parse_args, RETURN_MASK_ALL);
 
   /* If caller is interested in rc value from parse, set value.  */
-
-  if (rc != GDB_RC_OK)
+  switch (e.reason)
     {
-      /* Check for file or function not found.  */
-      if (not_found)
+    case RETURN_QUIT:
+      exception_print (gdb_stderr, e);
+      return e.reason;
+    case RETURN_ERROR:
+      switch (e.error)
        {
-         /* If called to resolve pending breakpoint, just return error code.  */
+       case NOT_FOUND_ERROR:
+         /* If called to resolve pending breakpoint, just return
+            error code.  */
          if (pending_bp)
-           return rc;
+           return e.reason;
 
-         error_output_message (NULL, err_msg);
-         xfree (err_msg);
+         exception_print (gdb_stderr, e);
 
-         /* If pending breakpoint support is turned off, throw error.  */
+         /* If pending breakpoint support is turned off, throw
+            error.  */
 
          if (pending_break_support == AUTO_BOOLEAN_FALSE)
-           throw_exception (RETURN_ERROR);
+           throw_reason (RETURN_ERROR);
 
-          /* If pending breakpoint support is auto query and the user selects 
-            no, then simply return the error code.  */
+          /* If pending breakpoint support is auto query and the user
+            selects no, then simply return the error code.  */
          if (pending_break_support == AUTO_BOOLEAN_AUTO && 
              !nquery ("Make breakpoint pending on future shared library load? "))
-           return rc;
+           return e.reason;
 
-         /* At this point, either the user was queried about setting a 
-            pending breakpoint and selected yes, or pending breakpoint 
-            behavior is on and thus a pending breakpoint is defaulted 
-            on behalf of the user.  */
+         /* At this point, either the user was queried about setting
+            a pending breakpoint and selected yes, or pending
+            breakpoint behavior is on and thus a pending breakpoint
+            is defaulted on behalf of the user.  */
          copy_arg = xstrdup (addr_start);
          addr_string = &copy_arg;
          sals.nelts = 1;
          sals.sals = &pending_sal;
          pending_sal.pc = 0;
          pending = 1;
+         break;
+       default:
+         exception_print (gdb_stderr, e);
+         return e.reason;
        }
-      else
-       return rc;
+    default:
+      if (!sals.nelts)
+       return GDB_RC_FAIL;
     }
-  else if (!sals.nelts)
-    return GDB_RC_FAIL;
 
   /* Create a chain of things that always need to be cleaned up. */
   old_chain = make_cleanup (null_cleanup, 0);
@@ -5296,7 +5328,7 @@ struct captured_breakpoint_args
   };
 
 static int
-do_captured_breakpoint (void *data)
+do_captured_breakpoint (struct ui_out *uiout, void *data)
 {
   struct captured_breakpoint_args *args = data;
   struct symtabs_and_lines sals;
@@ -5394,7 +5426,8 @@ do_captured_breakpoint (void *data)
 enum gdb_rc
 gdb_breakpoint (char *address, char *condition,
                int hardwareflag, int tempflag,
-               int thread, int ignore_count)
+               int thread, int ignore_count,
+               char **error_message)
 {
   struct captured_breakpoint_args args;
   args.address = address;
@@ -5403,171 +5436,8 @@ gdb_breakpoint (char *address, char *condition,
   args.tempflag = tempflag;
   args.thread = thread;
   args.ignore_count = ignore_count;
-  return catch_errors (do_captured_breakpoint, &args,
-                      NULL, RETURN_MASK_ALL);
-}
-
-
-static void
-break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
-{
-  struct frame_info *frame;
-  CORE_ADDR low, high, selected_pc = 0;
-  char *extra_args = NULL;
-  char *level_arg;
-  int extra_args_len = 0, if_arg = 0;
-
-  if (!arg ||
-      (arg[0] == 'i' && arg[1] == 'f' && (arg[2] == ' ' || arg[2] == '\t')))
-    {
-
-      if (default_breakpoint_valid)
-       {
-         if (deprecated_selected_frame)
-           {
-             selected_pc = get_frame_pc (deprecated_selected_frame);
-             if (arg)
-               if_arg = 1;
-           }
-         else
-           error ("No selected frame.");
-       }
-      else
-       error ("No default breakpoint address now.");
-    }
-  else
-    {
-      extra_args = strchr (arg, ' ');
-      if (extra_args)
-       {
-         extra_args++;
-         extra_args_len = strlen (extra_args);
-         level_arg = (char *) xmalloc (extra_args - arg);
-         strncpy (level_arg, arg, extra_args - arg - 1);
-         level_arg[extra_args - arg - 1] = '\0';
-       }
-      else
-       {
-         level_arg = (char *) xmalloc (strlen (arg) + 1);
-         strcpy (level_arg, arg);
-       }
-
-      frame = parse_frame_specification (level_arg);
-      if (frame)
-       selected_pc = get_frame_pc (frame);
-      else
-       selected_pc = 0;
-    }
-  if (if_arg)
-    {
-      extra_args = arg;
-      extra_args_len = strlen (arg);
-    }
-
-  if (selected_pc)
-    {
-      if (find_pc_partial_function (selected_pc, (char **) NULL, &low, &high))
-       {
-         char *addr_string;
-         if (extra_args_len)
-           addr_string = xstrprintf ("*0x%s %s", paddr_nz (high), extra_args);
-         else
-           addr_string = xstrprintf ("*0x%s", paddr_nz (high));
-         break_command_1 (addr_string, flag, from_tty, NULL);
-         xfree (addr_string);
-       }
-      else
-       error ("No function contains the specified address");
-    }
-  else
-    error ("Unable to set breakpoint at procedure exit");
-}
-
-
-static void
-break_at_finish_command_1 (char *arg, int flag, int from_tty)
-{
-  char *addr_string, *break_string, *beg_addr_string;
-  CORE_ADDR low, high;
-  struct symtabs_and_lines sals;
-  struct symtab_and_line sal;
-  struct cleanup *old_chain;
-  char *extra_args = NULL;
-  int extra_args_len = 0;
-  int i, if_arg = 0;
-
-  if (!arg ||
-      (arg[0] == 'i' && arg[1] == 'f' && (arg[2] == ' ' || arg[2] == '\t')))
-    {
-      if (default_breakpoint_valid)
-       {
-         if (deprecated_selected_frame)
-           {
-             addr_string = xstrprintf ("*0x%s",
-                                       paddr_nz (get_frame_pc (deprecated_selected_frame)));
-             if (arg)
-               if_arg = 1;
-           }
-         else
-           error ("No selected frame.");
-       }
-      else
-       error ("No default breakpoint address now.");
-    }
-  else
-    {
-      addr_string = (char *) xmalloc (strlen (arg) + 1);
-      strcpy (addr_string, arg);
-    }
-
-  if (if_arg)
-    {
-      extra_args = arg;
-      extra_args_len = strlen (arg);
-    }
-  else if (arg)
-    {
-      /* get the stuff after the function name or address */
-      extra_args = strchr (arg, ' ');
-      if (extra_args)
-       {
-         extra_args++;
-         extra_args_len = strlen (extra_args);
-       }
-    }
-
-  sals.sals = NULL;
-  sals.nelts = 0;
-
-  beg_addr_string = addr_string;
-  sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0,
-                       (char ***) NULL, NULL);
-
-  xfree (beg_addr_string);
-  old_chain = make_cleanup (xfree, sals.sals);
-  for (i = 0; (i < sals.nelts); i++)
-    {
-      sal = sals.sals[i];
-      if (find_pc_partial_function (sal.pc, (char **) NULL, &low, &high))
-       {
-         break_string;
-         if (extra_args_len)
-           break_string = xstrprintf ("*0x%s %s", paddr_nz (high),
-                                      extra_args);
-         else
-           break_string = xstrprintf ("*0x%s", paddr_nz (high));
-         break_command_1 (break_string, flag, from_tty, NULL);
-         xfree (break_string);
-       }
-      else
-       error ("No function contains the specified address");
-    }
-  if (sals.nelts > 1)
-    {
-      warning ("Multiple breakpoints were set.\n");
-      warning ("Use the \"delete\" command to delete unwanted breakpoints.");
-    }
-  do_cleanups (old_chain);
+  return catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args,
+                                   error_message, RETURN_MASK_ALL);
 }
 
 
@@ -5626,30 +5496,12 @@ break_command (char *arg, int from_tty)
   break_command_1 (arg, 0, from_tty, NULL);
 }
 
-void
-break_at_finish_command (char *arg, int from_tty)
-{
-  break_at_finish_command_1 (arg, 0, from_tty);
-}
-
-void
-break_at_finish_at_depth_command (char *arg, int from_tty)
-{
-  break_at_finish_at_depth_command_1 (arg, 0, from_tty);
-}
-
 void
 tbreak_command (char *arg, int from_tty)
 {
   break_command_1 (arg, BP_TEMPFLAG, from_tty, NULL);
 }
 
-void
-tbreak_at_finish_command (char *arg, int from_tty)
-{
-  break_at_finish_command_1 (arg, BP_TEMPFLAG, from_tty);
-}
-
 static void
 hbreak_command (char *arg, int from_tty)
 {
@@ -5953,7 +5805,7 @@ can_use_hardware_watchpoint (struct value *v)
            {
              /* Ahh, memory we actually used!  Check if we can cover
                  it with hardware watchpoints.  */
-             struct type *vtype = check_typedef (VALUE_TYPE (v));
+             struct type *vtype = check_typedef (value_type (v));
 
              /* We only watch structs and arrays if user asked for it
                 explicitly, never if they just happen to appear in a
@@ -5962,8 +5814,8 @@ can_use_hardware_watchpoint (struct value *v)
                  || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
                      && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
                {
-                 CORE_ADDR vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
-                 int       len   = TYPE_LENGTH (VALUE_TYPE (v));
+                 CORE_ADDR vaddr = VALUE_ADDRESS (v) + value_offset (v);
+                 int       len   = TYPE_LENGTH (value_type (v));
 
                  if (!TARGET_REGION_OK_FOR_HW_WATCHPOINT (vaddr, len))
                    return 0;
@@ -6081,7 +5933,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
                                           get_frame_id (deprecated_selected_frame),
                                           bp_until);
 
-  if (!event_loop_p || !target_can_async_p ())
+  if (!target_can_async_p ())
     old_chain = make_cleanup_delete_breakpoint (breakpoint);
   else
     old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
@@ -6093,7 +5945,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
      where we get a chance to do that is in fetch_inferior_event, so
      we must set things up for that. */
 
-  if (event_loop_p && target_can_async_p ())
+  if (target_can_async_p ())
     {
       /* In this case the arg for the continuation is just the point
          in the exec_cleanups chain from where to start doing
@@ -6115,7 +5967,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
       sal.pc = get_frame_pc (prev_frame);
       breakpoint = set_momentary_breakpoint (sal, get_frame_id (prev_frame),
                                             bp_until);
-      if (!event_loop_p || !target_can_async_p ())
+      if (!target_can_async_p ())
        make_cleanup_delete_breakpoint (breakpoint);
       else
        make_exec_cleanup_delete_breakpoint (breakpoint);
@@ -6124,7 +5976,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
   proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
   /* Do the cleanups now, anly if we are not running asynchronously,
      of if we are, but the target is still synchronous. */
-  if (!event_loop_p || !target_can_async_p ())
+  if (!target_can_async_p ())
     do_cleanups (old_chain);
 }
 
@@ -6865,7 +6717,7 @@ delete_breakpoint (struct breakpoint *bpt)
      A real solution to this problem might involve reference counts in bp's,
      and/or giving them pointers back to their referencing bpstat's, and
      teaching delete_breakpoint to only free a bp's storage when no more
-     references were extent.  A cheaper bandaid was chosen. */
+     references were extent.  A cheaper bandaid was chosen.  */
   if (bpt->type == bp_none)
     return;
 
@@ -6889,7 +6741,7 @@ delete_breakpoint (struct breakpoint *bpt)
      isn't actually running.  target_enable_exception_callback for a
      null target ops vector gives an undesirable error message, so we
      check here and avoid it. Since currently (1997-09-17) only HP-UX aCC's
-     exceptions are supported in this way, it's OK for now. FIXME */
+     exceptions are supported in this way, it's OK for now.  FIXME */
   if (ep_is_exception_catchpoint (bpt) && target_has_execution)
     {
       /* Format possible error msg */
@@ -7100,6 +6952,8 @@ breakpoint_re_set_one (void *bint)
   struct breakpoint *b = (struct breakpoint *) bint;
   struct value *mark;
   int i;
+  int not_found;
+  int *not_found_ptr = NULL;
   struct symtabs_and_lines sals;
   char *s;
   enum enable_state save_enable;
@@ -7150,11 +7004,19 @@ breakpoint_re_set_one (void *bint)
       save_enable = b->enable_state;
       if (b->enable_state != bp_shlib_disabled)
         b->enable_state = bp_disabled;
+      else
+       /* If resetting a shlib-disabled breakpoint, we don't want to
+          see an error message if it is not found since we will expect
+          this to occur until the shared library is finally reloaded.
+          We accomplish this by giving decode_line_1 a pointer to use
+          for silent notification that the symbol is not found.  */
+       not_found_ptr = &not_found;
 
       set_language (b->language);
       input_radix = b->input_radix;
       s = b->addr_string;
-      sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL, NULL);
+      sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL,
+                           not_found_ptr);
       for (i = 0; i < sals.nelts; i++)
        {
          resolve_sal_pc (&sals.sals[i]);
@@ -7593,7 +7455,7 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
        {
          struct frame_id saved_frame_id;
 
-         saved_frame_id = get_frame_id (get_selected_frame ());
+         saved_frame_id = get_frame_id (get_selected_frame (NULL));
          if (bpt->exp_valid_block != NULL)
            {
              struct frame_info *fr =
@@ -7658,7 +7520,7 @@ enable_breakpoint (struct breakpoint *bpt)
 
 /* The enable command enables the specified breakpoints (or all defined
    breakpoints) so they once again become (or continue to be) effective
-   in stopping the inferior. */
+   in stopping the inferior.  */
 
 static void
 enable_command (char *args, int from_tty)
@@ -7755,6 +7617,10 @@ _initialize_breakpoint (void)
   static struct cmd_list_element *breakpoint_show_cmdlist;
   struct cmd_list_element *c;
 
+#ifdef SOLIB_ADD
+  observer_attach_solib_unloaded (disable_breakpoints_in_unloaded_shlib);
+#endif
+
   breakpoint_chain = 0;
   /* Don't bother to call set_breakpoint_count.  $bpnum isn't useful
      before a breakpoint is set.  */
This page took 0.034308 seconds and 4 git commands to generate.