2005-01-12 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index d09425eb13600730d038aa8e811ff219fe5dde48..b05bf4ec34b39284fbaca125b4c4798765a60e67 100644 (file)
@@ -1,8 +1,8 @@
 /* Everything about breakpoints, for GDB.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
-   Foundation, Inc.
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   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,12 +87,7 @@ 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 void break_command_1 (char *, int, int);
+static int break_command_1 (char *, int, int, struct breakpoint *);
 
 static void mention (struct breakpoint *);
 
@@ -97,6 +95,11 @@ struct breakpoint *set_raw_breakpoint (struct symtab_and_line, enum bptype);
 
 static void check_duplicates (struct breakpoint *);
 
+static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int);
+
+static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr,
+                                            enum bptype bptype);
+
 static void describe_other_breakpoints (CORE_ADDR, asection *);
 
 static void breakpoints_info (char *, int);
@@ -115,6 +118,8 @@ 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
@@ -124,7 +129,7 @@ typedef enum
   }
 insertion_state_t;
 
-static int remove_breakpoint (struct breakpoint *, insertion_state_t);
+static int remove_breakpoint (struct bp_location *, insertion_state_t);
 
 static enum print_stop_action print_it_typical (bpstat);
 
@@ -172,11 +177,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);
@@ -189,10 +189,6 @@ static char *ep_parse_optional_if_clause (char **arg);
 
 static char *ep_parse_optional_filename (char **arg);
 
-#if defined(CHILD_INSERT_EXEC_CATCHPOINT)
-static void catch_exec_command_1 (char *arg, int tempflag, int from_tty);
-#endif
-
 static void create_exception_catchpoint (int tempflag, char *cond_string,
                                         enum exception_event_kind ex_event,
                                         struct symtab_and_line *sal);
@@ -210,6 +206,12 @@ static void ep_skip_leading_whitespace (char **s);
    if such is available. */
 static int can_use_hw_watchpoints;
 
+/* If AUTO_BOOLEAN_FALSE, gdb will not attempt to create pending breakpoints.
+   If AUTO_BOOLEAN_TRUE, gdb will automatically create pending breakpoints
+   for unrecognized breakpoint locations.  
+   If AUTO_BOOLEAN_AUTO, gdb will query when breakpoints are unrecognized.  */
+static enum auto_boolean pending_break_support;
+
 void _initialize_breakpoint (void);
 
 extern int addressprint;       /* Print machine addresses? */
@@ -231,24 +233,25 @@ static int overlay_events_enabled;
             B ? (TMP=B->next, 1): 0;   \
             B = TMP)
 
-/* True if SHIFT_INST_REGS defined, false otherwise.  */
+/* Similar iterators for the low-level breakpoints.  */
 
-int must_shift_inst_regs =
-#if defined(SHIFT_INST_REGS)
-1
-#else
-0
-#endif
- ;
+#define ALL_BP_LOCATIONS(B)  for (B = bp_location_chain; B; B = B->next)
+
+#define ALL_BP_LOCATIONS_SAFE(B,TMP)   \
+       for (B = bp_location_chain;     \
+            B ? (TMP=B->next, 1): 0;   \
+            B = TMP)
 
 /* True if breakpoint hit counts should be displayed in breakpoint info.  */
 
 int show_breakpoint_hit_counts = 1;
 
-/* Chain of all breakpoints defined.  */
+/* Chains of all breakpoints defined.  */
 
 struct breakpoint *breakpoint_chain;
 
+struct bp_location *bp_location_chain;
+
 /* Number of last breakpoint made.  */
 
 int breakpoint_count;
@@ -256,13 +259,13 @@ 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 exception_catchpoints_are_fragile = 0;
+/* 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 exception_support_initialized = 0;
+   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
@@ -317,6 +320,13 @@ int exception_support_initialized = 0;
    error ("catch of library unloads not yet implemented on this platform")
 #endif
 
+/* Return whether a breakpoint is an active enabled breakpoint.  */
+static int
+breakpoint_enabled (struct breakpoint *b)
+{
+  return (b->enable_state == bp_enabled && !b->pending);
+}
+
 /* Set breakpoint count to NUM.  */
 
 void
@@ -382,7 +392,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
        {
@@ -512,9 +522,9 @@ get_number_or_range (char **pp)
 static void
 condition_command (char *arg, int from_tty)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
   char *p;
-  register int bnum;
+  int bnum;
 
   if (arg == 0)
     error_no_arg ("breakpoint number");
@@ -548,9 +558,12 @@ condition_command (char *arg, int from_tty)
          /* I don't know if it matters whether this is the string the user
             typed in or the decompiled expression.  */
          b->cond_string = savestring (arg, strlen (arg));
-         b->cond = parse_exp_1 (&arg, block_for_pc (b->address), 0);
-         if (*arg)
-           error ("Junk at end of expression");
+         if (!b->pending)
+           {
+             b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0);
+             if (*arg)
+               error ("Junk at end of expression");
+           }
        }
       breakpoints_changed ();
       breakpoint_modify_event (b->number);
@@ -560,13 +573,12 @@ condition_command (char *arg, int from_tty)
   error ("No breakpoint number %d.", bnum);
 }
 
-/* ARGSUSED */
 static void
 commands_command (char *arg, int from_tty)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
   char *p;
-  register int bnum;
+  int bnum;
   struct command_line *l;
 
   /* If we allowed this, we would have problems with when to
@@ -608,10 +620,10 @@ commands_command (char *arg, int from_tty)
    shadow contents, not the breakpoints themselves.  From breakpoint.c.  */
 
 int
-read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
+deprecated_read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
 {
   int status;
-  struct breakpoint *b;
+  struct bp_location *b;
   CORE_ADDR bp_addr = 0;
   int bp_size = 0;
 
@@ -619,19 +631,14 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
     /* No breakpoints on this machine. */
     return target_read_memory (memaddr, myaddr, len);
 
-  ALL_BREAKPOINTS (b)
+  ALL_BP_LOCATIONS (b)
   {
-    if (b->type == bp_none)
-      warning ("reading through apparently deleted breakpoint #%d?", 
-              b->number);
+    if (b->owner->type == bp_none)
+      warning ("reading through apparently deleted breakpoint #%d?",
+              b->owner->number);
 
-    /* memory breakpoint? */
-    if (b->type == bp_watchpoint
-       || b->type == bp_hardware_watchpoint
-       || b->type == bp_read_watchpoint
-       || b->type == bp_access_watchpoint)
+    if (b->loc_type != bp_loc_software_breakpoint)
       continue;
-    /* bp in memory? */
     if (!b->inserted)
       continue;
     /* Addresses and length of the part of the breakpoint that
@@ -681,7 +688,7 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
       if (bp_addr > memaddr)
        {
          /* Copy the section of memory before the breakpoint.  */
-         status = read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr);
+         status = deprecated_read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr);
          if (status != 0)
            return status;
        }
@@ -689,7 +696,7 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
       if (bp_addr + bp_size < memaddr + len)
        {
          /* Copy the section of memory after the breakpoint.  */
-         status = read_memory_nobpt (bp_addr + bp_size,
+         status = deprecated_read_memory_nobpt (bp_addr + bp_size,
                                      myaddr + bp_addr + bp_size - memaddr,
                                      memaddr + len - (bp_addr + bp_size));
          if (status != 0)
@@ -727,378 +734,421 @@ insert_catchpoint (struct ui_out *uo, void *args)
     }
 
   if (val < 0)
-    throw_exception (RETURN_ERROR);
+    throw_reason (RETURN_ERROR);
 
   return 0;
 }
 
-/* insert_breakpoints is used when starting or continuing the program.
-   remove_breakpoints is used when the program stops.
-   Both return zero if successful,
-   or an `errno' value if could not write the inferior.  */
+/* Helper routine: free the value chain for a breakpoint (watchpoint).  */
 
-int
-insert_breakpoints (void)
+static void free_valchain (struct bp_location *b)
 {
-  register struct breakpoint *b, *temp;
-  int return_val = 0;  /* return success code. */
-  int val = 0;
-  int disabled_breaks = 0;
-  int hw_breakpoint_error = 0;
-#ifdef ONE_PROCESS_WRITETEXT
-  int process_warning = 0;
-#endif
+  struct value *v;
+  struct value *n;
 
-  struct ui_file *tmp_error_stream = mem_fileopen ();
-  make_cleanup_ui_file_delete (tmp_error_stream);
+  /* Free the saved value chain.  We will construct a new one
+     the next time the watchpoint is inserted.  */
+  for (v = b->owner->val_chain; v; v = n)
+    {
+      n = v->next;
+      value_free (v);
+    }
+  b->owner->val_chain = NULL;
+}
 
-  /* Explicitly mark the warning -- this will only be printed if
-     there was an error.  */
-  fprintf_unfiltered (tmp_error_stream, "Warning:\n");
+/* Insert a low-level "breakpoint" of some type.  BPT is the breakpoint.
+   Any error messages are printed to TMP_ERROR_STREAM; and DISABLED_BREAKS,
+   PROCESS_WARNING, and HW_BREAKPOINT_ERROR are used to report problems.
 
-  ALL_BREAKPOINTS_SAFE (b, temp)
-  {
-    /* Permanent breakpoints cannot be inserted or removed.  Disabled
-       breakpoints should not be inserted.  */
-    if (b->enable_state != bp_enabled)
-      continue;
+   NOTE drow/2003-09-09: This routine could be broken down to an object-style
+   method for each breakpoint or catchpoint type.  */
+static int
+insert_bp_location (struct bp_location *bpt,
+                   struct ui_file *tmp_error_stream,
+                   int *disabled_breaks, int *process_warning,
+                   int *hw_breakpoint_error)
+{
+  int val = 0;
 
-    if ((b->type == bp_watchpoint
-        || b->type == bp_hardware_watchpoint
-        || b->type == bp_read_watchpoint
-        || b->type == bp_access_watchpoint) && (!b->val))
-      {
-       struct value *val;
-       val = evaluate_expression (b->exp);
-       release_value (val);
-       if (VALUE_LAZY (val))
-         value_fetch_lazy (val);
-       b->val = val;
-      } 
-    if (b->type != bp_watchpoint
-       && b->type != bp_hardware_watchpoint
-       && b->type != bp_read_watchpoint
-       && b->type != bp_access_watchpoint
-       && b->type != bp_catch_fork
-       && b->type != bp_catch_vfork
-       && b->type != bp_catch_exec
-       && b->type != bp_catch_throw
-       && b->type != bp_catch_catch
-       && !b->inserted
-       && !b->duplicate)
-      {
-       /* "Normal" instruction breakpoint: either the standard
-          trap-instruction bp (bp_breakpoint), or a
-          bp_hardware_breakpoint.  */
-
-       /* First check to see if we have to handle an overlay.  */
-       if (overlay_debugging == ovly_off
-           || b->section == NULL
-           || !(section_is_overlay (b->section)))
-         {
-           /* No overlay handling: just set the breakpoint.  */
+  /* Permanent breakpoints cannot be inserted or removed.  Disabled
+     breakpoints should not be inserted.  */
+  if (!breakpoint_enabled (bpt->owner))
+    return 0;
 
-           if (b->type == bp_hardware_breakpoint)
-             val = target_insert_hw_breakpoint (b->address, 
-                                                b->shadow_contents);
-           else
-             val = target_insert_breakpoint (b->address, b->shadow_contents);
-         }
-       else
-         {
-           /* This breakpoint is in an overlay section.  
-              Shall we set a breakpoint at the LMA?  */
-           if (!overlay_events_enabled)
-             {
-               /* Yes -- overlay event support is not active, 
-                  so we must try to set a breakpoint at the LMA.
-                  This will not work for a hardware breakpoint.  */
-               if (b->type == bp_hardware_breakpoint)
-                 warning ("hardware breakpoint %d not supported in overlay!\n",
-                          b->number);
-               else
-                 {
-                   CORE_ADDR addr = overlay_unmapped_address (b->address, 
-                                                              b->section);
-                   /* Set a software (trap) breakpoint at the LMA.  */
-                   val = target_insert_breakpoint (addr, b->shadow_contents);
-                   if (val != 0)
-                     fprintf_unfiltered (tmp_error_stream, 
-                                         "Overlay breakpoint %d failed: in ROM?", 
-                                         b->number);
-                 }
-             }
-           /* Shall we set a breakpoint at the VMA? */
-           if (section_is_mapped (b->section))
-             {
-               /* Yes.  This overlay section is mapped into memory.  */
-               if (b->type == bp_hardware_breakpoint)
-                 val = target_insert_hw_breakpoint (b->address, 
-                                                    b->shadow_contents);
-               else
-                 val = target_insert_breakpoint (b->address,
-                                                 b->shadow_contents);
-             }
-           else
-             {
-               /* No.  This breakpoint will not be inserted.  
-                  No error, but do not mark the bp as 'inserted'.  */
-               continue;
-             }
-         }
+  if (bpt->inserted || bpt->duplicate)
+    return 0;
 
-       if (val)
-         {
-           /* Can't set the breakpoint.  */
-#if defined (DISABLE_UNSETTABLE_BREAK)
-           if (DISABLE_UNSETTABLE_BREAK (b->address))
-             {
-               /* See also: disable_breakpoints_in_shlibs. */
-               val = 0;
-               b->enable_state = bp_shlib_disabled;
-               if (!disabled_breaks)
-                 {
-                   fprintf_unfiltered (tmp_error_stream, 
-                                       "Cannot insert breakpoint %d.\n", 
-                                       b->number);
+  if (bpt->loc_type == bp_loc_software_breakpoint
+      || bpt->loc_type == bp_loc_hardware_breakpoint)
+    {
+      /* First check to see if we have to handle an overlay.  */
+      if (overlay_debugging == ovly_off
+         || bpt->section == NULL
+         || !(section_is_overlay (bpt->section)))
+       {
+         /* No overlay handling: just set the breakpoint.  */
+
+         if (bpt->loc_type == bp_loc_hardware_breakpoint)
+           val = target_insert_hw_breakpoint (bpt->address, 
+                                              bpt->shadow_contents);
+         else
+           val = target_insert_breakpoint (bpt->address,
+                                           bpt->shadow_contents);
+       }
+      else
+       {
+         /* This breakpoint is in an overlay section.  
+            Shall we set a breakpoint at the LMA?  */
+         if (!overlay_events_enabled)
+           {
+             /* Yes -- overlay event support is not active, 
+                so we must try to set a breakpoint at the LMA.
+                This will not work for a hardware breakpoint.  */
+             if (bpt->loc_type == bp_loc_hardware_breakpoint)
+               warning ("hardware breakpoint %d not supported in overlay!\n",
+                        bpt->owner->number);
+             else
+               {
+                 CORE_ADDR addr = overlay_unmapped_address (bpt->address,
+                                                            bpt->section);
+                 /* Set a software (trap) breakpoint at the LMA.  */
+                 val = target_insert_breakpoint (addr, bpt->shadow_contents);
+                 if (val != 0)
                    fprintf_unfiltered (tmp_error_stream, 
-                                       "Temporarily disabling shared library breakpoints:\n");
-                 }
-               disabled_breaks = 1;
-               fprintf_unfiltered (tmp_error_stream, 
-                                   "breakpoint #%d\n", b->number);
-             }
-           else
+                                       "Overlay breakpoint %d failed: in ROM?", 
+                                       bpt->owner->number);
+               }
+           }
+         /* Shall we set a breakpoint at the VMA? */
+         if (section_is_mapped (bpt->section))
+           {
+             /* Yes.  This overlay section is mapped into memory.  */
+             if (bpt->loc_type == bp_loc_hardware_breakpoint)
+               val = target_insert_hw_breakpoint (bpt->address, 
+                                                  bpt->shadow_contents);
+             else
+               val = target_insert_breakpoint (bpt->address,
+                                               bpt->shadow_contents);
+           }
+         else
+           {
+             /* No.  This breakpoint will not be inserted.  
+                No error, but do not mark the bp as 'inserted'.  */
+             return 0;
+           }
+       }
+
+      if (val)
+       {
+         /* Can't set the breakpoint.  */
+#if defined (DISABLE_UNSETTABLE_BREAK)
+         if (DISABLE_UNSETTABLE_BREAK (bpt->address))
+           {
+             /* See also: disable_breakpoints_in_shlibs. */
+             val = 0;
+             bpt->owner->enable_state = bp_shlib_disabled;
+             if (!*disabled_breaks)
+               {
+                 fprintf_unfiltered (tmp_error_stream, 
+                                     "Cannot insert breakpoint %d.\n", 
+                                     bpt->owner->number);
+                 fprintf_unfiltered (tmp_error_stream, 
+                                     "Temporarily disabling shared library breakpoints:\n");
+               }
+             *disabled_breaks = 1;
+             fprintf_unfiltered (tmp_error_stream,
+                                 "breakpoint #%d\n", bpt->owner->number);
+           }
+         else
 #endif
-             {
+           {
 #ifdef ONE_PROCESS_WRITETEXT
-               process_warning = 1;
+             *process_warning = 1;
 #endif
-               if (b->type == bp_hardware_breakpoint)
-                 {
-                   hw_breakpoint_error = 1;
-                   fprintf_unfiltered (tmp_error_stream, 
-                                       "Cannot insert hardware breakpoint %d.\n",
-                                       b->number);
-                 }
-               else
-                 {
-                   fprintf_unfiltered (tmp_error_stream, 
-                                       "Cannot insert breakpoint %d.\n", 
-                                       b->number);
-                   fprintf_filtered (tmp_error_stream, 
-                                     "Error accessing memory address ");
-                   print_address_numeric (b->address, 1, tmp_error_stream);
-                   fprintf_filtered (tmp_error_stream, ": %s.\n",
-                                     safe_strerror (val));
-                 }
+             if (bpt->loc_type == bp_loc_hardware_breakpoint)
+               {
+                 *hw_breakpoint_error = 1;
+                 fprintf_unfiltered (tmp_error_stream, 
+                                     "Cannot insert hardware breakpoint %d.\n",
+                                     bpt->owner->number);
+               }
+             else
+               {
+                 fprintf_unfiltered (tmp_error_stream, 
+                                     "Cannot insert breakpoint %d.\n", 
+                                     bpt->owner->number);
+                 fprintf_filtered (tmp_error_stream, 
+                                   "Error accessing memory address ");
+                 print_address_numeric (bpt->address, 1, tmp_error_stream);
+                 fprintf_filtered (tmp_error_stream, ": %s.\n",
+                                   safe_strerror (val));
+               }
 
-             }
-         }
-       else
-         b->inserted = 1;
+           }
+       }
+      else
+       bpt->inserted = 1;
 
-       if (val)
-         return_val = val;     /* remember failure */
-      }
-    else if (ep_is_exception_catchpoint (b)
-            && !b->inserted
-            && !b->duplicate)
+      return val;
+    }
 
-      {
-       /* If we get here, we must have a callback mechanism for exception
-          events -- with g++ style embedded label support, we insert
-          ordinary breakpoints and not catchpoints. */
-       val = target_insert_breakpoint (b->address, b->shadow_contents);
-       if (val)
-         {
-           /* Couldn't set breakpoint for some reason */
-           fprintf_unfiltered (tmp_error_stream, 
-                               "Cannot insert catchpoint %d; disabling it.\n",
-                               b->number);
-           fprintf_filtered (tmp_error_stream, 
-                             "Error accessing memory address ");
-           print_address_numeric (b->address, 1, tmp_error_stream);
-           fprintf_filtered (tmp_error_stream, ": %s.\n",
-                             safe_strerror (val));
-           b->enable_state = bp_disabled;
-         }
-       else
-         {
-           /* Bp set, now make sure callbacks are enabled */
-           /* Format possible error msg */
-           char *message = xstrprintf ("Error inserting catchpoint %d:\n",
-                                       b->number);
-           struct cleanup *cleanups = make_cleanup (xfree, message);
-           int val;
-           args_for_catchpoint_enable args;
-           args.kind = b->type == bp_catch_catch ? 
-             EX_EVENT_CATCH : EX_EVENT_THROW;
-           args.enable_p = 1;
-           val = catch_errors (cover_target_enable_exception_callback,
-                               &args, message, RETURN_MASK_ALL);
-           do_cleanups (cleanups);
-           if (val != 0 && val != -1)
-             {
-               b->inserted = 1;
-             }
-           /* Check if something went wrong; val == 0 can be ignored */
-           if (val == -1)
-             {
-               /* something went wrong */
-               fprintf_unfiltered (tmp_error_stream, 
-                                   "Cannot insert catchpoint %d; disabling it.\n",
-                                   b->number);
-               b->enable_state = bp_disabled;
-             }
-         }
+  else if (bpt->loc_type == bp_loc_hardware_watchpoint
+          /* NOTE drow/2003-09-08: This state only exists for removing
+             watchpoints.  It's not clear that it's necessary... */
+          && bpt->owner->disposition != disp_del_at_next_stop)
+    {
+      /* FIXME drow/2003-09-08: This code sets multiple hardware watchpoints
+        based on the expression.  Ideally this should happen at a higher level,
+        and there should be one bp_location for each computed address we
+        must watch.  As soon as a many-to-one mapping is available I'll
+        convert this.  */
 
-       if (val)
-         return_val = val;     /* remember failure */
-      }
+      int within_current_scope;
+      struct value *mark = value_mark ();
+      struct value *v;
+      struct frame_id saved_frame_id;
+
+      /* Save the current frame's ID so we can restore it after
+        evaluating the watchpoint expression on its own frame.  */
+      /* FIXME drow/2003-09-09: It would be nice if evaluate_expression
+        took a frame parameter, so that we didn't have to change the
+        selected frame.  */
+      saved_frame_id = get_frame_id (deprecated_selected_frame);
+
+      /* Determine if the watchpoint is within scope.  */
+      if (bpt->owner->exp_valid_block == NULL)
+       within_current_scope = 1;
+      else
+       {
+         struct frame_info *fi;
+         fi = frame_find_by_id (bpt->owner->watchpoint_frame);
+         within_current_scope = (fi != NULL);
+         if (within_current_scope)
+           select_frame (fi);
+       }
 
-    else if ((b->type == bp_hardware_watchpoint ||
-             b->type == bp_read_watchpoint ||
-             b->type == bp_access_watchpoint)
-            && b->disposition != disp_del_at_next_stop
-            && !b->inserted
-            && !b->duplicate)
-      {
-       struct frame_info *saved_frame;
-       int saved_level, within_current_scope;
-       struct value *mark = value_mark ();
-       struct value *v;
+      if (within_current_scope)
+       {
+         free_valchain (bpt);
 
-       /* Save the current frame and level so we can restore it after
-          evaluating the watchpoint expression on its own frame.  */
-       saved_frame = deprecated_selected_frame;
-       saved_level = frame_relative_level (deprecated_selected_frame);
+         /* Evaluate the expression and cut the chain of values
+            produced off from the value chain.
 
-       /* Determine if the watchpoint is within scope.  */
-       if (b->exp_valid_block == NULL)
-         within_current_scope = 1;
-       else
-         {
-           struct frame_info *fi;
-           fi = frame_find_by_id (b->watchpoint_frame);
-           within_current_scope = (fi != NULL);
-           if (within_current_scope)
-             select_frame (fi);
-         }
+            Make sure the value returned isn't lazy; we use
+            laziness to determine what memory GDB actually needed
+            in order to compute the value of the expression.  */
+         v = evaluate_expression (bpt->owner->exp);
+         VALUE_CONTENTS (v);
+         value_release_to_mark (mark);
 
-       if (within_current_scope)
-         {
-           /* Evaluate the expression and cut the chain of values
-              produced off from the value chain.
+         bpt->owner->val_chain = v;
+         bpt->inserted = 1;
 
-              Make sure the value returned isn't lazy; we use
-              laziness to determine what memory GDB actually needed
-              in order to compute the value of the expression.  */
-           v = evaluate_expression (b->exp);
-           VALUE_CONTENTS(v);
-           value_release_to_mark (mark);
+         /* Look at each value on the value chain.  */
+         for (; v; v = v->next)
+           {
+             /* If it's a memory location, and GDB actually needed
+                its contents to evaluate the expression, then we
+                must watch it.  */
+             if (VALUE_LVAL (v) == lval_memory
+                 && ! VALUE_LAZY (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 the middle of some value chain.  */
+                 if (v == bpt->owner->val_chain
+                     || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
+                         && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
+                   {
+                     CORE_ADDR addr;
+                     int len, type;
+
+                     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;
+                     else if (bpt->owner->type == bp_access_watchpoint)
+                       type = hw_access;
+
+                     val = target_insert_watchpoint (addr, len, type);
+                     if (val == -1)
+                       {
+                         /* Don't exit the loop, try to insert
+                            every value on the value chain.  That's
+                            because we will be removing all the
+                            watches below, and removing a
+                            watchpoint we didn't insert could have
+                            adverse effects.  */
+                         bpt->inserted = 0;
+                       }
+                     val = 0;
+                   }
+               }
+           }
+         /* Failure to insert a watchpoint on any memory value in the
+            value chain brings us here.  */
+         if (!bpt->inserted)
+           {
+             remove_breakpoint (bpt, mark_uninserted);
+             *hw_breakpoint_error = 1;
+             fprintf_unfiltered (tmp_error_stream,
+                                 "Could not insert hardware watchpoint %d.\n", 
+                                 bpt->owner->number);
+             val = -1;
+           }               
+       }
+      else
+       {
+         printf_filtered ("Hardware watchpoint %d deleted ", bpt->owner->number);
+         printf_filtered ("because the program has left the block \n");
+         printf_filtered ("in which its expression is valid.\n");
+         if (bpt->owner->related_breakpoint)
+           bpt->owner->related_breakpoint->disposition = disp_del_at_next_stop;
+         bpt->owner->disposition = disp_del_at_next_stop;
+       }
 
-           b->val_chain = v;
-           b->inserted = 1;
+      /* Restore the selected frame.  */
+      select_frame (frame_find_by_id (saved_frame_id));
 
-           /* Look at each value on the value chain.  */
-           for (; v; v = v->next)
-             {
-               /* If it's a memory location, and GDB actually needed
-                   its contents to evaluate the expression, then we
-                   must watch it.  */
-               if (VALUE_LVAL (v) == lval_memory
-                   && ! VALUE_LAZY (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 the middle of some value chain.  */
-                   if (v == b->val_chain
-                       || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
-                           && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
-                     {
-                       CORE_ADDR addr;
-                       int len, type;
-
-                       addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
-                       len = TYPE_LENGTH (VALUE_TYPE (v));
-                       type = hw_write;
-                       if (b->type == bp_read_watchpoint)
-                         type = hw_read;
-                       else if (b->type == bp_access_watchpoint)
-                         type = hw_access;
-
-                       val = target_insert_watchpoint (addr, len, type);
-                       if (val == -1)
-                         {
-                           /* Don't exit the loop, try to insert
-                              every value on the value chain.  That's
-                              because we will be removing all the
-                              watches below, and removing a
-                              watchpoint we didn't insert could have
-                              adverse effects.  */
-                           b->inserted = 0;
-                         }
-                       val = 0;
-                     }
-                 }
-             }
-           /* Failure to insert a watchpoint on any memory value in the
-              value chain brings us here.  */
-           if (!b->inserted)
-             {
-               remove_breakpoint (b, mark_uninserted);
-               hw_breakpoint_error = 1;
-               fprintf_unfiltered (tmp_error_stream,
-                                   "Could not insert hardware watchpoint %d.\n", 
-                                   b->number);
-               val = -1;
-             }               
-         }
-       else
-         {
-           printf_filtered ("Hardware watchpoint %d deleted ", b->number);
-           printf_filtered ("because the program has left the block \n");
-           printf_filtered ("in which its expression is valid.\n");
-           if (b->related_breakpoint)
-             b->related_breakpoint->disposition = disp_del_at_next_stop;
-           b->disposition = disp_del_at_next_stop;
-         }
+      return val;
+    }
 
-       /* Restore the frame and level.  */
-       if ((saved_frame != deprecated_selected_frame) ||
-           (saved_level != frame_relative_level (deprecated_selected_frame)))
-         select_frame (saved_frame);
+  else if (ep_is_exception_catchpoint (bpt->owner))
+    {
+      /* FIXME drow/2003-09-09: This code sets both a catchpoint and a
+        breakpoint.  Once again, it would be better if this was represented
+        as two bp_locations.  */
 
-       if (val)
-         return_val = val;     /* remember failure */
-      }
-    else if ((b->type == bp_catch_fork
-             || b->type == bp_catch_vfork
-             || b->type == bp_catch_exec)
-            && !b->inserted
-            && !b->duplicate)
-      {
-       char *prefix = xstrprintf ("warning: inserting catchpoint %d: ",
-                                  b->number);
-       struct cleanup *cleanups = make_cleanup (xfree, prefix);
-       val = catch_exceptions (uiout, insert_catchpoint, b, prefix,
-                               RETURN_MASK_ERROR);
-       do_cleanups (cleanups);
-       if (val < 0)
-         b->enable_state = bp_disabled;
-       else
-         b->inserted = 1;
-      }
-  }
-  
-  if (return_val) 
+      /* If we get here, we must have a callback mechanism for exception
+        events -- with g++ style embedded label support, we insert
+        ordinary breakpoints and not catchpoints. */
+      val = target_insert_breakpoint (bpt->address, bpt->shadow_contents);
+      if (val)
+       {
+         /* Couldn't set breakpoint for some reason */
+         fprintf_unfiltered (tmp_error_stream, 
+                             "Cannot insert catchpoint %d; disabling it.\n",
+                             bpt->owner->number);
+         fprintf_filtered (tmp_error_stream, 
+                           "Error accessing memory address ");
+         print_address_numeric (bpt->address, 1, tmp_error_stream);
+         fprintf_filtered (tmp_error_stream, ": %s.\n",
+                           safe_strerror (val));
+         bpt->owner->enable_state = bp_disabled;
+       }
+      else
+       {
+         /* Bp set, now make sure callbacks are enabled */
+         /* Format possible error msg */
+         char *message = xstrprintf ("Error inserting catchpoint %d:\n",
+                                     bpt->owner->number);
+         struct cleanup *cleanups = make_cleanup (xfree, message);
+         int val;
+         args_for_catchpoint_enable args;
+         args.kind = bpt->owner->type == bp_catch_catch ? 
+           EX_EVENT_CATCH : EX_EVENT_THROW;
+         args.enable_p = 1;
+         val = catch_errors (cover_target_enable_exception_callback,
+                             &args, message, RETURN_MASK_ALL);
+         do_cleanups (cleanups);
+         if (val != 0 && val != -1)
+           bpt->inserted = 1;
+
+         /* Check if something went wrong; val == 0 can be ignored */
+         if (val == -1)
+           {
+             /* something went wrong */
+             fprintf_unfiltered (tmp_error_stream, 
+                                 "Cannot insert catchpoint %d; disabling it.\n",
+                                 bpt->owner->number);
+             bpt->owner->enable_state = bp_disabled;
+           }
+       }
+
+      return val;
+    }
+
+  else if (bpt->owner->type == bp_catch_fork
+          || 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)
+       bpt->owner->enable_state = bp_disabled;
+      else
+       bpt->inserted = 1;
+
+      /* We've already printed an error message if there was a problem
+        inserting this catchpoint, and we've disabled the catchpoint,
+        so just return success.  */
+      return 0;
+    }
+
+  return 0;
+}
+
+/* insert_breakpoints is used when starting or continuing the program.
+   remove_breakpoints is used when the program stops.
+   Both return zero if successful,
+   or an `errno' value if could not write the inferior.  */
+
+int
+insert_breakpoints (void)
+{
+  struct bp_location *b, *temp;
+  int return_val = 0;  /* return success code. */
+  int val = 0;
+  int disabled_breaks = 0;
+  int hw_breakpoint_error = 0;
+  int process_warning = 0;
+
+  struct ui_file *tmp_error_stream = mem_fileopen ();
+  make_cleanup_ui_file_delete (tmp_error_stream);
+
+  /* Explicitly mark the warning -- this will only be printed if
+     there was an error.  */
+  fprintf_unfiltered (tmp_error_stream, "Warning:\n");
+
+  ALL_BP_LOCATIONS_SAFE (b, temp)
+    {
+      /* Permanent breakpoints cannot be inserted or removed.  Disabled
+        breakpoints should not be inserted.  */
+      if (!breakpoint_enabled (b->owner))
+       continue;
+
+      /* FIXME drow/2003-10-07: This code should be pushed elsewhere when
+        hardware watchpoints are split into multiple loc breakpoints.  */
+      if ((b->loc_type == bp_loc_hardware_watchpoint
+          || b->owner->type == bp_watchpoint) && !b->owner->val)
+       {
+         struct value *val;
+         val = evaluate_expression (b->owner->exp);
+         release_value (val);
+         if (VALUE_LAZY (val))
+           value_fetch_lazy (val);
+         b->owner->val = val;
+       }
+
+      val = insert_bp_location (b, tmp_error_stream,
+                                   &disabled_breaks, &process_warning,
+                                   &hw_breakpoint_error);
+      if (val)
+       return_val = val;
+    }
+
+  if (return_val)
     {
       /* If a hardware breakpoint or watchpoint was inserted, add a
          message about possibly exhausted resources.  */
-      if (hw_breakpoint_error)  
+      if (hw_breakpoint_error)
        {
          fprintf_unfiltered (tmp_error_stream, 
                              "Could not insert hardware breakpoints:\n\
@@ -1118,10 +1168,10 @@ You may have requested too many hardware breakpoints/watchpoints.\n");
 int
 remove_breakpoints (void)
 {
-  register struct breakpoint *b;
+  struct bp_location *b;
   int val;
 
-  ALL_BREAKPOINTS (b)
+  ALL_BP_LOCATIONS (b)
   {
     if (b->inserted)
       {
@@ -1136,15 +1186,12 @@ remove_breakpoints (void)
 int
 remove_hw_watchpoints (void)
 {
-  register struct breakpoint *b;
+  struct bp_location *b;
   int val;
 
-  ALL_BREAKPOINTS (b)
+  ALL_BP_LOCATIONS (b)
   {
-    if (b->inserted
-       && (b->type == bp_hardware_watchpoint
-           || b->type == bp_read_watchpoint
-           || b->type == bp_access_watchpoint))
+    if (b->inserted && b->loc_type == bp_loc_hardware_watchpoint)
       {
        val = remove_breakpoint (b, mark_uninserted);
        if (val != 0)
@@ -1157,21 +1204,23 @@ remove_hw_watchpoints (void)
 int
 reattach_breakpoints (int pid)
 {
-  register struct breakpoint *b;
+  struct bp_location *b;
   int val;
   struct cleanup *old_chain = save_inferior_ptid ();
 
   /* Set inferior_ptid; remove_breakpoint uses this global.  */
   inferior_ptid = pid_to_ptid (pid);
-  ALL_BREAKPOINTS (b)
+  ALL_BP_LOCATIONS (b)
   {
     if (b->inserted)
       {
        remove_breakpoint (b, mark_inserted);
-       if (b->type == bp_hardware_breakpoint)
+       if (b->loc_type == bp_loc_hardware_breakpoint)
          val = target_insert_hw_breakpoint (b->address, b->shadow_contents);
        else
          val = target_insert_breakpoint (b->address, b->shadow_contents);
+       /* FIXME drow/2003-10-07: This doesn't handle any other kinds of
+          breakpoints.  It's wrong for watchpoints, for example.  */
        if (val != 0)
          {
            do_cleanups (old_chain);
@@ -1246,11 +1295,11 @@ update_breakpoints_after_exec (void)
        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 OBSOLETE mn10200
-       and 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
+       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.  */
@@ -1258,7 +1307,7 @@ update_breakpoints_after_exec (void)
        (b->type == bp_catch_vfork) ||
        (b->type == bp_catch_fork))
       {
-       b->address = (CORE_ADDR) NULL;
+       b->loc->address = (CORE_ADDR) NULL;
        continue;
       }
 
@@ -1311,7 +1360,7 @@ update_breakpoints_after_exec (void)
        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->address = (CORE_ADDR) NULL;
+    b->loc->address = (CORE_ADDR) NULL;
   }
   /* FIXME what about longjmp breakpoints?  Re-create them here?  */
   create_overlay_event_breakpoint ("_ovly_debug_event");
@@ -1320,7 +1369,7 @@ update_breakpoints_after_exec (void)
 int
 detach_breakpoints (int pid)
 {
-  register struct breakpoint *b;
+  struct bp_location *b;
   int val;
   struct cleanup *old_chain = save_inferior_ptid ();
 
@@ -1329,7 +1378,7 @@ detach_breakpoints (int pid)
 
   /* Set inferior_ptid; remove_breakpoint uses this global.  */
   inferior_ptid = pid_to_ptid (pid);
-  ALL_BREAKPOINTS (b)
+  ALL_BP_LOCATIONS (b)
   {
     if (b->inserted)
       {
@@ -1346,27 +1395,20 @@ detach_breakpoints (int pid)
 }
 
 static int
-remove_breakpoint (struct breakpoint *b, insertion_state_t is)
+remove_breakpoint (struct bp_location *b, insertion_state_t is)
 {
   int val;
 
-  if (b->enable_state == bp_permanent)
+  if (b->owner->enable_state == bp_permanent)
     /* Permanent breakpoints cannot be inserted or removed.  */
     return 0;
 
-  if (b->type == bp_none)
+  if (b->owner->type == bp_none)
     warning ("attempted to remove apparently deleted breakpoint #%d?", 
-            b->number);
-
-  if (b->type != bp_watchpoint
-      && b->type != bp_hardware_watchpoint
-      && b->type != bp_read_watchpoint
-      && b->type != bp_access_watchpoint
-      && b->type != bp_catch_fork
-      && b->type != bp_catch_vfork
-      && b->type != bp_catch_exec
-      && b->type != bp_catch_catch
-      && b->type != bp_catch_throw)
+            b->owner->number);
+
+  if (b->loc_type == bp_loc_software_breakpoint
+      || b->loc_type == bp_loc_hardware_breakpoint)
     {
       /* "Normal" instruction breakpoint: either the standard
         trap-instruction bp (bp_breakpoint), or a
@@ -1379,7 +1421,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
        {
          /* No overlay handling: just remove the breakpoint.  */
 
-         if (b->type == bp_hardware_breakpoint)
+         if (b->loc_type == bp_loc_hardware_breakpoint)
            val = target_remove_hw_breakpoint (b->address, 
                                               b->shadow_contents);
          else
@@ -1398,7 +1440,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
                                                           b->section);
                /* Ignore any failures: if the LMA is in ROM, we will
                   have already warned when we failed to insert it.  */
-               if (b->type != bp_hardware_breakpoint)
+               if (b->loc_type == bp_loc_hardware_breakpoint)
                  target_remove_hw_breakpoint (addr, b->shadow_contents);
                else
                  target_remove_breakpoint (addr, b->shadow_contents);
@@ -1411,7 +1453,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
                 remove the breakpoint if the section had been
                 unmapped, but let's not rely on that being safe.  We
                 don't know what the overlay manager might do.  */
-             if (b->type == bp_hardware_breakpoint)
+             if (b->loc_type == bp_loc_hardware_breakpoint)
                val = target_remove_hw_breakpoint (b->address, 
                                                   b->shadow_contents);
              else
@@ -1428,10 +1470,8 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
        return val;
       b->inserted = (is == mark_inserted);
     }
-  else if ((b->type == bp_hardware_watchpoint ||
-           b->type == bp_read_watchpoint ||
-           b->type == bp_access_watchpoint)
-          && b->enable_state == bp_enabled
+  else if (b->loc_type == bp_loc_hardware_watchpoint
+          && breakpoint_enabled (b->owner)
           && !b->duplicate)
     {
       struct value *v;
@@ -1439,28 +1479,28 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
 
       b->inserted = (is == mark_inserted);
       /* Walk down the saved value chain.  */
-      for (v = b->val_chain; v; v = v->next)
+      for (v = b->owner->val_chain; v; v = v->next)
        {
          /* For each memory reference remove the watchpoint
             at that address.  */
          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
+             if (v == b->owner->val_chain
                  || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
                      && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
                {
                  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->type == bp_read_watchpoint)
+                 if (b->owner->type == bp_read_watchpoint)
                    type = hw_read;
-                 else if (b->type == bp_access_watchpoint)
+                 else if (b->owner->type == bp_access_watchpoint)
                    type = hw_access;
 
                  val = target_remove_watchpoint (addr, len, type);
@@ -1473,25 +1513,16 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
       /* Failure to remove any of the hardware watchpoints comes here.  */
       if ((is == mark_uninserted) && (b->inserted))
        warning ("Could not remove hardware watchpoint %d.",
-                b->number);
-
-      /* Free the saved value chain.  We will construct a new one
-         the next time the watchpoint is inserted.  */
-      for (v = b->val_chain; v; v = n)
-       {
-         n = v->next;
-         value_free (v);
-       }
-      b->val_chain = NULL;
+                b->owner->number);
     }
-  else if ((b->type == bp_catch_fork ||
-           b->type == bp_catch_vfork ||
-           b->type == bp_catch_exec)
-          && b->enable_state == bp_enabled
+  else if ((b->owner->type == bp_catch_fork ||
+           b->owner->type == bp_catch_vfork ||
+           b->owner->type == bp_catch_exec)
+          && breakpoint_enabled (b->owner)
           && !b->duplicate)
     {
       val = -1;
-      switch (b->type)
+      switch (b->owner->type)
        {
        case bp_catch_fork:
          val = target_remove_fork_catchpoint (PIDGET (inferior_ptid));
@@ -1510,9 +1541,9 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
        return val;
       b->inserted = (is == mark_inserted);
     }
-  else if ((b->type == bp_catch_catch ||
-           b->type == bp_catch_throw)
-          && b->enable_state == bp_enabled
+  else if ((b->owner->type == bp_catch_catch ||
+           b->owner->type == bp_catch_throw)
+          && breakpoint_enabled (b->owner)
           && !b->duplicate)
     {
 
@@ -1521,9 +1552,9 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
        return val;
       b->inserted = (is == mark_inserted);
     }
-  else if (ep_is_exception_catchpoint (b)
+  else if (ep_is_exception_catchpoint (b->owner)
           && b->inserted       /* sometimes previous insert doesn't happen */
-          && b->enable_state == bp_enabled
+          && breakpoint_enabled (b->owner)
           && !b->duplicate)
     {
 
@@ -1542,10 +1573,10 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
 void
 mark_breakpoints_out (void)
 {
-  register struct breakpoint *b;
+  struct bp_location *bpt;
 
-  ALL_BREAKPOINTS (b)
-    b->inserted = 0;
+  ALL_BP_LOCATIONS (bpt)
+    bpt->inserted = 0;
 }
 
 /* Clear the "inserted" flag in all breakpoints and delete any
@@ -1563,13 +1594,15 @@ mark_breakpoints_out (void)
 void
 breakpoint_init_inferior (enum inf_context context)
 {
-  register struct breakpoint *b, *temp;
+  struct breakpoint *b, *temp;
+  struct bp_location *bpt;
   static int warning_needed = 0;
 
+  ALL_BP_LOCATIONS (bpt)
+    bpt->inserted = 0;
+
   ALL_BREAKPOINTS_SAFE (b, temp)
   {
-    b->inserted = 0;
-
     switch (b->type)
       {
       case bp_call_dummy:
@@ -1603,8 +1636,8 @@ breakpoint_init_inferior (enum inf_context context)
       default:
        /* Likewise for exception catchpoints in dynamic-linked
           executables where required */
-       if (ep_is_exception_catchpoint (b) &&
-           exception_catchpoints_are_fragile)
+       if (ep_is_exception_catchpoint (b)
+           && deprecated_exception_catchpoints_are_fragile)
          {
            warning_needed = 1;
            delete_breakpoint (b);
@@ -1613,8 +1646,8 @@ breakpoint_init_inferior (enum inf_context context)
       }
   }
 
-  if (exception_catchpoints_are_fragile)
-    exception_support_initialized = 0;
+  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))
@@ -1638,23 +1671,29 @@ breakpoint_init_inferior (enum inf_context context)
 enum breakpoint_here
 breakpoint_here_p (CORE_ADDR pc)
 {
-  register struct breakpoint *b;
+  struct bp_location *bpt;
   int any_breakpoint_here = 0;
 
-  ALL_BREAKPOINTS (b)
-    if ((b->enable_state == bp_enabled
-        || b->enable_state == bp_permanent)
-       && b->address == pc)    /* bp is enabled and matches pc */
-      {
-       if (overlay_debugging 
-           && section_is_overlay (b->section) 
-           && !section_is_mapped (b->section))
-         continue;             /* unmapped overlay -- can't be a match */
-       else if (b->enable_state == bp_permanent)
-         return permanent_breakpoint_here;
-       else
-         any_breakpoint_here = 1;
-      }
+  ALL_BP_LOCATIONS (bpt)
+    {
+      if (bpt->loc_type != bp_loc_software_breakpoint
+         && bpt->loc_type != bp_loc_hardware_breakpoint)
+       continue;
+
+      if ((breakpoint_enabled (bpt->owner)
+          || bpt->owner->enable_state == bp_permanent)
+         && bpt->address == pc)        /* bp is enabled and matches pc */
+       {
+         if (overlay_debugging 
+             && section_is_overlay (bpt->section) 
+             && !section_is_mapped (bpt->section))
+           continue;           /* unmapped overlay -- can't be a match */
+         else if (bpt->owner->enable_state == bp_permanent)
+           return permanent_breakpoint_here;
+         else
+           any_breakpoint_here = 1;
+       }
+    }
 
   return any_breakpoint_here ? ordinary_breakpoint_here : 0;
 }
@@ -1667,78 +1706,89 @@ breakpoint_here_p (CORE_ADDR pc)
 int
 breakpoint_inserted_here_p (CORE_ADDR pc)
 {
-  register struct breakpoint *b;
+  struct bp_location *bpt;
 
-  ALL_BREAKPOINTS (b)
-    if (b->inserted
-       && b->address == pc)    /* bp is inserted and matches pc */
+  ALL_BP_LOCATIONS (bpt)
     {
-      if (overlay_debugging 
-         && section_is_overlay (b->section) 
-         && !section_is_mapped (b->section))
-       continue;               /* unmapped overlay -- can't be a match */
-      else
-       return 1;
+      if (bpt->loc_type != bp_loc_software_breakpoint
+         && bpt->loc_type != bp_loc_hardware_breakpoint)
+       continue;
+
+      if (bpt->inserted
+         && bpt->address == pc)        /* bp is inserted and matches pc */
+       {
+         if (overlay_debugging 
+             && section_is_overlay (bpt->section) 
+             && !section_is_mapped (bpt->section))
+           continue;           /* unmapped overlay -- can't be a match */
+         else
+           return 1;
+       }
     }
 
   return 0;
 }
 
-/* Return nonzero if FRAME is a dummy frame.  We can't use
-   DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would
-   take too much time, at least using frame_register() on the 68k.
-   This means that for this function to work right a port must use the
-   bp_call_dummy breakpoint.  */
+/* This function returns non-zero iff there is a software breakpoint
+   inserted at PC.  */
 
 int
-deprecated_frame_in_dummy (struct frame_info *frame)
+software_breakpoint_inserted_here_p (CORE_ADDR pc)
 {
-  struct breakpoint *b;
+  struct bp_location *bpt;
+  int any_breakpoint_here = 0;
+
+  ALL_BP_LOCATIONS (bpt)
+    {
+      if (bpt->loc_type != bp_loc_software_breakpoint)
+       continue;
 
-  /* This function is used by two files: get_frame_type(), after first
-     checking that !DEPRECATED_USE_GENERIC_DUMMY_FRAMES; and
-     sparc-tdep.c, which doesn't yet use generic dummy frames anyway.  */
-  gdb_assert (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES);
+      if ((breakpoint_enabled (bpt->owner)
+          || bpt->owner->enable_state == bp_permanent)
+         && bpt->inserted
+         && bpt->address == pc)        /* bp is enabled and matches pc */
+       {
+         if (overlay_debugging 
+             && section_is_overlay (bpt->section) 
+             && !section_is_mapped (bpt->section))
+           continue;           /* unmapped overlay -- can't be a match */
+         else
+           return 1;
+       }
+    }
 
-  ALL_BREAKPOINTS (b)
-  {
-    if (b->type == bp_call_dummy
-       && frame_id_eq (b->frame_id, get_frame_id (frame))
-    /* We need to check the PC as well as the frame on the sparc,
-       for signals.exp in the testsuite.  */
-       && (get_frame_pc (frame)
-           >= (b->address
-               - DEPRECATED_SIZEOF_CALL_DUMMY_WORDS / sizeof (LONGEST) * DEPRECATED_REGISTER_SIZE))
-       && get_frame_pc (frame) <= b->address)
-      return 1;
-  }
   return 0;
 }
 
-/* breakpoint_thread_match (PC, PID) returns true if the breakpoint at
-   PC is valid for process/thread PID.  */
+/* breakpoint_thread_match (PC, PTID) returns true if the breakpoint at
+   PC is valid for process/thread PTID.  */
 
 int
 breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid)
 {
-  struct breakpoint *b;
+  struct bp_location *bpt;
   int thread;
 
   thread = pid_to_thread_id (ptid);
 
-  ALL_BREAKPOINTS (b)
-    if (b->enable_state != bp_disabled
-       && b->enable_state != bp_shlib_disabled
-       && b->enable_state != bp_call_disabled
-       && b->address == pc
-       && (b->thread == -1 || b->thread == thread))
-    {
-      if (overlay_debugging 
-         && section_is_overlay (b->section) 
-         && !section_is_mapped (b->section))
-       continue;               /* unmapped overlay -- can't be a match */
-      else
-       return 1;
+  ALL_BP_LOCATIONS (bpt)
+    {
+      if (bpt->loc_type != bp_loc_software_breakpoint
+         && bpt->loc_type != bp_loc_hardware_breakpoint)
+       continue;
+
+      if ((breakpoint_enabled (bpt->owner)
+          || bpt->owner->enable_state == bp_permanent)
+         && bpt->address == pc
+         && (bpt->owner->thread == -1 || bpt->owner->thread == thread))
+       {
+         if (overlay_debugging 
+             && section_is_overlay (bpt->section) 
+             && !section_is_mapped (bpt->section))
+           continue;           /* unmapped overlay -- can't be a match */
+         else
+           return 1;
+       }
     }
 
   return 0;
@@ -1924,7 +1974,6 @@ bpstat_clear_actions (bpstat bs)
 }
 
 /* Stub for cleaning up our state if we error-out of a breakpoint command */
-/* ARGSUSED */
 static void
 cleanup_executing_breakpoints (void *ignore)
 {
@@ -1941,7 +1990,6 @@ bpstat_do_actions (bpstat *bsp)
 {
   bpstat bs;
   struct cleanup *old_chain;
-  struct command_line *cmd;
 
   /* Avoid endless recursion if a `source' command is contained
      in bs->commands.  */
@@ -1966,7 +2014,23 @@ top:
   breakpoint_proceeded = 0;
   for (; bs != NULL; bs = bs->next)
     {
+      struct command_line *cmd;
+      struct cleanup *this_cmd_tree_chain;
+
+      /* Take ownership of the BSP's command tree, if it has one.
+
+         The command tree could legitimately contain commands like
+         'step' and 'next', which call clear_proceed_status, which
+         frees stop_bpstat's command tree.  To make sure this doesn't
+         free the tree we're executing out from under us, we need to
+         take ownership of the tree ourselves.  Since a given bpstat's
+         commands are only executed once, we don't need to copy it; we
+         can clear the pointer in the bpstat, and make sure we free
+         the tree when we're done.  */
       cmd = bs->commands;
+      bs->commands = 0;
+      this_cmd_tree_chain = make_cleanup_free_command_lines (&cmd);
+
       while (cmd != NULL)
        {
          execute_control_command (cmd);
@@ -1976,14 +2040,16 @@ top:
          else
            cmd = cmd->next;
        }
+
+      /* We can free this command tree now.  */
+      do_cleanups (this_cmd_tree_chain);
+
       if (breakpoint_proceeded)
        /* The inferior is proceeded by the command; bomb out now.
           The bpstat chain has been blown away by wait_for_inferior.
           But since execution has stopped again, there is a new bpstat
           to look at, so start over.  */
        goto top;
-      else
-       free_command_lines (&bs->commands);
     }
   do_cleanups (old_chain);
 }
@@ -2025,6 +2091,10 @@ print_it_typical (bpstat bs)
     {
     case bp_breakpoint:
     case bp_hardware_breakpoint:
+      if (bs->breakpoint_at->loc->address != bs->breakpoint_at->loc->requested_address)
+       breakpoint_adjustment_warning (bs->breakpoint_at->loc->requested_address,
+                                      bs->breakpoint_at->loc->address,
+                                      bs->breakpoint_at->number, 1);
       annotate_breakpoint (bs->breakpoint_at->number);
       ui_out_text (uiout, "\nBreakpoint ");
       if (ui_out_is_mi_like_p (uiout))
@@ -2393,9 +2463,6 @@ watchpoint_check (void *p)
   struct breakpoint *b;
   struct frame_info *fr;
   int within_current_scope;
-#if 0
-  struct frame_id current_frame_id;
-#endif
 
   b = bs->breakpoint_at;
 
@@ -2484,11 +2551,10 @@ which its expression is valid.\n");
     }
 }
 
-/* Get a bpstat associated with having just stopped at address *PC
-   and frame address CORE_ADDRESS.  Update *PC to point at the
-   breakpoint (if we hit a breakpoint).  NOT_A_SW_BREAKPOINT is nonzero
-   if this is known to not be a real breakpoint (it could still be a
-   watchpoint, though).  */
+/* Get a bpstat associated with having just stopped at address
+   BP_ADDR in thread PTID.  STOPPED_BY_WATCHPOINT is 1 if the
+   target thinks we stopped due to a hardware watchpoint, 0 if we
+   know we did not trigger a hardware watchpoint, and -1 if we do not know.  */
 
 /* Determine whether we stopped at a breakpoint, etc, or whether we
    don't understand this stop.  Result is a chain of bpstat's such that:
@@ -2505,30 +2571,20 @@ which its expression is valid.\n");
    commands, FIXME??? fields.  */
 
 bpstat
-bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
+bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
 {
-  register struct breakpoint *b, *temp;
-  CORE_ADDR bp_addr;
+  struct breakpoint *b, *temp;
   /* True if we've hit a breakpoint (as opposed to a watchpoint).  */
   int real_breakpoint = 0;
   /* Root of the chain of bpstat's */
   struct bpstats root_bs[1];
   /* Pointer to the last thing in the chain currently.  */
   bpstat bs = root_bs;
-
-  /* Get the address where the breakpoint would have been.  The
-     "not_a_sw_breakpoint" argument is meant to distinguish between a
-     breakpoint trap event and a trace/singlestep trap event.  For a
-     trace/singlestep trap event, we would not want to subtract
-     DECR_PC_AFTER_BREAK from the PC. */
-
-  bp_addr = *pc - (not_a_sw_breakpoint ? 0 : DECR_PC_AFTER_BREAK);
+  int thread_id = pid_to_thread_id (ptid);
 
   ALL_BREAKPOINTS_SAFE (b, temp)
   {
-    if (b->enable_state == bp_disabled
-       || b->enable_state == bp_shlib_disabled
-       || b->enable_state == bp_call_disabled)
+    if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
       continue;
 
     if (b->type != bp_watchpoint
@@ -2542,21 +2598,33 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
        && b->type != bp_catch_catch
        && b->type != bp_catch_throw)   /* a non-watchpoint bp */
       {
-       if (b->address != bp_addr)      /* address doesn't match */
+       if (b->loc->address != bp_addr)         /* address doesn't match */
          continue;
        if (overlay_debugging           /* unmapped overlay section */
-           && section_is_overlay (b->section) 
-           && !section_is_mapped (b->section))
+           && section_is_overlay (b->loc->section) 
+           && !section_is_mapped (b->loc->section))
          continue;
       }
 
+    /* Continuable hardware watchpoints are treated as non-existent if the 
+       reason we stopped wasn't a hardware watchpoint (we didn't stop on 
+       some data address).  Otherwise gdb won't stop on a break instruction 
+       in the code (not from a breakpoint) when a hardware watchpoint has 
+       been defined.  */
+
+    if ((b->type == bp_hardware_watchpoint
+        || b->type == bp_read_watchpoint
+        || b->type == bp_access_watchpoint)
+       && !stopped_by_watchpoint)
+      continue;
+
     if (b->type == bp_hardware_breakpoint)
       {
-       if (b->address != (*pc - DECR_PC_AFTER_HW_BREAK))
+       if (b->loc->address != bp_addr)
          continue;
        if (overlay_debugging           /* unmapped overlay section */
-           && section_is_overlay (b->section) 
-           && !section_is_mapped (b->section))
+           && section_is_overlay (b->loc->section) 
+           && !section_is_mapped (b->loc->section))
          continue;
       }
 
@@ -2664,15 +2732,14 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
        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
@@ -2680,11 +2747,11 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
                  {
                    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;
                  }
              }
@@ -2778,6 +2845,12 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
            /* Don't consider this a hit.  */
            --(b->hit_count);
          }
+       else if (b->thread != -1 && b->thread != thread_id)
+         {
+           bs->stop = 0;
+           /* Don't consider this a hit.  */
+           --(b->hit_count);
+         }
        else if (b->ignore_count > 0)
          {
            b->ignore_count--;
@@ -2793,8 +2866,8 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
              bs->print = 0;
            bs->commands = b->commands;
            if (bs->commands &&
-               (STREQ ("silent", bs->commands->line) ||
-                (xdb_commands && STREQ ("Q", bs->commands->line))))
+               (strcmp ("silent", bs->commands->line) == 0
+                || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
              {
                bs->commands = bs->commands->next;
                bs->print = 0;
@@ -2810,30 +2883,6 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
   bs->next = NULL;             /* Terminate the chain */
   bs = root_bs->next;          /* Re-grab the head of the chain */
 
-  if (real_breakpoint && bs)
-    {
-      if (bs->breakpoint_at->type == bp_hardware_breakpoint)
-       {
-         if (DECR_PC_AFTER_HW_BREAK != 0)
-           {
-             *pc = *pc - DECR_PC_AFTER_HW_BREAK;
-             write_pc (*pc);
-           }
-       }
-      else
-       {
-         if (DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs)
-           {
-             *pc = bp_addr;
-#if defined (SHIFT_INST_REGS)
-             SHIFT_INST_REGS ();
-#else /* No SHIFT_INST_REGS.  */
-             write_pc (bp_addr);
-#endif /* No SHIFT_INST_REGS.  */
-           }
-       }
-    }
-
   /* The value of a hardware watchpoint hasn't changed, but the
      intermediate memory locations we are watching may have.  */
   if (bs && !bs->stop &&
@@ -2950,7 +2999,7 @@ bpstat_what (bpstat bs)
 
   /* step_resume entries: a step resume breakpoint overrides another
      breakpoint of signal handling (see comment in wait_for_inferior
-     at first PC_IN_SIGTRAMP where we set the step_resume breakpoint).  */
+     at where we set the step_resume breakpoint).  */
   /* We handle the through_sigtramp_breakpoint the same way; having both
      one of those and a step_resume_breakpoint is probably very rare (?).  */
 
@@ -3131,7 +3180,7 @@ bpstat_should_step (void)
 {
   struct breakpoint *b;
   ALL_BREAKPOINTS (b)
-    if (b->enable_state == bp_enabled && b->type == bp_watchpoint)
+    if (breakpoint_enabled (b) && b->type == bp_watchpoint)
       return 1;
   return 0;
 }
@@ -3140,13 +3189,11 @@ bpstat_should_step (void)
 int
 bpstat_have_active_hw_watchpoints (void)
 {
-  struct breakpoint *b;
-  ALL_BREAKPOINTS (b)
-    if ((b->enable_state == bp_enabled) &&
-       (b->inserted) &&
-       ((b->type == bp_hardware_watchpoint) ||
-        (b->type == bp_read_watchpoint) ||
-        (b->type == bp_access_watchpoint)))
+  struct bp_location *bpt;
+  ALL_BP_LOCATIONS (bpt)
+    if (breakpoint_enabled (bpt->owner)
+       && bpt->inserted
+       && bpt->loc_type == bp_loc_hardware_watchpoint)
       return 1;
   return 0;
 }
@@ -3220,8 +3267,8 @@ static void
 print_one_breakpoint (struct breakpoint *b,
                      CORE_ADDR *last_addr)
 {
-  register struct command_line *l;
-  register struct symbol *sym;
+  struct command_line *l;
+  struct symbol *sym;
   struct ep_type_description
     {
       enum bptype type;
@@ -3412,13 +3459,16 @@ print_one_breakpoint (struct breakpoint *b,
        if (addressprint)
          {
            annotate_field (4);
-           ui_out_field_core_addr (uiout, "addr", b->address);
+           if (b->pending)
+             ui_out_field_string (uiout, "addr", "<PENDING>");
+           else
+             ui_out_field_core_addr (uiout, "addr", b->loc->address);
          }
        annotate_field (5);
-       *last_addr = b->address;
+       *last_addr = b->loc->address;
        if (b->source_file)
          {
-           sym = find_pc_sect_function (b->address, b->section);
+           sym = find_pc_sect_function (b->loc->address, b->loc->section);
            if (sym)
              {
                ui_out_text (uiout, "in ");
@@ -3431,9 +3481,13 @@ print_one_breakpoint (struct breakpoint *b,
            ui_out_text (uiout, ":");
            ui_out_field_int (uiout, "line", b->line_number);
          }
+       else if (b->pending)
+         {
+           ui_out_field_string (uiout, "pending", b->addr_string);
+         }
        else
          {
-           print_address_symbolic (b->address, stb->stream, demangle, "");
+           print_address_symbolic (b->loc->address, stb->stream, demangle, "");
            ui_out_field_stream (uiout, "at", stb);
          }
        break;
@@ -3467,7 +3521,15 @@ print_one_breakpoint (struct breakpoint *b,
       ui_out_field_stream (uiout, "cond", stb);
       ui_out_text (uiout, "\n");
     }
-  
+
+  if (b->pending && b->cond_string)
+    {
+      annotate_field (7);
+      ui_out_text (uiout, "\tstop only if ");
+      ui_out_field_string (uiout, "cond", b->cond_string);
+      ui_out_text (uiout, "\n");
+    }
+
   if (b->thread != -1)
     {
       /* FIXME should make an annotation for this */
@@ -3527,7 +3589,7 @@ static int
 do_captured_breakpoint_query (struct ui_out *uiout, void *data)
 {
   struct captured_breakpoint_query_args *args = data;
-  register struct breakpoint *b;
+  struct breakpoint *b;
   CORE_ADDR dummy_addr = 0;
   ALL_BREAKPOINTS (b)
     {
@@ -3579,7 +3641,7 @@ user_settable_breakpoint (const struct breakpoint *b)
 static void
 breakpoint_1 (int bnum, int allflag)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
   CORE_ADDR last_addr = (CORE_ADDR) -1;
   int nr_printable_breakpoints;
   struct cleanup *bkpttbl_chain;
@@ -3666,7 +3728,6 @@ breakpoint_1 (int bnum, int allflag)
   annotate_breakpoints_table_end ();
 }
 
-/* ARGSUSED */
 static void
 breakpoints_info (char *bnum_exp, int from_tty)
 {
@@ -3678,7 +3739,6 @@ breakpoints_info (char *bnum_exp, int from_tty)
   breakpoint_1 (bnum, 0);
 }
 
-/* ARGSUSED */
 static void
 maintenance_info_breakpoints (char *bnum_exp, int from_tty)
 {
@@ -3695,19 +3755,19 @@ maintenance_info_breakpoints (char *bnum_exp, int from_tty)
 static void
 describe_other_breakpoints (CORE_ADDR pc, asection *section)
 {
-  register int others = 0;
-  register struct breakpoint *b;
+  int others = 0;
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
-    if (b->address == pc)      /* address match / overlay match */
-      if (!overlay_debugging || b->section == section)
+    if (b->loc->address == pc) /* address match / overlay match */
+      if (!b->pending && (!overlay_debugging || b->loc->section == section))
        others++;
   if (others > 0)
     {
       printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
       ALL_BREAKPOINTS (b)
-       if (b->address == pc)   /* address match / overlay match */
-         if (!overlay_debugging || b->section == section)
+       if (b->loc->address == pc)      /* address match / overlay match */
+         if (!b->pending && (!overlay_debugging || b->loc->section == section))
            {
              others--;
              printf_filtered ("%d%s%s ",
@@ -3784,25 +3844,26 @@ breakpoint_address_is_meaningful (struct breakpoint *bpt)
 static void
 check_duplicates (struct breakpoint *bpt)
 {
-  register struct breakpoint *b;
-  register int count = 0;
-  struct breakpoint *perm_bp = 0;
-  CORE_ADDR address = bpt->address;
-  asection *section = bpt->section;
+  struct bp_location *b;
+  int count = 0;
+  struct bp_location *perm_bp = 0;
+  CORE_ADDR address = bpt->loc->address;
+  asection *section = bpt->loc->section;
 
   if (! breakpoint_address_is_meaningful (bpt))
     return;
 
-  ALL_BREAKPOINTS (b)
-    if (b->enable_state != bp_disabled
-       && b->enable_state != bp_shlib_disabled
-       && b->enable_state != bp_call_disabled
+  ALL_BP_LOCATIONS (b)
+    if (b->owner->enable_state != bp_disabled
+       && b->owner->enable_state != bp_shlib_disabled
+       && !b->owner->pending
+       && b->owner->enable_state != bp_call_disabled
        && b->address == address        /* address / overlay match */
        && (!overlay_debugging || b->section == section)
-       && breakpoint_address_is_meaningful (b))
+       && breakpoint_address_is_meaningful (b->owner))
     {
       /* Have we found a permanent breakpoint?  */
-      if (b->enable_state == bp_permanent)
+      if (b->owner->enable_state == bp_permanent)
        {
          perm_bp = b;
          break;
@@ -3825,25 +3886,153 @@ check_duplicates (struct breakpoint *bpt)
                        "allegedly permanent breakpoint is not "
                        "actually inserted");
 
-      ALL_BREAKPOINTS (b)
+      ALL_BP_LOCATIONS (b)
        if (b != perm_bp)
          {
-           if (b->inserted)
-             internal_error (__FILE__, __LINE__,
-                             "another breakpoint was inserted on top of "
-                             "a permanent breakpoint");
-
-           if (b->enable_state != bp_disabled
-               && b->enable_state != bp_shlib_disabled
-               && b->enable_state != bp_call_disabled
+           if (b->owner->enable_state != bp_disabled
+               && b->owner->enable_state != bp_shlib_disabled
+               && !b->owner->pending
+               && b->owner->enable_state != bp_call_disabled
                && b->address == address        /* address / overlay match */
                && (!overlay_debugging || b->section == section)
-               && breakpoint_address_is_meaningful (b))
-             b->duplicate = 1;
+               && breakpoint_address_is_meaningful (b->owner))
+             {
+               if (b->inserted)
+                 internal_error (__FILE__, __LINE__,
+                                 "another breakpoint was inserted on top of "
+                                 "a permanent breakpoint");
+
+               b->duplicate = 1;
+             }
          }
     }
 }
 
+static void
+breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
+                               int bnum, int have_bnum)
+{
+  char astr1[40];
+  char astr2[40];
+
+  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);
+  else
+    warning ("Breakpoint address adjusted from %s to %s.", astr1, astr2);
+}
+
+/* Adjust a breakpoint's address to account for architectural constraints
+   on breakpoint placement.  Return the adjusted address.  Note: Very
+   few targets require this kind of adjustment.  For most targets,
+   this function is simply the identity function.  */
+
+static CORE_ADDR
+adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype)
+{
+  if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch))
+    {
+      /* Very few targets need any kind of breakpoint adjustment.  */
+      return bpaddr;
+    }
+  else if (bptype == bp_watchpoint
+           || bptype == bp_hardware_watchpoint
+           || bptype == bp_read_watchpoint
+           || bptype == bp_access_watchpoint
+           || bptype == bp_catch_fork
+           || bptype == bp_catch_vfork
+           || bptype == bp_catch_exec)
+    {
+      /* Watchpoints and the various bp_catch_* eventpoints should not
+         have their addresses modified.  */
+      return bpaddr;
+    }
+  else
+    {
+      CORE_ADDR adjusted_bpaddr;
+
+      /* Some targets have architectural constraints on the placement
+         of breakpoint instructions.  Obtain the adjusted address.  */
+      adjusted_bpaddr = gdbarch_adjust_breakpoint_address (current_gdbarch,
+                                                           bpaddr);
+
+      /* An adjusted breakpoint address can significantly alter
+         a user's expectations.  Print a warning if an adjustment
+        is required.  */
+      if (adjusted_bpaddr != bpaddr)
+       breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, 0);
+
+      return adjusted_bpaddr;
+    }
+}
+
+/* Allocate a struct bp_location.  */
+
+static struct bp_location *
+allocate_bp_location (struct breakpoint *bpt, enum bptype bp_type)
+{
+  struct bp_location *loc, *loc_p;
+
+  loc = xmalloc (sizeof (struct bp_location));
+  memset (loc, 0, sizeof (*loc));
+
+  loc->owner = bpt;
+
+  switch (bp_type)
+    {
+    case bp_breakpoint:
+    case bp_until:
+    case bp_finish:
+    case bp_longjmp:
+    case bp_longjmp_resume:
+    case bp_step_resume:
+    case bp_through_sigtramp:
+    case bp_watchpoint_scope:
+    case bp_call_dummy:
+    case bp_shlib_event:
+    case bp_thread_event:
+    case bp_overlay_event:
+    case bp_catch_load:
+    case bp_catch_unload:
+      loc->loc_type = bp_loc_software_breakpoint;
+      break;
+    case bp_hardware_breakpoint:
+      loc->loc_type = bp_loc_hardware_breakpoint;
+      break;
+    case bp_hardware_watchpoint:
+    case bp_read_watchpoint:
+    case bp_access_watchpoint:
+      loc->loc_type = bp_loc_hardware_watchpoint;
+      break;
+    case bp_watchpoint:
+    case bp_catch_fork:
+    case bp_catch_vfork:
+    case bp_catch_exec:
+    case bp_catch_catch:
+    case bp_catch_throw:
+      loc->loc_type = bp_loc_other;
+      break;
+    default:
+      internal_error (__FILE__, __LINE__, "unknown breakpoint type");
+    }
+
+  /* Add this breakpoint to the end of the chain.  */
+
+  loc_p = bp_location_chain;
+  if (loc_p == 0)
+    bp_location_chain = loc;
+  else
+    {
+      while (loc_p->next)
+       loc_p = loc_p->next;
+      loc_p->next = loc;
+    }
+
+  return loc;
+}
+
 /* set_raw_breakpoint() is a low level routine for allocating and
    partially initializing a breakpoint of type BPTYPE.  The newly
    created breakpoint's address, section, source file name, and line
@@ -3862,17 +4051,20 @@ check_duplicates (struct breakpoint *bpt)
 struct breakpoint *
 set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype)
 {
-  register struct breakpoint *b, *b1;
+  struct breakpoint *b, *b1;
 
   b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
   memset (b, 0, sizeof (*b));
-  b->address = sal.pc;
+  b->loc = allocate_bp_location (b, bptype);
+  b->loc->requested_address = sal.pc;
+  b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
+                                               bptype);
   if (sal.symtab == NULL)
     b->source_file = NULL;
   else
     b->source_file = savestring (sal.symtab->filename,
                                 strlen (sal.symtab->filename));
-  b->section = sal.section;
+  b->loc->section = sal.section;
   b->type = bptype;
   b->language = current_language->la_language;
   b->input_radix = input_radix;
@@ -3889,6 +4081,7 @@ set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype)
   b->forked_inferior_pid = 0;
   b->exec_pathname = NULL;
   b->ops = NULL;
+  b->pending = 0;
 
   /* Add this breakpoint to the end of the chain
      so that a list of breakpoints will come out in order
@@ -3919,7 +4112,7 @@ make_breakpoint_permanent (struct breakpoint *b)
   b->enable_state = bp_permanent;
 
   /* By definition, permanent breakpoints are already present in the code.  */
-  b->inserted = 1;
+  b->loc->inserted = 1;
 }
 
 static struct breakpoint *
@@ -3952,7 +4145,7 @@ create_longjmp_breakpoint (char *func_name)
     b = create_internal_breakpoint (0, bp_longjmp_resume);
   else
     {
-      if ((m = lookup_minimal_symbol_text (func_name, NULL, NULL)) == NULL)
+      if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL)
        return;
  
       b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), bp_longjmp);
@@ -3971,7 +4164,7 @@ create_longjmp_breakpoint (char *func_name)
 void
 enable_longjmp_breakpoint (void)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
     if (b->type == bp_longjmp)
@@ -3984,7 +4177,7 @@ enable_longjmp_breakpoint (void)
 void
 disable_longjmp_breakpoint (void)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
     if (b->type == bp_longjmp
@@ -4001,7 +4194,7 @@ create_overlay_event_breakpoint (char *func_name)
   struct breakpoint *b;
   struct minimal_symbol *m;
 
-  if ((m = lookup_minimal_symbol_text (func_name, NULL, NULL)) == NULL)
+  if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL)
     return;
  
   b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), 
@@ -4023,7 +4216,7 @@ create_overlay_event_breakpoint (char *func_name)
 void
 enable_overlay_breakpoints (void)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
     if (b->type == bp_overlay_event)
@@ -4037,7 +4230,7 @@ enable_overlay_breakpoints (void)
 void
 disable_overlay_breakpoints (void)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
     if (b->type == bp_overlay_event)
@@ -4057,7 +4250,7 @@ create_thread_event_breakpoint (CORE_ADDR address)
   
   b->enable_state = bp_enabled;
   /* addr_string has to be used or breakpoint_re_set will delete me.  */
-  xasprintf (&b->addr_string, "*0x%s", paddr (b->address));
+  b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
 
   return b;
 }
@@ -4072,11 +4265,71 @@ remove_thread_event_breakpoints (void)
       delete_breakpoint (b);
 }
 
+struct captured_parse_breakpoint_args
+  {
+    char **arg_p;
+    struct symtabs_and_lines *sals_p;
+    char ***addr_string_p;
+    int *not_found_ptr;
+  };
+
+struct lang_and_radix
+  {
+    enum language lang;
+    int radix;
+  };
+
+/* Cleanup helper routine to restore the current language and
+   input radix.  */
+static void
+do_restore_lang_radix_cleanup (void *old)
+{
+  struct lang_and_radix *p = old;
+  set_language (p->lang);
+  input_radix = p->radix;
+}
+
+/* Try and resolve a pending breakpoint.  */
+static int
+resolve_pending_breakpoint (struct breakpoint *b)
+{
+  /* Try and reparse the breakpoint in case the shared library
+     is now loaded.  */
+  struct symtabs_and_lines sals;
+  struct symtab_and_line pending_sal;
+  char **cond_string = (char **) NULL;
+  char *copy_arg = b->addr_string;
+  char **addr_string;
+  char *errmsg;
+  int rc;
+  int not_found = 0;
+  struct ui_file *old_gdb_stderr;
+  struct lang_and_radix old_lr;
+  struct cleanup *old_chain;
+  
+  /* Set language, input-radix, then reissue breakpoint command. 
+     Ensure the language and input-radix are restored afterwards.  */
+  old_lr.lang = current_language->la_language;
+  old_lr.radix = input_radix;
+  old_chain = make_cleanup (do_restore_lang_radix_cleanup, &old_lr);
+  
+  set_language (b->language);
+  input_radix = b->input_radix;
+  rc = break_command_1 (b->addr_string, b->flag, b->from_tty, b);
+  
+  if (rc == GDB_RC_OK)
+    /* Pending breakpoint has been resolved.  */
+    printf_filtered ("Pending breakpoint \"%s\" resolved\n", b->addr_string);
+
+  do_cleanups (old_chain);
+  return rc;
+}
+
 #ifdef SOLIB_ADD
 void
 remove_solib_event_breakpoints (void)
 {
-  register struct breakpoint *b, *temp;
+  struct breakpoint *b, *temp;
 
   ALL_BREAKPOINTS_SAFE (b, temp)
     if (b->type == bp_shlib_event)
@@ -4107,9 +4360,9 @@ disable_breakpoints_in_shlibs (int silent)
 #if defined (PC_SOLIB)
     if (((b->type == bp_breakpoint) ||
         (b->type == bp_hardware_breakpoint)) &&
-       b->enable_state == bp_enabled &&
-       !b->duplicate &&
-       PC_SOLIB (b->address))
+       breakpoint_enabled (b) &&
+       !b->loc->duplicate &&
+       PC_SOLIB (b->loc->address))
       {
        b->enable_state = bp_shlib_disabled;
        if (!silent)
@@ -4127,22 +4380,70 @@ disable_breakpoints_in_shlibs (int silent)
   }
 }
 
-/* Try to reenable any breakpoints in shared libraries.  */
+/* Disable any breakpoints that are in in an unloaded shared library.  Only
+   apply to enabled breakpoints, disabled ones can just stay disabled.  */
+
 void
-re_enable_breakpoints_in_shlibs (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->enable_state == bp_shlib_disabled)
-    {
-      char buf[1];
+  {
+    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
+}
 
-      /* Do not reenable the breakpoint if the shared library
-         is still not mapped in.  */
-      if (target_read_memory (b->address, buf, 1) == 0)
-       b->enable_state = bp_enabled;
-    }
+/* Try to reenable any breakpoints in shared libraries.  */
+void
+re_enable_breakpoints_in_shlibs (void)
+{
+  struct breakpoint *b, *tmp;
+
+  ALL_BREAKPOINTS_SAFE (b, tmp)
+  {
+    if (b->enable_state == bp_shlib_disabled)
+      {
+       char buf[1], *lib;
+       
+       /* Do not reenable the breakpoint if the shared library
+          is still not mapped in.  */
+       lib = PC_SOLIB (b->loc->address);
+       if (lib != NULL && target_read_memory (b->loc->address, buf, 1) == 0)
+         b->enable_state = bp_enabled;
+      }
+    else if (b->pending && (b->enable_state == bp_enabled))
+      {
+       if (resolve_pending_breakpoint (b) == GDB_RC_OK)
+         delete_breakpoint (b);
+      }
+  }
 }
 
 #endif
@@ -4161,7 +4462,7 @@ solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
   int thread = -1;             /* All threads. */
 
   /* Set a breakpoint on the specified hook. */
-  sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical);
+  sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical, NULL);
   addr_end = hookname;
 
   if (sals.nelts == 0)
@@ -4308,7 +4609,7 @@ create_exec_event_catchpoint (int tempflag, char *cond_string)
 static int
 hw_breakpoint_used_count (void)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
   int i = 0;
 
   ALL_BREAKPOINTS (b)
@@ -4323,20 +4624,19 @@ hw_breakpoint_used_count (void)
 static int
 hw_watchpoint_used_count (enum bptype type, int *other_type_used)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
   int i = 0;
 
   *other_type_used = 0;
   ALL_BREAKPOINTS (b)
   {
-    if (b->enable_state == bp_enabled)
+    if (breakpoint_enabled (b))
       {
        if (b->type == type)
          i++;
        else if ((b->type == bp_hardware_watchpoint ||
                  b->type == bp_read_watchpoint ||
-                 b->type == bp_access_watchpoint)
-                && b->enable_state == bp_enabled)
+                 b->type == bp_access_watchpoint))
          *other_type_used = 1;
       }
   }
@@ -4352,12 +4652,14 @@ hw_watchpoint_used_count (enum bptype type, int *other_type_used)
 void
 set_longjmp_resume_breakpoint (CORE_ADDR pc, struct frame_id frame_id)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
     if (b->type == bp_longjmp_resume)
     {
-      b->address = pc;
+      b->loc->requested_address = pc;
+      b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
+                                                   b->type);
       b->enable_state = bp_enabled;
       b->frame_id = frame_id;
       check_duplicates (b);
@@ -4377,7 +4679,7 @@ disable_watchpoints_before_interactive_call_start (void)
         || (b->type == bp_read_watchpoint)
         || (b->type == bp_access_watchpoint)
         || ep_is_exception_catchpoint (b))
-       && (b->enable_state == bp_enabled))
+       && breakpoint_enabled (b))
       {
        b->enable_state = bp_call_disabled;
        check_duplicates (b);
@@ -4414,7 +4716,7 @@ struct breakpoint *
 set_momentary_breakpoint (struct symtab_and_line sal, struct frame_id frame_id,
                          enum bptype type)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
   b = set_raw_breakpoint (sal, type);
   b->enable_state = bp_enabled;
   b->disposition = disp_donttouch;
@@ -4442,13 +4744,13 @@ mention (struct breakpoint *b)
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
 
-  /* FIXME: This is misplaced; mention() is called by things (like hitting a
-     watchpoint) other than breakpoint creation.  It should be possible to
-     clean this up and at the same time replace the random calls to
-     breakpoint_changed with this hook, as has already been done for
-     delete_breakpoint_hook and so on.  */
-  if (create_breakpoint_hook)
-    create_breakpoint_hook (b);
+  /* FIXME: This is misplaced; mention() is called by things (like
+     hitting a watchpoint) other than breakpoint creation.  It should
+     be possible to clean this up and at the same time replace the
+     random calls to breakpoint_changed with this hook, as has already
+     been done for deprecated_delete_breakpoint_hook and so on.  */
+  if (deprecated_create_breakpoint_hook)
+    deprecated_create_breakpoint_hook (b);
   breakpoint_create_event (b->number);
 
   if (b->ops != NULL && b->ops->print_mention != NULL)
@@ -4554,14 +4856,21 @@ mention (struct breakpoint *b)
 
   if (say_where)
     {
-      if (addressprint || b->source_file == NULL)
+      if (b->pending)
        {
-         printf_filtered (" at ");
-         print_address_numeric (b->address, 1, gdb_stdout);
+         printf_filtered (" (%s) pending.", b->addr_string);
+       }
+      else
+       {
+         if (addressprint || b->source_file == NULL)
+           {
+             printf_filtered (" at ");
+             print_address_numeric (b->loc->address, 1, gdb_stdout);
+           }
+         if (b->source_file)
+           printf_filtered (": file %s, line %d.",
+                            b->source_file, b->line_number);
        }
-      if (b->source_file)
-       printf_filtered (": file %s, line %d.",
-                        b->source_file, b->line_number);
     }
   do_cleanups (old_chain);
   if (ui_out_is_mi_like_p (uiout))
@@ -4574,6 +4883,11 @@ mention (struct breakpoint *b)
    SALS.sal[i] breakpoint, include the corresponding ADDR_STRING[i],
    COND[i] and COND_STRING[i] values.
 
+   The parameter PENDING_BP points to a pending breakpoint that is
+   the basis of the breakpoints currently being created.  The pending
+   breakpoint may contain a separate condition string or commands
+   that were added after the initial pending breakpoint was created.
+
    NOTE: If the function succeeds, the caller is expected to cleanup
    the arrays ADDR_STRING, COND_STRING, COND and SALS (but not the
    array contents).  If the function fails (error() is called), the
@@ -4584,7 +4898,8 @@ static void
 create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
                    struct expression **cond, char **cond_string,
                    enum bptype type, enum bpdisp disposition,
-                   int thread, int ignore_count, int from_tty)
+                   int thread, int ignore_count, int from_tty,
+                   struct breakpoint *pending_bp)
 {
   if (type == bp_hardware_breakpoint)
     {
@@ -4619,11 +4934,35 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
        else
          /* addr_string has to be used or breakpoint_re_set will delete
             me.  */
-         xasprintf (&b->addr_string, "*0x%s", paddr (b->address));
+         b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
        b->cond_string = cond_string[i];
        b->ignore_count = ignore_count;
        b->enable_state = bp_enabled;
        b->disposition = disposition;
+       /* If resolving a pending breakpoint, a check must be made to see if
+          the user has specified a new condition or commands for the 
+          breakpoint.  A new condition will override any condition that was 
+          initially specified with the initial breakpoint command.  */
+       if (pending_bp)
+         {
+           char *arg;
+           if (pending_bp->cond_string)
+             {
+               arg = pending_bp->cond_string;
+               b->cond_string = savestring (arg, strlen (arg));
+               b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0);
+               if (*arg)
+                 error ("Junk at end of pending breakpoint condition expression");
+             }
+           /* If there are commands associated with the breakpoint, they should 
+              be copied too.  */
+           if (pending_bp->commands)
+             b->commands = copy_command_lines (pending_bp->commands);
+           
+           /* We have to copy over the ignore_count and thread as well.  */
+           b->ignore_count = pending_bp->ignore_count;
+           b->thread = pending_bp->thread;
+         }
        mention (b);
       }
   }    
@@ -4637,7 +4976,8 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
 static void
 parse_breakpoint_sals (char **address,
                       struct symtabs_and_lines *sals,
-                      char ***addr_string)
+                      char ***addr_string,
+                      int *not_found_ptr)
 {
   char *addr_start = *address;
   *addr_string = NULL;
@@ -4678,9 +5018,11 @@ parse_breakpoint_sals (char **address,
              || ((strchr ("+-", (*address)[0]) != NULL)
                  && ((*address)[1] != '['))))
        *sals = decode_line_1 (address, 1, default_breakpoint_symtab,
-                              default_breakpoint_line, addr_string);
+                              default_breakpoint_line, addr_string, 
+                              not_found_ptr);
       else
-       *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, addr_string);
+       *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0,
+                              addr_string, not_found_ptr);
     }
   /* For any SAL that didn't have a canonical string, fill one in. */
   if (sals->nelts > 0 && *addr_string == NULL)
@@ -4723,7 +5065,8 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
 
          Give the target a chance to bless sals.sals[i].pc before we
          try to make a breakpoint for it. */
-      if (PC_REQUIRES_RUN_BEFORE_USE (sals->sals[i].pc))
+#ifdef DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE
+      if (DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE (sals->sals[i].pc))
        {
          if (address == NULL)
            error ("Cannot break without a running program.");
@@ -4731,29 +5074,48 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
            error ("Cannot break on %s without a running program.", 
                   address);
        }
+#endif
     }
 }
 
+static int
+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)
    flag: first bit  : 0 non-temporary, 1 temporary.
-   second bit : 0 normal breakpoint, 1 hardware breakpoint. */
+   second bit : 0 normal breakpoint, 1 hardware breakpoint. 
 
-static void
-break_command_1 (char *arg, int flag, int from_tty)
+   PENDING_BP is non-NULL when this function is being called to resolve
+   a pending breakpoint.  */
+
+static int
+break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_bp)
 {
   int tempflag, hardwareflag;
   struct symtabs_and_lines sals;
-  register struct expression **cond = 0;
-  /* Pointers in arg to the start, and one past the end, of the
-     condition.  */
+  struct expression **cond = 0;
+  struct symtab_and_line pending_sal;
   char **cond_string = (char **) NULL;
+  char *copy_arg;
+  char *err_msg;
   char *addr_start = arg;
   char **addr_string;
   struct cleanup *old_chain;
   struct cleanup *breakpoint_chain = NULL;
-  int i;
+  struct captured_parse_breakpoint_args parse_args;
+  int i, rc;
+  int pending = 0;
   int thread = -1;
   int ignore_count = 0;
+  int not_found = 0;
 
   hardwareflag = flag & BP_HARDWAREFLAG;
   tempflag = flag & BP_TEMPFLAG;
@@ -4761,19 +5123,75 @@ break_command_1 (char *arg, int flag, int from_tty)
   sals.sals = NULL;
   sals.nelts = 0;
   addr_string = NULL;
-  parse_breakpoint_sals (&arg, &sals, &addr_string);
 
-  if (!sals.nelts)
-    return;
+  parse_args.arg_p = &arg;
+  parse_args.sals_p = &sals;
+  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);
+
+  /* If caller is interested in rc value from parse, set value.  */
+
+  if (rc != GDB_RC_OK)
+    {
+      /* Check for file or function not found.  */
+      if (not_found)
+       {
+         /* If called to resolve pending breakpoint, just return error code.  */
+         if (pending_bp)
+           {
+             xfree (err_msg);
+             return rc;
+           }
+
+         error_output_message (NULL, err_msg);
+         xfree (err_msg);
+
+         /* If pending breakpoint support is turned off, throw error.  */
+
+         if (pending_break_support == AUTO_BOOLEAN_FALSE)
+           throw_reason (RETURN_ERROR);
+
+          /* 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;
+
+         /* 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;
+       }
+      else
+       {
+         xfree (err_msg);
+         return rc;
+       }
+    }
+  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);
 
-  /* Make sure that all storage allocated to SALS gets freed.  */
-  make_cleanup (xfree, sals.sals);
-
-  /* Cleanup the addr_string array but not its contents. */
-  make_cleanup (xfree, addr_string);
+  if (!pending)
+    {
+      /* Make sure that all storage allocated to SALS gets freed.  */
+      make_cleanup (xfree, sals.sals);
+      
+      /* Cleanup the addr_string array but not its contents. */
+      make_cleanup (xfree, addr_string);
+    }
 
   /* Allocate space for all the cond expressions. */
   cond = xcalloc (sals.nelts, sizeof (struct expression *));
@@ -4800,62 +5218,94 @@ break_command_1 (char *arg, int flag, int from_tty)
 
   /* Resolve all line numbers to PC's and verify that the addresses
      are ok for the target.  */
-  breakpoint_sals_to_pc (&sals, addr_start);
+  if (!pending)
+    breakpoint_sals_to_pc (&sals, addr_start);
 
   /* Verify that condition can be parsed, before setting any
      breakpoints.  Allocate a separate condition expression for each
      breakpoint. */
   thread = -1;                 /* No specific thread yet */
-  for (i = 0; i < sals.nelts; i++)
+  if (!pending)
     {
-      char *tok = arg;
-      while (tok && *tok)
+      for (i = 0; i < sals.nelts; i++)
        {
-         char *end_tok;
-         int toklen;
-         char *cond_start = NULL;
-         char *cond_end = NULL;
-         while (*tok == ' ' || *tok == '\t')
-           tok++;
-
-         end_tok = tok;
-
-         while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000')
-           end_tok++;
-
-         toklen = end_tok - tok;
-
-         if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
-           {
-             tok = cond_start = end_tok + 1;
-             cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
-             make_cleanup (xfree, cond[i]);
-             cond_end = tok;
-             cond_string[i] = savestring (cond_start, cond_end - cond_start);
-             make_cleanup (xfree, cond_string[i]);
-           }
-         else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0)
+         char *tok = arg;
+         while (tok && *tok)
            {
-             char *tmptok;
-
-             tok = end_tok + 1;
-             tmptok = tok;
-             thread = strtol (tok, &tok, 0);
-             if (tok == tmptok)
-               error ("Junk after thread keyword.");
-             if (!valid_thread_id (thread))
-               error ("Unknown thread %d\n", thread);
+             char *end_tok;
+             int toklen;
+             char *cond_start = NULL;
+             char *cond_end = NULL;
+             while (*tok == ' ' || *tok == '\t')
+               tok++;
+             
+             end_tok = tok;
+             
+             while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000')
+               end_tok++;
+             
+             toklen = end_tok - tok;
+             
+             if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
+               {
+                 tok = cond_start = end_tok + 1;
+                 cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 
+                                        0);
+                 make_cleanup (xfree, cond[i]);
+                 cond_end = tok;
+                 cond_string[i] = savestring (cond_start, 
+                                              cond_end - cond_start);
+                 make_cleanup (xfree, cond_string[i]);
+               }
+             else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0)
+               {
+                 char *tmptok;
+                 
+                 tok = end_tok + 1;
+                 tmptok = tok;
+                 thread = strtol (tok, &tok, 0);
+                 if (tok == tmptok)
+                   error ("Junk after thread keyword.");
+                 if (!valid_thread_id (thread))
+                   error ("Unknown thread %d\n", thread);
+               }
+             else
+               error ("Junk at end of arguments.");
            }
-         else
-           error ("Junk at end of arguments.");
        }
+      create_breakpoints (sals, addr_string, cond, cond_string,
+                         hardwareflag ? bp_hardware_breakpoint 
+                         : bp_breakpoint,
+                         tempflag ? disp_del : disp_donttouch,
+                         thread, ignore_count, from_tty,
+                         pending_bp);
     }
-
-  create_breakpoints (sals, addr_string, cond, cond_string,
-                     hardwareflag ? bp_hardware_breakpoint : bp_breakpoint,
-                     tempflag ? disp_del : disp_donttouch,
-                     thread, ignore_count, from_tty);
-
+  else
+    {
+      struct symtab_and_line sal;
+      struct breakpoint *b;
+
+      sal.symtab = NULL;
+      sal.pc = 0;
+
+      make_cleanup (xfree, copy_arg);
+
+      b = set_raw_breakpoint (sal, hardwareflag ? bp_hardware_breakpoint 
+                             : bp_breakpoint);
+      set_breakpoint_count (breakpoint_count + 1);
+      b->number = breakpoint_count;
+      b->cond = *cond;
+      b->thread = thread;
+      b->addr_string = *addr_string;
+      b->cond_string = *cond_string;
+      b->ignore_count = ignore_count;
+      b->pending = 1;
+      b->disposition = tempflag ? disp_del : disp_donttouch;
+      b->from_tty = from_tty;
+      b->flag = flag;
+      mention (b);
+    }
+  
   if (sals.nelts > 1)
     {
       warning ("Multiple breakpoints were set.");
@@ -4866,6 +5316,8 @@ break_command_1 (char *arg, int flag, int from_tty)
   discard_cleanups (breakpoint_chain);
   /* But cleanup everything else. */
   do_cleanups (old_chain);
+
+  return GDB_RC_OK;
 }
 
 /* Set a breakpoint of TYPE/DISPOSITION according to ARG (function,
@@ -4886,7 +5338,7 @@ do_captured_breakpoint (void *data)
 {
   struct captured_breakpoint_args *args = data;
   struct symtabs_and_lines sals;
-  register struct expression **cond;
+  struct expression **cond;
   struct cleanup *old_chain;
   struct cleanup *breakpoint_chain = NULL;
   int i;
@@ -4902,7 +5354,7 @@ do_captured_breakpoint (void *data)
   sals.nelts = 0;
   address_end = args->address;
   addr_string = NULL;
-  parse_breakpoint_sals (&address_end, &sals, &addr_string);
+  parse_breakpoint_sals (&address_end, &sals, &addr_string, 0);
 
   if (!sals.nelts)
     return GDB_RC_NONE;
@@ -4966,7 +5418,8 @@ do_captured_breakpoint (void *data)
   create_breakpoints (sals, addr_string, cond, cond_string,
                      args->hardwareflag ? bp_hardware_breakpoint : bp_breakpoint,
                      args->tempflag ? disp_del : disp_donttouch,
-                     args->thread, args->ignore_count, 0/*from-tty*/);
+                     args->thread, args->ignore_count, 0/*from-tty*/, 
+                     NULL/*pending_bp*/);
 
   /* That's it. Discard the cleanups for data inserted into the
      breakpoint. */
@@ -4993,169 +5446,6 @@ gdb_breakpoint (char *address, char *condition,
 }
 
 
-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);
-         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);
-
-  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);
-         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);
-}
-
-
 /* Helper function for break_command_1 and disassemble_command.  */
 
 void
@@ -5208,43 +5498,25 @@ resolve_sal_pc (struct symtab_and_line *sal)
 void
 break_command (char *arg, int from_tty)
 {
-  break_command_1 (arg, 0, from_tty);
-}
-
-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);
+  break_command_1 (arg, 0, from_tty, NULL);
 }
 
 void
 tbreak_command (char *arg, int from_tty)
 {
-  break_command_1 (arg, BP_TEMPFLAG, from_tty);
-}
-
-void
-tbreak_at_finish_command (char *arg, int from_tty)
-{
-  break_at_finish_command_1 (arg, BP_TEMPFLAG, from_tty);
+  break_command_1 (arg, BP_TEMPFLAG, from_tty, NULL);
 }
 
 static void
 hbreak_command (char *arg, int from_tty)
 {
-  break_command_1 (arg, BP_HARDWAREFLAG, from_tty);
+  break_command_1 (arg, BP_HARDWAREFLAG, from_tty, NULL);
 }
 
 static void
 thbreak_command (char *arg, int from_tty)
 {
-  break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty);
+  break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty, NULL);
 }
 
 static void
@@ -5285,7 +5557,7 @@ stopin_command (char *arg, int from_tty)
   if (badInput)
     printf_filtered ("Usage: stop in <function | address>\n");
   else
-    break_command_1 (arg, 0, from_tty);
+    break_command_1 (arg, 0, from_tty, NULL);
 }
 
 static void
@@ -5317,10 +5589,9 @@ stopat_command (char *arg, int from_tty)
   if (badInput)
     printf_filtered ("Usage: stop at <line>\n");
   else
-    break_command_1 (arg, 0, from_tty);
+    break_command_1 (arg, 0, from_tty, NULL);
 }
 
-/* ARGSUSED */
 /* accessflag:  hw_write:  watch write, 
                 hw_read:   watch read, 
                hw_access: watch access (read or write) */
@@ -5473,7 +5744,11 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
          scope_breakpoint->frame_id = get_frame_id (prev_frame);
 
          /* Set the address at which we will stop.  */
-         scope_breakpoint->address = get_frame_pc (prev_frame);
+         scope_breakpoint->loc->requested_address
+           = get_frame_pc (prev_frame);
+         scope_breakpoint->loc->address
+           = adjust_breakpoint_address (scope_breakpoint->loc->requested_address,
+                                        scope_breakpoint->type);
 
          /* The scope breakpoint is related to the watchpoint.  We
             will need to act on them together.  */
@@ -5488,11 +5763,6 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
    in hardware.  If the watchpoint can not be handled
    in hardware return zero.  */
 
-#if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT)
-#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(BYTE_SIZE) \
-    ((BYTE_SIZE) <= (DEPRECATED_REGISTER_SIZE))
-#endif
-
 #if !defined(TARGET_REGION_OK_FOR_HW_WATCHPOINT)
 #define TARGET_REGION_OK_FOR_HW_WATCHPOINT(ADDR,LEN) \
      (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(LEN))
@@ -5540,7 +5810,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
@@ -5549,8 +5819,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;
@@ -5623,7 +5893,6 @@ until_break_command_continuation (struct continuation_arg *arg)
   do_exec_cleanups (cleanups);
 }
 
-/* ARGSUSED */
 void
 until_break_command (char *arg, int from_tty, int anywhere)
 {
@@ -5642,10 +5911,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
 
   if (default_breakpoint_valid)
     sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
-                         default_breakpoint_line, (char ***) NULL);
+                         default_breakpoint_line, (char ***) NULL, NULL);
   else
     sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 
-                         0, (char ***) NULL);
+                         0, (char ***) NULL, NULL);
 
   if (sals.nelts != 1)
     error ("Couldn't get information on specified line.");
@@ -5669,7 +5938,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);
@@ -5681,7 +5950,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
@@ -5703,7 +5972,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);
@@ -5712,34 +5981,10 @@ 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);
 }
 
-#if 0
-/* These aren't used; I don't konw what they were for.  */
-/* Set a breakpoint at the catch clause for NAME.  */
-static int
-catch_breakpoint (char *name)
-{
-}
-
-static int
-disable_catch_breakpoint (void)
-{
-}
-
-static int
-delete_catch_breakpoint (void)
-{
-}
-
-static int
-enable_catch_breakpoint (void)
-{
-}
-#endif /* 0 */
-
 static void
 ep_skip_leading_whitespace (char **s)
 {
@@ -5854,10 +6099,6 @@ typedef enum
 }
 catch_fork_kind;
 
-#if defined(CHILD_INSERT_FORK_CATCHPOINT) || defined(CHILD_INSERT_VFORK_CATCHPOINT)
-static void catch_fork_command_1 (catch_fork_kind fork_kind,
-                                 char *arg, int tempflag, int from_tty);
-
 static void
 catch_fork_command_1 (catch_fork_kind fork_kind, char *arg, int tempflag,
                      int from_tty)
@@ -5891,9 +6132,7 @@ catch_fork_command_1 (catch_fork_kind fork_kind, char *arg, int tempflag,
       break;
     }
 }
-#endif
 
-#if defined(CHILD_INSERT_EXEC_CATCHPOINT)
 static void
 catch_exec_command_1 (char *arg, int tempflag, int from_tty)
 {
@@ -5915,9 +6154,7 @@ catch_exec_command_1 (char *arg, int tempflag, int from_tty)
      and enable reporting of such events. */
   create_exec_event_catchpoint (tempflag, cond_string);
 }
-#endif
 
-#if defined(SOLIB_ADD)
 static void
 catch_load_command_1 (char *arg, int tempflag, int from_tty)
 {
@@ -6001,7 +6238,6 @@ catch_unload_command_1 (char *arg, int tempflag, int from_tty)
   SOLIB_CREATE_CATCH_UNLOAD_HOOK (PIDGET (inferior_ptid), tempflag, 
                                  dll_pathname, cond_string);
 }
-#endif /* SOLIB_ADD */
 
 /* Commands to deal with catching exceptions.  */
 
@@ -6066,10 +6302,10 @@ print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr)
   if (addressprint)
     {
       annotate_field (4);
-      ui_out_field_core_addr (uiout, "addr", b->address);
+      ui_out_field_core_addr (uiout, "addr", b->loc->address);
     }
   annotate_field (5);
-  *last_addr = b->address;
+  *last_addr = b->loc->address;
   if (strstr (b->addr_string, "throw") != NULL)
     ui_out_field_string (uiout, "what", "exception throw");
   else
@@ -6105,7 +6341,7 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string,
     trigger_func_name = xstrdup ("__cxa_throw");
 
   nameptr = trigger_func_name;
-  sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL);
+  sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL, NULL);
   if (sals.nelts == 0)
     {
       xfree (trigger_func_name);
@@ -6250,43 +6486,23 @@ catch_command_1 (char *arg, int tempflag, int from_tty)
     }
   else if (strncmp (arg1_start, "fork", arg1_length) == 0)
     {
-#if defined(CHILD_INSERT_FORK_CATCHPOINT)
       catch_fork_command_1 (catch_fork, arg1_end + 1, tempflag, from_tty);
-#else
-      error ("Catch of fork not yet implemented");
-#endif
     }
   else if (strncmp (arg1_start, "vfork", arg1_length) == 0)
     {
-#if defined(CHILD_INSERT_VFORK_CATCHPOINT)
       catch_fork_command_1 (catch_vfork, arg1_end + 1, tempflag, from_tty);
-#else
-      error ("Catch of vfork not yet implemented");
-#endif
     }
   else if (strncmp (arg1_start, "exec", arg1_length) == 0)
     {
-#if defined(CHILD_INSERT_EXEC_CATCHPOINT)
       catch_exec_command_1 (arg1_end + 1, tempflag, from_tty);
-#else
-      error ("Catch of exec not yet implemented");
-#endif
     }
   else if (strncmp (arg1_start, "load", arg1_length) == 0)
     {
-#if defined(SOLIB_ADD)
       catch_load_command_1 (arg1_end + 1, tempflag, from_tty);
-#else
-      error ("Catch of load not implemented");
-#endif
     }
   else if (strncmp (arg1_start, "unload", arg1_length) == 0)
     {
-#if defined(SOLIB_ADD)
       catch_unload_command_1 (arg1_end + 1, tempflag, from_tty);
-#else
-      error ("Catch of load not implemented");
-#endif
     }
   else if (strncmp (arg1_start, "stop", arg1_length) == 0)
     {
@@ -6320,30 +6536,6 @@ set_breakpoint_sal (struct symtab_and_line sal)
   return b;
 }
 
-#if 0
-/* These aren't used; I don't know what they were for.  */
-/* Disable breakpoints on all catch clauses described in ARGS.  */
-static void
-disable_catch (char *args)
-{
-  /* Map the disable command to catch clauses described in ARGS.  */
-}
-
-/* Enable breakpoints on all catch clauses described in ARGS.  */
-static void
-enable_catch (char *args)
-{
-  /* Map the disable command to catch clauses described in ARGS.  */
-}
-
-/* Delete breakpoints on all catch clauses in the active scope.  */
-static void
-delete_catch (char *args)
-{
-  /* Map the delete command to catch clauses described in ARGS.  */
-}
-#endif /* 0 */
-
 static void
 catch_command (char *arg, int from_tty)
 {
@@ -6425,14 +6617,14 @@ clear_command (char *arg, int from_tty)
              && b->type != bp_read_watchpoint
              && b->type != bp_access_watchpoint
              /* Not if b is a watchpoint of any sort... */
-             && (((sal.pc && (b->address == sal.pc)) 
-                  && (!section_is_overlay (b->section)
-                      || b->section == sal.section))
+             && (((sal.pc && (b->loc->address == sal.pc)) 
+                  && (!section_is_overlay (b->loc->section)
+                      || b->loc->section == sal.section))
                  /* Yes, if sal.pc matches b (modulo overlays).  */
                  || ((default_match || (0 == sal.pc))
                      && b->source_file != NULL
                      && sal.symtab != NULL
-                     && STREQ (b->source_file, sal.symtab->filename)
+                     && strcmp (b->source_file, sal.symtab->filename) == 0
                      && b->line_number == sal.line)))
            /* Yes, if sal source file and line matches b.  */
            {
@@ -6510,8 +6702,9 @@ breakpoint_auto_delete (bpstat bs)
 void
 delete_breakpoint (struct breakpoint *bpt)
 {
-  register struct breakpoint *b;
-  register bpstat bs;
+  struct breakpoint *b;
+  bpstat bs;
+  struct bp_location *loc;
 
   if (bpt == NULL)
     error ("Internal error (attempted to delete a NULL breakpoint)");
@@ -6533,16 +6726,21 @@ delete_breakpoint (struct breakpoint *bpt)
   if (bpt->type == bp_none)
     return;
 
-  if (delete_breakpoint_hook)
-    delete_breakpoint_hook (bpt);
+  if (deprecated_delete_breakpoint_hook)
+    deprecated_delete_breakpoint_hook (bpt);
   breakpoint_delete_event (bpt->number);
 
-  if (bpt->inserted)
-    remove_breakpoint (bpt, mark_inserted);
+  if (bpt->loc->inserted)
+    remove_breakpoint (bpt->loc, mark_inserted);
+
+  free_valchain (bpt->loc);
 
   if (breakpoint_chain == bpt)
     breakpoint_chain = bpt->next;
 
+  if (bp_location_chain == bpt->loc)
+    bp_location_chain = bpt->loc->next;
+
   /* If we have callback-style exception catchpoints, don't go through
      the adjustments to the C++ runtime library etc. if the inferior
      isn't actually running.  target_enable_exception_callback for a
@@ -6572,10 +6770,17 @@ delete_breakpoint (struct breakpoint *bpt)
       break;
     }
 
+  ALL_BP_LOCATIONS (loc)
+    if (loc->next == bpt->loc)
+      {
+       loc->next = bpt->loc->next;
+       break;
+      }
+
   check_duplicates (bpt);
   /* If this breakpoint was inserted, and there is another breakpoint
      at the same address, we need to insert the other breakpoint.  */
-  if (bpt->inserted
+  if (bpt->loc->inserted
       && bpt->type != bp_hardware_watchpoint
       && bpt->type != bp_read_watchpoint
       && bpt->type != bp_access_watchpoint
@@ -6584,11 +6789,12 @@ delete_breakpoint (struct breakpoint *bpt)
       && bpt->type != bp_catch_exec)
     {
       ALL_BREAKPOINTS (b)
-       if (b->address == bpt->address
-           && b->section == bpt->section
-           && !b->duplicate
+       if (b->loc->address == bpt->loc->address
+           && b->loc->section == bpt->loc->section
+           && !b->loc->duplicate
            && b->enable_state != bp_disabled
            && b->enable_state != bp_shlib_disabled
+           && !b->pending
            && b->enable_state != bp_call_disabled)
        {
          int val;
@@ -6603,9 +6809,9 @@ delete_breakpoint (struct breakpoint *bpt)
                            "a permanent breakpoint");
 
          if (b->type == bp_hardware_breakpoint)
-           val = target_insert_hw_breakpoint (b->address, b->shadow_contents);
+           val = target_insert_hw_breakpoint (b->loc->address, b->loc->shadow_contents);
          else
-           val = target_insert_breakpoint (b->address, b->shadow_contents);
+           val = target_insert_breakpoint (b->loc->address, b->loc->shadow_contents);
 
          /* If there was an error in the insert, print a message, then stop execution.  */
          if (val != 0)
@@ -6625,7 +6831,7 @@ delete_breakpoint (struct breakpoint *bpt)
                  {
                    fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number);
                    fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
-                   print_address_numeric (b->address, 1, tmp_error_stream);
+                   print_address_numeric (b->loc->address, 1, tmp_error_stream);
                    fprintf_filtered (tmp_error_stream, ": %s.\n",
                                      safe_strerror (val));
                  }
@@ -6635,7 +6841,7 @@ delete_breakpoint (struct breakpoint *bpt)
              error_stream(tmp_error_stream); 
            }
          else
-           b->inserted = 1;
+           b->loc->inserted = 1;
        }
     }
 
@@ -6675,6 +6881,7 @@ delete_breakpoint (struct breakpoint *bpt)
      bp, we mark it as deleted before freeing its storage. */
   bpt->type = bp_none;
 
+  xfree (bpt->loc);
   xfree (bpt);
 }
 
@@ -6750,6 +6957,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;
@@ -6793,14 +7002,26 @@ breakpoint_re_set_one (void *bint)
          shlib_disabled breakpoint though.  There's a fair chance we
          can't re-set it if the shared library it's in hasn't been
          loaded yet.  */
+
+      if (b->pending)
+       break;
+
       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);
+      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]);
@@ -6811,17 +7032,22 @@ breakpoint_re_set_one (void *bint)
            {
              s = b->cond_string;
              if (b->cond)
-               xfree (b->cond);
+               {
+                 xfree (b->cond);
+                 /* Avoid re-freeing b->exp if an error during the call
+                    to parse_exp_1.  */
+                 b->cond = NULL;
+               }
              b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0);
            }
 
          /* We need to re-set the breakpoint if the address changes... */
-         if (b->address != sals.sals[i].pc
+         if (b->loc->address != sals.sals[i].pc
          /* ...or new and old breakpoints both have source files, and
             the source file name or the line number changes...  */
              || (b->source_file != NULL
                  && sals.sals[i].symtab != NULL
-                 && (!STREQ (b->source_file, sals.sals[i].symtab->filename)
+                 && (strcmp (b->source_file, sals.sals[i].symtab->filename) != 0
                      || b->line_number != sals.sals[i].line)
              )
          /* ...or we switch between having a source file and not having
@@ -6838,7 +7064,10 @@ breakpoint_re_set_one (void *bint)
                  savestring (sals.sals[i].symtab->filename,
                              strlen (sals.sals[i].symtab->filename));
              b->line_number = sals.sals[i].line;
-             b->address = sals.sals[i].pc;
+             b->loc->requested_address = sals.sals[i].pc;
+             b->loc->address
+               = adjust_breakpoint_address (b->loc->requested_address,
+                                            b->type);
 
              /* Used to check for duplicates here, but that can
                 cause trouble, as it doesn't check for disabled
@@ -6850,7 +7079,7 @@ breakpoint_re_set_one (void *bint)
                 rather than once for every breakpoint.  */
              breakpoints_changed ();
            }
-         b->section = sals.sals[i].section;
+         b->loc->section = sals.sals[i].section;
          b->enable_state = save_enable;        /* Restore it, this worked. */
 
 
@@ -6877,25 +7106,40 @@ breakpoint_re_set_one (void *bint)
 
       /* So for now, just use a global context.  */
       if (b->exp)
-       xfree (b->exp);
+       {
+         xfree (b->exp);
+         /* Avoid re-freeing b->exp if an error during the call to
+             parse_expression.  */
+         b->exp = NULL;
+       }
       b->exp = parse_expression (b->exp_string);
       b->exp_valid_block = innermost_block;
       mark = value_mark ();
       if (b->val)
-       value_free (b->val);
+       {
+         value_free (b->val);
+         /* Avoid re-freeing b->val if an error during the call to
+             evaluate_expression.  */
+         b->val = NULL;
+       }
       b->val = evaluate_expression (b->exp);
       release_value (b->val);
-      if (VALUE_LAZY (b->val) && b->enable_state == bp_enabled)
+      if (VALUE_LAZY (b->val) && breakpoint_enabled (b))
        value_fetch_lazy (b->val);
 
       if (b->cond_string != NULL)
        {
          s = b->cond_string;
          if (b->cond)
-           xfree (b->cond);
+           {
+             xfree (b->cond);
+             /* Avoid re-freeing b->exp if an error during the call
+                to parse_exp_1.  */
+             b->cond = NULL;
+           }
          b->cond = parse_exp_1 (&s, (struct block *) 0, 0);
        }
-      if (b->enable_state == bp_enabled)
+      if (breakpoint_enabled (b))
        mention (b);
       value_free_to_mark (mark);
       break;
@@ -6999,7 +7243,7 @@ breakpoint_re_set_thread (struct breakpoint *b)
 void
 set_ignore_count (int bptnum, int count, int from_tty)
 {
-  register struct breakpoint *b;
+  struct breakpoint *b;
 
   if (count < 0)
     count = 0;
@@ -7044,7 +7288,7 @@ static void
 ignore_command (char *args, int from_tty)
 {
   char *p = args;
-  register int num;
+  int num;
 
   if (p == 0)
     error_no_arg ("a breakpoint number");
@@ -7068,10 +7312,10 @@ ignore_command (char *args, int from_tty)
 static void
 map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *))
 {
-  register char *p = args;
+  char *p = args;
   char *p1;
-  register int num;
-  register struct breakpoint *b, *tmp;
+  int num;
+  struct breakpoint *b, *tmp;
   int match;
 
   if (p == 0)
@@ -7127,16 +7371,15 @@ disable_breakpoint (struct breakpoint *bpt)
 
   check_duplicates (bpt);
 
-  if (modify_breakpoint_hook)
-    modify_breakpoint_hook (bpt);
+  if (deprecated_modify_breakpoint_hook)
+    deprecated_modify_breakpoint_hook (bpt);
   breakpoint_modify_event (bpt->number);
 }
 
-/* ARGSUSED */
 static void
 disable_command (char *args, int from_tty)
 {
-  register struct breakpoint *bpt;
+  struct breakpoint *bpt;
   if (args == 0)
     ALL_BREAKPOINTS (bpt)
       switch (bpt->type)
@@ -7169,8 +7412,6 @@ disable_command (char *args, int from_tty)
 static void
 do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
 {
-  struct frame_info *save_selected_frame = NULL;
-  int save_selected_frame_level = -1;
   int target_resources_ok, other_type_used;
   struct value *mark;
 
@@ -7187,72 +7428,92 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
        error ("Hardware breakpoints used exceeds limit.");
     }
 
-  if (bpt->enable_state != bp_permanent)
-    bpt->enable_state = bp_enabled;
-  bpt->disposition = disposition;
-  check_duplicates (bpt);
-  breakpoints_changed ();
-
-  if (bpt->type == bp_watchpoint || 
-      bpt->type == bp_hardware_watchpoint ||
-      bpt->type == bp_read_watchpoint || 
-      bpt->type == bp_access_watchpoint)
+  if (bpt->pending)
     {
-      if (bpt->exp_valid_block != NULL)
+      if (bpt->enable_state != bp_enabled)
        {
-         struct frame_info *fr =
-         fr = frame_find_by_id (bpt->watchpoint_frame);
-         if (fr == NULL)
+         /* When enabling a pending breakpoint, we need to check if the breakpoint
+            is resolvable since shared libraries could have been loaded
+            after the breakpoint was disabled.  */
+         breakpoints_changed ();
+         if (resolve_pending_breakpoint (bpt) == GDB_RC_OK)
            {
-             printf_filtered ("\
-Cannot enable watchpoint %d because the block in which its expression\n\
-is valid is not currently in scope.\n", bpt->number);
-             bpt->enable_state = bp_disabled;
+             delete_breakpoint (bpt);
              return;
            }
-
-         save_selected_frame = deprecated_selected_frame;
-         save_selected_frame_level = frame_relative_level (deprecated_selected_frame);
-         select_frame (fr);
+         bpt->enable_state = bp_enabled;
+         bpt->disposition = disposition;
        }
-
-      value_free (bpt->val);
-      mark = value_mark ();
-      bpt->val = evaluate_expression (bpt->exp);
-      release_value (bpt->val);
-      if (VALUE_LAZY (bpt->val))
-       value_fetch_lazy (bpt->val);
-
-      if (bpt->type == bp_hardware_watchpoint ||
-         bpt->type == bp_read_watchpoint ||
+    }
+  else  /* Not a pending breakpoint.  */
+    {
+      if (bpt->enable_state != bp_permanent)
+       bpt->enable_state = bp_enabled;
+      bpt->disposition = disposition;
+      check_duplicates (bpt);
+      breakpoints_changed ();
+      
+      if (bpt->type == bp_watchpoint || 
+         bpt->type == bp_hardware_watchpoint ||
+         bpt->type == bp_read_watchpoint || 
          bpt->type == bp_access_watchpoint)
        {
-         int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
-         int mem_cnt = can_use_hardware_watchpoint (bpt->val);
-
-         /* Hack around 'unused var' error for some targets here */
-         (void) mem_cnt, i;
-         target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (
-                                  bpt->type, i + mem_cnt, other_type_used);
-         /* we can consider of type is bp_hardware_watchpoint, convert to 
-            bp_watchpoint in the following condition */
-         if (target_resources_ok < 0)
+         struct frame_id saved_frame_id;
+
+         saved_frame_id = get_frame_id (get_selected_frame (NULL));
+         if (bpt->exp_valid_block != NULL)
+           {
+             struct frame_info *fr =
+               fr = frame_find_by_id (bpt->watchpoint_frame);
+             if (fr == NULL)
+               {
+                 printf_filtered ("\
+Cannot enable watchpoint %d because the block in which its expression\n\
+is valid is not currently in scope.\n", bpt->number);
+                 bpt->enable_state = bp_disabled;
+                 return;
+               }
+             select_frame (fr);
+           }
+         
+         value_free (bpt->val);
+         mark = value_mark ();
+         bpt->val = evaluate_expression (bpt->exp);
+         release_value (bpt->val);
+         if (VALUE_LAZY (bpt->val))
+           value_fetch_lazy (bpt->val);
+         
+         if (bpt->type == bp_hardware_watchpoint ||
+             bpt->type == bp_read_watchpoint ||
+             bpt->type == bp_access_watchpoint)
            {
-             printf_filtered ("\
+             int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
+             int mem_cnt = can_use_hardware_watchpoint (bpt->val);
+             
+             /* Hack around 'unused var' error for some targets here */
+             (void) mem_cnt, i;
+             target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (
+                                                                       bpt->type, i + mem_cnt, other_type_used);
+             /* we can consider of type is bp_hardware_watchpoint, convert to 
+                bp_watchpoint in the following condition */
+             if (target_resources_ok < 0)
+               {
+                 printf_filtered ("\
 Cannot enable watchpoint %d because target watch resources\n\
 have been allocated for other watchpoints.\n", bpt->number);
-             bpt->enable_state = bp_disabled;
-             value_free_to_mark (mark);
-             return;
+                 bpt->enable_state = bp_disabled;
+                 value_free_to_mark (mark);
+                 return;
+               }
            }
+         
+         select_frame (frame_find_by_id (saved_frame_id));
+         value_free_to_mark (mark);
        }
-
-      if (save_selected_frame_level >= 0)
-       select_frame (save_selected_frame);
-      value_free_to_mark (mark);
     }
-  if (modify_breakpoint_hook)
-    modify_breakpoint_hook (bpt);
+
+  if (deprecated_modify_breakpoint_hook)
+    deprecated_modify_breakpoint_hook (bpt);
   breakpoint_modify_event (bpt->number);
 }
 
@@ -7266,11 +7527,10 @@ enable_breakpoint (struct breakpoint *bpt)
    breakpoints) so they once again become (or continue to be) effective
    in stopping the inferior. */
 
-/* ARGSUSED */
 static void
 enable_command (char *args, int from_tty)
 {
-  register struct breakpoint *bpt;
+  struct breakpoint *bpt;
   if (args == 0)
     ALL_BREAKPOINTS (bpt)
       switch (bpt->type)
@@ -7306,7 +7566,6 @@ enable_once_breakpoint (struct breakpoint *bpt)
   do_enable_breakpoint (bpt, disp_disable);
 }
 
-/* ARGSUSED */
 static void
 enable_once_command (char *args, int from_tty)
 {
@@ -7319,13 +7578,22 @@ enable_delete_breakpoint (struct breakpoint *bpt)
   do_enable_breakpoint (bpt, disp_del);
 }
 
-/* ARGSUSED */
 static void
 enable_delete_command (char *args, int from_tty)
 {
   map_breakpoint_numbers (args, enable_delete_breakpoint);
 }
 \f
+static void
+set_breakpoint_cmd (char *args, int from_tty)
+{
+}
+
+static void
+show_breakpoint_cmd (char *args, int from_tty)
+{
+}
+
 /* Use default_breakpoint_'s, or nothing if they aren't valid.  */
 
 struct symtabs_and_lines
@@ -7338,10 +7606,10 @@ decode_line_spec_1 (char *string, int funfirstline)
     sals = decode_line_1 (&string, funfirstline,
                          default_breakpoint_symtab,
                          default_breakpoint_line,
-                         (char ***) NULL);
+                         (char ***) NULL, NULL);
   else
     sals = decode_line_1 (&string, funfirstline,
-                         (struct symtab *) NULL, 0, (char ***) NULL);
+                         (struct symtab *) NULL, 0, (char ***) NULL, NULL);
   if (*string)
     error ("Junk at end of line specification: %s", string);
   return sals;
@@ -7350,8 +7618,14 @@ decode_line_spec_1 (char *string, int funfirstline)
 void
 _initialize_breakpoint (void)
 {
+  static struct cmd_list_element *breakpoint_set_cmdlist;
+  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.  */
@@ -7665,7 +7939,34 @@ such is available.  (However, any hardware watchpoints that were\n\
 created before setting this to nonzero, will continue to use watchpoint\n\
 hardware.)",
                   &setlist);
-  add_show_from_set (c, &showlist);
+  deprecated_add_show_from_set (c, &showlist);
 
   can_use_hw_watchpoints = 1;
+
+  add_prefix_cmd ("breakpoint", class_maintenance, set_breakpoint_cmd, "\
+Breakpoint specific settings\n\
+Configure various breakpoint-specific variables such as\n\
+pending breakpoint behavior",
+                 &breakpoint_set_cmdlist, "set breakpoint ",
+                 0/*allow-unknown*/, &setlist);
+  add_prefix_cmd ("breakpoint", class_maintenance, show_breakpoint_cmd, "\
+Breakpoint specific settings\n\
+Configure various breakpoint-specific variables such as\n\
+pending breakpoint behavior",
+                 &breakpoint_show_cmdlist, "show breakpoint ",
+                 0/*allow-unknown*/, &showlist);
+
+  add_setshow_auto_boolean_cmd ("pending", no_class, &pending_break_support, "\
+Set debugger's behavior regarding pending breakpoints.", "\
+Show debugger's behavior regarding pending breakpoints.", "\
+If on, an unrecognized breakpoint location will cause gdb to create a\n\
+pending breakpoint.  If off, an unrecognized breakpoint location results in\n\
+an error.  If auto, an unrecognized breakpoint location results in a\n\
+user-query to see if a pending breakpoint should be created.", "\
+Debugger's behavior regarding pending breakpoints is %s.",
+                               NULL, NULL,
+                               &breakpoint_set_cmdlist,
+                               &breakpoint_show_cmdlist);
+
+  pending_break_support = AUTO_BOOLEAN_AUTO;
 }
This page took 0.106934 seconds and 4 git commands to generate.