Simple -Wshadow=local fixes
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index de6df2e6f2dfc393e3f6373774b85e0a6799a0ff..3d254344f2f9300d6286866b7f4dcabc7015b46e 100644 (file)
@@ -1,6 +1,6 @@
 /* Everything about breakpoints, for GDB.
 
 /* Everything about breakpoints, for GDB.
 
-   Copyright (C) 1986-2017 Free Software Foundation, Inc.
+   Copyright (C) 1986-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
    This file is part of GDB.
 
 #include "source.h"
 #include "linespec.h"
 #include "completer.h"
 #include "source.h"
 #include "linespec.h"
 #include "completer.h"
-#include "gdb.h"
 #include "ui-out.h"
 #include "cli/cli-script.h"
 #include "block.h"
 #include "solib.h"
 #include "solist.h"
 #include "ui-out.h"
 #include "cli/cli-script.h"
 #include "block.h"
 #include "solib.h"
 #include "solist.h"
-#include "observer.h"
+#include "observable.h"
 #include "memattr.h"
 #include "ada-lang.h"
 #include "top.h"
 #include "memattr.h"
 #include "ada-lang.h"
 #include "top.h"
@@ -81,6 +80,8 @@
 #include "extension.h"
 #include <algorithm>
 #include "progspace-and-thread.h"
 #include "extension.h"
 #include <algorithm>
 #include "progspace-and-thread.h"
+#include "common/array-view.h"
+#include "common/gdb_optional.h"
 
 /* Enums for exception-handling support.  */
 enum exception_event_kind
 
 /* Enums for exception-handling support.  */
 enum exception_event_kind
@@ -92,24 +93,8 @@ enum exception_event_kind
 
 /* Prototypes for local functions.  */
 
 
 /* Prototypes for local functions.  */
 
-static void enable_delete_command (char *, int);
-
-static void enable_once_command (char *, int);
-
-static void enable_count_command (char *, int);
-
-static void disable_command (char *, int);
-
-static void enable_command (char *, int);
-
 static void map_breakpoint_numbers (const char *,
 static void map_breakpoint_numbers (const char *,
-                                   void (*) (struct breakpoint *,
-                                             void *),
-                                   void *);
-
-static void ignore_command (char *, int);
-
-static int breakpoint_re_set_one (void *);
+                                   gdb::function_view<void (breakpoint *)>);
 
 static void breakpoint_re_set_default (struct breakpoint *);
 
 
 static void breakpoint_re_set_default (struct breakpoint *);
 
@@ -128,18 +113,12 @@ static void create_breakpoints_sal_default (struct gdbarch *,
                                            const struct breakpoint_ops *,
                                            int, int, int, unsigned);
 
                                            const struct breakpoint_ops *,
                                            int, int, int, unsigned);
 
-static void decode_location_default (struct breakpoint *b,
-                                    const struct event_location *location,
-                                    struct program_space *search_pspace,
-                                    struct symtabs_and_lines *sals);
-
-static void clear_command (char *, int);
+static std::vector<symtab_and_line> decode_location_default
+  (struct breakpoint *b, const struct event_location *location,
+   struct program_space *search_pspace);
 
 
-static void catch_command (char *, int);
-
-static int can_use_hardware_watchpoint (struct value *);
-
-static void break_command_1 (char *, int, int);
+static int can_use_hardware_watchpoint
+    (const std::vector<value_ref_ptr> &vals);
 
 static void mention (struct breakpoint *);
 
 
 static void mention (struct breakpoint *);
 
@@ -176,37 +155,18 @@ static int watchpoint_locations_match (struct bp_location *loc1,
                                       struct bp_location *loc2);
 
 static int breakpoint_location_address_match (struct bp_location *bl,
                                       struct bp_location *loc2);
 
 static int breakpoint_location_address_match (struct bp_location *bl,
-                                             struct address_space *aspace,
+                                             const struct address_space *aspace,
                                              CORE_ADDR addr);
 
 static int breakpoint_location_address_range_overlap (struct bp_location *,
                                              CORE_ADDR addr);
 
 static int breakpoint_location_address_range_overlap (struct bp_location *,
-                                                     struct address_space *,
+                                                     const address_space *,
                                                      CORE_ADDR, int);
 
                                                      CORE_ADDR, int);
 
-static void breakpoints_info (char *, int);
-
-static void watchpoints_info (char *, int);
-
-static int breakpoint_1 (char *, int, 
-                        int (*) (const struct breakpoint *));
-
-static int breakpoint_cond_eval (void *);
-
-static void cleanup_executing_breakpoints (void *);
-
-static void commands_command (char *, int);
-
-static void condition_command (char *, int);
-
 static int remove_breakpoint (struct bp_location *);
 static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason);
 
 static enum print_stop_action print_bp_stop_message (bpstat bs);
 
 static int remove_breakpoint (struct bp_location *);
 static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason);
 
 static enum print_stop_action print_bp_stop_message (bpstat bs);
 
-static int watchpoint_check (void *);
-
-static void maintenance_info_breakpoints (char *, int);
-
 static int hw_breakpoint_used_count (void);
 
 static int hw_watchpoint_use_count (struct breakpoint *);
 static int hw_breakpoint_used_count (void);
 
 static int hw_watchpoint_use_count (struct breakpoint *);
@@ -215,21 +175,9 @@ static int hw_watchpoint_used_count_others (struct breakpoint *except,
                                            enum bptype type,
                                            int *other_type_used);
 
                                            enum bptype type,
                                            int *other_type_used);
 
-static void hbreak_command (char *, int);
-
-static void thbreak_command (char *, int);
-
 static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
                                    int count);
 
 static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
                                    int count);
 
-static void stop_command (char *arg, int from_tty);
-
-static void stopin_command (char *arg, int from_tty);
-
-static void stopat_command (char *arg, int from_tty);
-
-static void tcatch_command (char *arg, int from_tty);
-
 static void free_bp_location (struct bp_location *loc);
 static void incref_bp_location (struct bp_location *loc);
 static void decref_bp_location (struct bp_location **loc);
 static void free_bp_location (struct bp_location *loc);
 static void incref_bp_location (struct bp_location *loc);
 static void decref_bp_location (struct bp_location **loc);
@@ -279,15 +227,7 @@ static int is_hardware_watchpoint (const struct breakpoint *bpt);
 
 static void insert_breakpoint_locations (void);
 
 
 static void insert_breakpoint_locations (void);
 
-static void tracepoints_info (char *, int);
-
-static void delete_trace_command (char *, int);
-
-static void enable_trace_command (char *, int);
-
-static void disable_trace_command (char *, int);
-
-static void trace_pass_command (char *, int);
+static void trace_pass_command (const char *, int);
 
 static void set_tracepoint_count (int num);
 
 
 static void set_tracepoint_count (int num);
 
@@ -360,21 +300,10 @@ static char *dprintf_channel;
    has disconnected.  */
 static int disconnected_dprintf = 1;
 
    has disconnected.  */
 static int disconnected_dprintf = 1;
 
-/* A reference-counted struct command_line.  This lets multiple
-   breakpoints share a single command list.  */
-struct counted_command_line
-{
-  /* The reference count.  */
-  int refc;
-
-  /* The command list.  */
-  struct command_line *commands;
-};
-
 struct command_line *
 breakpoint_commands (struct breakpoint *b)
 {
 struct command_line *
 breakpoint_commands (struct breakpoint *b)
 {
-  return b->commands ? b->commands->commands : NULL;
+  return b->commands ? b->commands.get () : NULL;
 }
 
 /* Flag indicating that a command has proceeded the inferior past the
 }
 
 /* Flag indicating that a command has proceeded the inferior past the
@@ -551,8 +480,6 @@ gdb_evaluates_breakpoint_condition_p (void)
   return (mode == condition_evaluation_host);
 }
 
   return (mode == condition_evaluation_host);
 }
 
-void _initialize_breakpoint (void);
-
 /* Are we executing breakpoint commands?  */
 static int executing_breakpoint_commands;
 
 /* Are we executing breakpoint commands?  */
 static int executing_breakpoint_commands;
 
@@ -633,7 +560,7 @@ static CORE_ADDR bp_locations_shadow_len_after_address_max;
 /* The locations that no longer correspond to any breakpoint, unlinked
    from the bp_locations array, but for which a hit may still be
    reported by a target.  */
 /* The locations that no longer correspond to any breakpoint, unlinked
    from the bp_locations array, but for which a hit may still be
    reported by a target.  */
-VEC(bp_location_p) *moribund_locations = NULL;
+static std::vector<bp_location *> moribund_locations;
 
 /* Number of last breakpoint made.  */
 
 
 /* Number of last breakpoint made.  */
 
@@ -694,8 +621,7 @@ static int rbreak_start_breakpoint_count;
 /* Called at the start an "rbreak" command to record the first
    breakpoint made.  */
 
 /* Called at the start an "rbreak" command to record the first
    breakpoint made.  */
 
-void
-start_rbreak_breakpoints (void)
+scoped_rbreak_breakpoints::scoped_rbreak_breakpoints ()
 {
   rbreak_start_breakpoint_count = breakpoint_count;
 }
 {
   rbreak_start_breakpoint_count = breakpoint_count;
 }
@@ -703,8 +629,7 @@ start_rbreak_breakpoints (void)
 /* Called at the end of an "rbreak" command to record the last
    breakpoint made.  */
 
 /* Called at the end of an "rbreak" command to record the last
    breakpoint made.  */
 
-void
-end_rbreak_breakpoints (void)
+scoped_rbreak_breakpoints::~scoped_rbreak_breakpoints ()
 {
   prev_breakpoint_count = rbreak_start_breakpoint_count;
 }
 {
   prev_breakpoint_count = rbreak_start_breakpoint_count;
 }
@@ -720,64 +645,6 @@ clear_breakpoint_hit_counts (void)
     b->hit_count = 0;
 }
 
     b->hit_count = 0;
 }
 
-/* Allocate a new counted_command_line with reference count of 1.
-   The new structure owns COMMANDS.  */
-
-static struct counted_command_line *
-alloc_counted_command_line (struct command_line *commands)
-{
-  struct counted_command_line *result = XNEW (struct counted_command_line);
-
-  result->refc = 1;
-  result->commands = commands;
-
-  return result;
-}
-
-/* Increment reference count.  This does nothing if CMD is NULL.  */
-
-static void
-incref_counted_command_line (struct counted_command_line *cmd)
-{
-  if (cmd)
-    ++cmd->refc;
-}
-
-/* Decrement reference count.  If the reference count reaches 0,
-   destroy the counted_command_line.  Sets *CMDP to NULL.  This does
-   nothing if *CMDP is NULL.  */
-
-static void
-decref_counted_command_line (struct counted_command_line **cmdp)
-{
-  if (*cmdp)
-    {
-      if (--(*cmdp)->refc == 0)
-       {
-         free_command_lines (&(*cmdp)->commands);
-         xfree (*cmdp);
-       }
-      *cmdp = NULL;
-    }
-}
-
-/* A cleanup function that calls decref_counted_command_line.  */
-
-static void
-do_cleanup_counted_command_line (void *arg)
-{
-  decref_counted_command_line ((struct counted_command_line **) arg);
-}
-
-/* Create a cleanup that calls decref_counted_command_line on the
-   argument.  */
-
-static struct cleanup *
-make_cleanup_decref_counted_command_line (struct counted_command_line **cmdp)
-{
-  return make_cleanup (do_cleanup_counted_command_line, cmdp);
-}
-
 \f
 /* Return the breakpoint with the specified number, or NULL
    if the number does not refer to an existing breakpoint.  */
 \f
 /* Return the breakpoint with the specified number, or NULL
    if the number does not refer to an existing breakpoint.  */
@@ -844,7 +711,7 @@ mark_breakpoint_location_modified (struct bp_location *loc)
    condition_evaluation_mode.  */
 
 static void
    condition_evaluation_mode.  */
 
 static void
-set_condition_evaluation_mode (char *args, int from_tty,
+set_condition_evaluation_mode (const char *args, int from_tty,
                               struct cmd_list_element *c)
 {
   const char *old_mode, *new_mode;
                               struct cmd_list_element *c)
 {
   const char *old_mode, *new_mode;
@@ -1013,12 +880,12 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
        {
          struct watchpoint *w = (struct watchpoint *) b;
 
        {
          struct watchpoint *w = (struct watchpoint *) b;
 
-         innermost_block = NULL;
+         innermost_block.reset ();
          arg = exp;
          w->cond_exp = parse_exp_1 (&arg, 0, 0, 0);
          if (*arg)
            error (_("Junk at end of expression"));
          arg = exp;
          w->cond_exp = parse_exp_1 (&arg, 0, 0, 0);
          if (*arg)
            error (_("Junk at end of expression"));
-         w->cond_exp_valid_block = innermost_block;
+         w->cond_exp_valid_block = innermost_block.block ();
        }
       else
        {
        }
       else
        {
@@ -1037,7 +904,7 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
     }
   mark_breakpoint_modified (b);
 
     }
   mark_breakpoint_modified (b);
 
-  observer_notify_breakpoint_modified (b);
+  gdb::observers::breakpoint_modified.notify (b);
 }
 
 /* Completion for the "condition" command.  */
 }
 
 /* Completion for the "condition" command.  */
@@ -1049,13 +916,12 @@ condition_completer (struct cmd_list_element *cmd,
 {
   const char *space;
 
 {
   const char *space;
 
-  text = skip_spaces_const (text);
-  space = skip_to_space_const (text);
+  text = skip_spaces (text);
+  space = skip_to_space (text);
   if (*space == '\0')
     {
       int len;
       struct breakpoint *b;
   if (*space == '\0')
     {
       int len;
       struct breakpoint *b;
-      VEC (char_ptr) *result = NULL;
 
       if (text[0] == '$')
        {
 
       if (text[0] == '$')
        {
@@ -1085,17 +951,17 @@ condition_completer (struct cmd_list_element *cmd,
     }
 
   /* We're completing the expression part.  */
     }
 
   /* We're completing the expression part.  */
-  text = skip_spaces_const (space);
+  text = skip_spaces (space);
   expression_completer (cmd, tracker, text, word);
 }
 
 /* condition N EXP -- set break condition of breakpoint N to EXP.  */
 
 static void
   expression_completer (cmd, tracker, text, word);
 }
 
 /* condition N EXP -- set break condition of breakpoint N to EXP.  */
 
 static void
-condition_command (char *arg, int from_tty)
+condition_command (const char *arg, int from_tty)
 {
   struct breakpoint *b;
 {
   struct breakpoint *b;
-  char *p;
+  const char *p;
   int bnum;
 
   if (arg == 0)
   int bnum;
 
   if (arg == 0)
@@ -1143,14 +1009,12 @@ check_no_tracepoint_commands (struct command_line *commands)
 
   for (c = commands; c; c = c->next)
     {
 
   for (c = commands; c; c = c->next)
     {
-      int i;
-
       if (c->control_type == while_stepping_control)
        error (_("The 'while-stepping' command can "
                 "only be used for tracepoints"));
 
       if (c->control_type == while_stepping_control)
        error (_("The 'while-stepping' command can "
                 "only be used for tracepoints"));
 
-      for (i = 0; i < c->body_count; ++i)
-       check_no_tracepoint_commands ((c->body_list)[i]);
+      check_no_tracepoint_commands (c->body_list_0.get ());
+      check_no_tracepoint_commands (c->body_list_1.get ());
 
       /* Not that command parsing removes leading whitespace and comment
         lines and also empty lines.  So, we only need to check for
 
       /* Not that command parsing removes leading whitespace and comment
         lines and also empty lines.  So, we only need to check for
@@ -1261,8 +1125,8 @@ validate_commands_for_breakpoint (struct breakpoint *b,
        {
          struct command_line *c2;
 
        {
          struct command_line *c2;
 
-         gdb_assert (while_stepping->body_count == 1);
-         c2 = while_stepping->body_list[0];
+         gdb_assert (while_stepping->body_list_1 == nullptr);
+         c2 = while_stepping->body_list_0.get ();
          for (; c2; c2 = c2->next)
            {
              if (c2->control_type == while_stepping_control)
          for (; c2; c2 = c2->next)
            {
              if (c2->control_type == while_stepping_control)
@@ -1279,11 +1143,11 @@ validate_commands_for_breakpoint (struct breakpoint *b,
 /* Return a vector of all the static tracepoints set at ADDR.  The
    caller is responsible for releasing the vector.  */
 
 /* Return a vector of all the static tracepoints set at ADDR.  The
    caller is responsible for releasing the vector.  */
 
-VEC(breakpoint_p) *
+std::vector<breakpoint *>
 static_tracepoints_here (CORE_ADDR addr)
 {
   struct breakpoint *b;
 static_tracepoints_here (CORE_ADDR addr)
 {
   struct breakpoint *b;
-  VEC(breakpoint_p) *found = 0;
+  std::vector<breakpoint *> found;
   struct bp_location *loc;
 
   ALL_BREAKPOINTS (b)
   struct bp_location *loc;
 
   ALL_BREAKPOINTS (b)
@@ -1291,7 +1155,7 @@ static_tracepoints_here (CORE_ADDR addr)
       {
        for (loc = b->loc; loc; loc = loc->next)
          if (loc->address == addr)
       {
        for (loc = b->loc; loc; loc = loc->next)
          if (loc->address == addr)
-           VEC_safe_push(breakpoint_p, found, b);
+           found.push_back (b);
       }
 
   return found;
       }
 
   return found;
@@ -1302,13 +1166,12 @@ static_tracepoints_here (CORE_ADDR addr)
 
 void
 breakpoint_set_commands (struct breakpoint *b, 
 
 void
 breakpoint_set_commands (struct breakpoint *b, 
-                        command_line_up &&commands)
+                        counted_command_line &&commands)
 {
   validate_commands_for_breakpoint (b, commands.get ());
 
 {
   validate_commands_for_breakpoint (b, commands.get ());
 
-  decref_counted_command_line (&b->commands);
-  b->commands = alloc_counted_command_line (commands.release ());
-  observer_notify_breakpoint_modified (b);
+  b->commands = std::move (commands);
+  gdb::observers::breakpoint_modified.notify (b);
 }
 
 /* Set the internal `silent' flag on the breakpoint.  Note that this
 }
 
 /* Set the internal `silent' flag on the breakpoint.  Note that this
@@ -1322,7 +1185,7 @@ breakpoint_set_silent (struct breakpoint *b, int silent)
 
   b->silent = silent;
   if (old_silent != silent)
 
   b->silent = silent;
   if (old_silent != silent)
-    observer_notify_breakpoint_modified (b);
+    gdb::observers::breakpoint_modified.notify (b);
 }
 
 /* Set the thread for this breakpoint.  If THREAD is -1, make the
 }
 
 /* Set the thread for this breakpoint.  If THREAD is -1, make the
@@ -1335,7 +1198,7 @@ breakpoint_set_thread (struct breakpoint *b, int thread)
 
   b->thread = thread;
   if (old_thread != thread)
 
   b->thread = thread;
   if (old_thread != thread)
-    observer_notify_breakpoint_modified (b);
+    gdb::observers::breakpoint_modified.notify (b);
 }
 
 /* Set the task for this breakpoint.  If TASK is 0, make the
 }
 
 /* Set the task for this breakpoint.  If TASK is 0, make the
@@ -1348,99 +1211,18 @@ breakpoint_set_task (struct breakpoint *b, int task)
 
   b->task = task;
   if (old_task != task)
 
   b->task = task;
   if (old_task != task)
-    observer_notify_breakpoint_modified (b);
-}
-
-void
-check_tracepoint_command (char *line, void *closure)
-{
-  struct breakpoint *b = (struct breakpoint *) closure;
-
-  validate_actionline (line, b);
-}
-
-/* A structure used to pass information through
-   map_breakpoint_numbers.  */
-
-struct commands_info
-{
-  /* True if the command was typed at a tty.  */
-  int from_tty;
-
-  /* The breakpoint range spec.  */
-  const char *arg;
-
-  /* Non-NULL if the body of the commands are being read from this
-     already-parsed command.  */
-  struct command_line *control;
-
-  /* The command lines read from the user, or NULL if they have not
-     yet been read.  */
-  struct counted_command_line *cmd;
-};
-
-/* A callback for map_breakpoint_numbers that sets the commands for
-   commands_command.  */
-
-static void
-do_map_commands_command (struct breakpoint *b, void *data)
-{
-  struct commands_info *info = (struct commands_info *) data;
-
-  if (info->cmd == NULL)
-    {
-      command_line_up l;
-
-      if (info->control != NULL)
-       l = copy_command_lines (info->control->body_list[0]);
-      else
-       {
-         struct cleanup *old_chain;
-         char *str;
-
-         str = xstrprintf (_("Type commands for breakpoint(s) "
-                             "%s, one per line."),
-                           info->arg);
-
-         old_chain = make_cleanup (xfree, str);
-
-         l = read_command_lines (str,
-                                 info->from_tty, 1,
-                                 (is_tracepoint (b)
-                                  ? check_tracepoint_command : 0),
-                                 b);
-
-         do_cleanups (old_chain);
-       }
-
-      info->cmd = alloc_counted_command_line (l.release ());
-    }
-
-  /* If a breakpoint was on the list more than once, we don't need to
-     do anything.  */
-  if (b->commands != info->cmd)
-    {
-      validate_commands_for_breakpoint (b, info->cmd->commands);
-      incref_counted_command_line (info->cmd);
-      decref_counted_command_line (&b->commands);
-      b->commands = info->cmd;
-      observer_notify_breakpoint_modified (b);
-    }
+    gdb::observers::breakpoint_modified.notify (b);
 }
 
 static void
 commands_command_1 (const char *arg, int from_tty,
                    struct command_line *control)
 {
 }
 
 static void
 commands_command_1 (const char *arg, int from_tty,
                    struct command_line *control)
 {
-  struct cleanup *cleanups;
-  struct commands_info info;
-
-  info.from_tty = from_tty;
-  info.control = control;
-  info.cmd = NULL;
-  /* If we read command lines from the user, then `info' will hold an
-     extra reference to the commands that we must clean up.  */
-  cleanups = make_cleanup_decref_counted_command_line (&info.cmd);
+  counted_command_line cmd;
+  /* cmd_read will be true once we have read cmd.  Note that cmd might still be
+     NULL after the call to read_command_lines if the user provides an empty
+     list of command by just typing "end".  */
+  bool cmd_read = false;
 
   std::string new_arg;
 
 
   std::string new_arg;
 
@@ -1451,22 +1233,50 @@ commands_command_1 (const char *arg, int from_tty,
                                 breakpoint_count);
       else if (breakpoint_count > 0)
        new_arg = string_printf ("%d", breakpoint_count);
                                 breakpoint_count);
       else if (breakpoint_count > 0)
        new_arg = string_printf ("%d", breakpoint_count);
-    }
-  else
-    new_arg = arg;
-
-  info.arg = new_arg.c_str ();
-
-  map_breakpoint_numbers (info.arg, do_map_commands_command, &info);
-
-  if (info.cmd == NULL)
-    error (_("No breakpoints specified."));
-
-  do_cleanups (cleanups);
-}
-
-static void
-commands_command (char *arg, int from_tty)
+      arg = new_arg.c_str ();
+    }
+
+  map_breakpoint_numbers
+    (arg, [&] (breakpoint *b)
+     {
+       if (!cmd_read)
+        {
+          gdb_assert (cmd == NULL);
+          if (control != NULL)
+            cmd = control->body_list_0;
+          else
+            {
+              std::string str
+                = string_printf (_("Type commands for breakpoint(s) "
+                                   "%s, one per line."),
+                                 arg);
+
+              auto do_validate = [=] (const char *line)
+                                 {
+                                   validate_actionline (line, b);
+                                 };
+              gdb::function_view<void (const char *)> validator;
+              if (is_tracepoint (b))
+                validator = do_validate;
+
+              cmd = read_command_lines (str.c_str (), from_tty, 1, validator);
+            }
+          cmd_read = true;
+        }
+
+       /* If a breakpoint was on the list more than once, we don't need to
+         do anything.  */
+       if (b->commands != cmd)
+        {
+          validate_commands_for_breakpoint (b, cmd.get ());
+          b->commands = cmd;
+          gdb::observers::breakpoint_modified.notify (b);
+        }
+     });
+}
+
+static void
+commands_command (const char *arg, int from_tty)
 {
   commands_command_1 (arg, from_tty, NULL);
 }
 {
   commands_command_1 (arg, from_tty, NULL);
 }
@@ -1740,9 +1550,9 @@ static int
 watchpoint_in_thread_scope (struct watchpoint *b)
 {
   return (b->pspace == current_program_space
 watchpoint_in_thread_scope (struct watchpoint *b)
 {
   return (b->pspace == current_program_space
-         && (ptid_equal (b->watchpoint_thread, null_ptid)
-             || (ptid_equal (inferior_ptid, b->watchpoint_thread)
-                 && !is_executing (inferior_ptid))));
+         && (b->watchpoint_thread == null_ptid
+             || (inferior_ptid == b->watchpoint_thread
+                 && !inferior_thread ()->executing)));
 }
 
 /* Set watchpoint B to disp_del_at_next_stop, even including its possible
 }
 
 /* Set watchpoint B to disp_del_at_next_stop, even including its possible
@@ -1931,7 +1741,6 @@ update_watchpoint (struct watchpoint *b, int reparse)
         no longer relevant.  We don't want to report a watchpoint hit
         to the user when the old value and the new value may actually
         be completely different objects.  */
         no longer relevant.  We don't want to report a watchpoint hit
         to the user when the old value and the new value may actually
         be completely different objects.  */
-      value_free (b->val);
       b->val = NULL;
       b->val_valid = 0;
 
       b->val = NULL;
       b->val_valid = 0;
 
@@ -1969,7 +1778,8 @@ update_watchpoint (struct watchpoint *b, int reparse)
   else if (within_current_scope && b->exp)
     {
       int pc = 0;
   else if (within_current_scope && b->exp)
     {
       int pc = 0;
-      struct value *val_chain, *v, *result, *next;
+      std::vector<value_ref_ptr> val_chain;
+      struct value *v, *result;
       struct program_space *frame_pspace;
 
       fetch_subexp_value (b->exp.get (), &pc, &v, &result, &val_chain, 0);
       struct program_space *frame_pspace;
 
       fetch_subexp_value (b->exp.get (), &pc, &v, &result, &val_chain, 0);
@@ -1983,27 +1793,26 @@ update_watchpoint (struct watchpoint *b, int reparse)
       if (!b->val_valid && !is_masked_watchpoint (b))
        {
          if (b->val_bitsize != 0)
       if (!b->val_valid && !is_masked_watchpoint (b))
        {
          if (b->val_bitsize != 0)
-           {
-             v = extract_bitfield_from_watchpoint_value (b, v);
-             if (v != NULL)
-               release_value (v);
-           }
-         b->val = v;
+           v = extract_bitfield_from_watchpoint_value (b, v);
+         b->val = release_value (v);
          b->val_valid = 1;
        }
 
       frame_pspace = get_frame_program_space (get_selected_frame (NULL));
 
       /* Look at each value on the value chain.  */
          b->val_valid = 1;
        }
 
       frame_pspace = get_frame_program_space (get_selected_frame (NULL));
 
       /* Look at each value on the value chain.  */
-      for (v = val_chain; v; v = value_next (v))
+      gdb_assert (!val_chain.empty ());
+      for (const value_ref_ptr &iter : val_chain)
        {
        {
+         v = iter.get ();
+
          /* If it's a memory location, and GDB actually needed
             its contents to evaluate the expression, then we
             must watch it.  If the first value returned is
             still lazy, that means an error occurred reading it;
             watch it anyway in case it becomes readable.  */
          if (VALUE_LVAL (v) == lval_memory
          /* If it's a memory location, and GDB actually needed
             its contents to evaluate the expression, then we
             must watch it.  If the first value returned is
             still lazy, that means an error occurred reading it;
             watch it anyway in case it becomes readable.  */
          if (VALUE_LVAL (v) == lval_memory
-             && (v == val_chain || ! value_lazy (v)))
+             && (v == val_chain[0] || ! value_lazy (v)))
            {
              struct type *vtype = check_typedef (value_type (v));
 
            {
              struct type *vtype = check_typedef (value_type (v));
 
@@ -2055,7 +1864,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
                  loc->gdbarch = get_type_arch (value_type (v));
 
                  loc->pspace = frame_pspace;
                  loc->gdbarch = get_type_arch (value_type (v));
 
                  loc->pspace = frame_pspace;
-                 loc->address = addr;
+                 loc->address = address_significant (loc->gdbarch, addr);
 
                  if (bitsize != 0)
                    {
 
                  if (bitsize != 0)
                    {
@@ -2158,13 +1967,6 @@ update_watchpoint (struct watchpoint *b, int reparse)
            bl->loc_type = loc_type;
        }
 
            bl->loc_type = loc_type;
        }
 
-      for (v = val_chain; v; v = next)
-       {
-         next = value_next (v);
-         if (v != b->val)
-           value_free (v);
-       }
-
       /* If a software watchpoint is not watching any memory, then the
         above left it without any location set up.  But,
         bpstat_stop_status requires a location to be able to report
       /* If a software watchpoint is not watching any memory, then the
         above left it without any location set up.  But,
         bpstat_stop_status requires a location to be able to report
@@ -2417,12 +2219,8 @@ build_target_condition_list (struct bp_location *bl)
 static agent_expr_up
 parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 {
 static agent_expr_up
 parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 {
-  struct cleanup *old_cleanups = 0;
-  struct expression **argvec;
   const char *cmdrest;
   const char *format_start, *format_end;
   const char *cmdrest;
   const char *format_start, *format_end;
-  struct format_piece *fpieces;
-  int nargs;
   struct gdbarch *gdbarch = get_current_arch ();
 
   if (cmd == NULL)
   struct gdbarch *gdbarch = get_current_arch ();
 
   if (cmd == NULL)
@@ -2432,44 +2230,39 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 
   if (*cmdrest == ',')
     ++cmdrest;
 
   if (*cmdrest == ',')
     ++cmdrest;
-  cmdrest = skip_spaces_const (cmdrest);
+  cmdrest = skip_spaces (cmdrest);
 
   if (*cmdrest++ != '"')
     error (_("No format string following the location"));
 
   format_start = cmdrest;
 
 
   if (*cmdrest++ != '"')
     error (_("No format string following the location"));
 
   format_start = cmdrest;
 
-  fpieces = parse_format_string (&cmdrest);
-
-  old_cleanups = make_cleanup (free_format_pieces_cleanup, &fpieces);
+  format_pieces fpieces (&cmdrest);
 
   format_end = cmdrest;
 
   if (*cmdrest++ != '"')
     error (_("Bad format string, non-terminated '\"'."));
   
 
   format_end = cmdrest;
 
   if (*cmdrest++ != '"')
     error (_("Bad format string, non-terminated '\"'."));
   
-  cmdrest = skip_spaces_const (cmdrest);
+  cmdrest = skip_spaces (cmdrest);
 
   if (!(*cmdrest == ',' || *cmdrest == '\0'))
     error (_("Invalid argument syntax"));
 
   if (*cmdrest == ',')
     cmdrest++;
 
   if (!(*cmdrest == ',' || *cmdrest == '\0'))
     error (_("Invalid argument syntax"));
 
   if (*cmdrest == ',')
     cmdrest++;
-  cmdrest = skip_spaces_const (cmdrest);
+  cmdrest = skip_spaces (cmdrest);
 
   /* For each argument, make an expression.  */
 
 
   /* For each argument, make an expression.  */
 
-  argvec = (struct expression **) alloca (strlen (cmd)
-                                        * sizeof (struct expression *));
-
-  nargs = 0;
+  std::vector<struct expression *> argvec;
   while (*cmdrest != '\0')
     {
       const char *cmd1;
 
       cmd1 = cmdrest;
       expression_up expr = parse_exp_1 (&cmd1, scope, block_for_pc (scope), 1);
   while (*cmdrest != '\0')
     {
       const char *cmd1;
 
       cmd1 = cmdrest;
       expression_up expr = parse_exp_1 (&cmd1, scope, block_for_pc (scope), 1);
-      argvec[nargs++] = expr.release ();
+      argvec.push_back (expr.release ());
       cmdrest = cmd1;
       if (*cmdrest == ',')
        ++cmdrest;
       cmdrest = cmd1;
       if (*cmdrest == ',')
        ++cmdrest;
@@ -2483,7 +2276,7 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
     {
       aexpr = gen_printf (scope, gdbarch, 0, 0,
                          format_start, format_end - format_start,
     {
       aexpr = gen_printf (scope, gdbarch, 0, 0,
                          format_start, format_end - format_start,
-                         fpieces, nargs, argvec);
+                         argvec.size (), argvec.data ());
     }
   CATCH (ex, RETURN_MASK_ERROR)
     {
     }
   CATCH (ex, RETURN_MASK_ERROR)
     {
@@ -2493,8 +2286,6 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
     }
   END_CATCH
 
     }
   END_CATCH
 
-  do_cleanups (old_cleanups);
-
   /* We have a valid agent expression, return it.  */
   return aexpr;
 }
   /* We have a valid agent expression, return it.  */
   return aexpr;
 }
@@ -2621,7 +2412,7 @@ breakpoint_kind (struct bp_location *bl, CORE_ADDR *addr)
       struct thread_info *thr = find_thread_global_id (bl->owner->thread);
       struct regcache *regcache;
 
       struct thread_info *thr = find_thread_global_id (bl->owner->thread);
       struct regcache *regcache;
 
-      regcache = get_thread_regcache (thr->ptid);
+      regcache = get_thread_regcache (thr);
 
       return gdbarch_breakpoint_kind_from_current_state (bl->gdbarch,
                                                         regcache, addr);
 
       return gdbarch_breakpoint_kind_from_current_state (bl->gdbarch,
                                                         regcache, addr);
@@ -2645,8 +2436,7 @@ insert_bp_location (struct bp_location *bl,
                    int *hw_breakpoint_error,
                    int *hw_bp_error_explained_already)
 {
                    int *hw_breakpoint_error,
                    int *hw_bp_error_explained_already)
 {
-  enum errors bp_err = GDB_NO_ERROR;
-  const char *bp_err_message = NULL;
+  gdb_exception bp_excpt = exception_none;
 
   if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
     return 0;
 
   if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
     return 0;
@@ -2755,12 +2545,11 @@ insert_bp_location (struct bp_location *bl,
 
              val = bl->owner->ops->insert_location (bl);
              if (val)
 
              val = bl->owner->ops->insert_location (bl);
              if (val)
-               bp_err = GENERIC_ERROR;
+               bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
            }
          CATCH (e, RETURN_MASK_ALL)
            {
            }
          CATCH (e, RETURN_MASK_ALL)
            {
-             bp_err = e.error;
-             bp_err_message = e.message;
+             bp_excpt = e;
            }
          END_CATCH
        }
            }
          END_CATCH
        }
@@ -2795,16 +2584,16 @@ insert_bp_location (struct bp_location *bl,
                      val = target_insert_breakpoint (bl->gdbarch,
                                                      &bl->overlay_target_info);
                      if (val)
                      val = target_insert_breakpoint (bl->gdbarch,
                                                      &bl->overlay_target_info);
                      if (val)
-                       bp_err = GENERIC_ERROR;
+                       bp_excpt
+                         = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
                    }
                  CATCH (e, RETURN_MASK_ALL)
                    {
                    }
                  CATCH (e, RETURN_MASK_ALL)
                    {
-                     bp_err = e.error;
-                     bp_err_message = e.message;
+                     bp_excpt = e;
                    }
                  END_CATCH
 
                    }
                  END_CATCH
 
-                 if (bp_err != GDB_NO_ERROR)
+                 if (bp_excpt.reason != 0)
                    fprintf_unfiltered (tmp_error_stream,
                                        "Overlay breakpoint %d "
                                        "failed: in ROM?\n",
                    fprintf_unfiltered (tmp_error_stream,
                                        "Overlay breakpoint %d "
                                        "failed: in ROM?\n",
@@ -2821,12 +2610,11 @@ insert_bp_location (struct bp_location *bl,
 
                  val = bl->owner->ops->insert_location (bl);
                  if (val)
 
                  val = bl->owner->ops->insert_location (bl);
                  if (val)
-                   bp_err = GENERIC_ERROR;
+                   bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
                }
              CATCH (e, RETURN_MASK_ALL)
                {
                }
              CATCH (e, RETURN_MASK_ALL)
                {
-                 bp_err = e.error;
-                 bp_err_message = e.message;
+                 bp_excpt = e;
                }
              END_CATCH
            }
                }
              END_CATCH
            }
@@ -2838,7 +2626,7 @@ insert_bp_location (struct bp_location *bl,
            }
        }
 
            }
        }
 
-      if (bp_err != GDB_NO_ERROR)
+      if (bp_excpt.reason != 0)
        {
          /* Can't set the breakpoint.  */
 
        {
          /* Can't set the breakpoint.  */
 
@@ -2850,7 +2638,9 @@ insert_bp_location (struct bp_location *bl,
             breakpoint insertion failed (e.g., the remote target
             doesn't define error codes), so we must treat generic
             errors as memory errors.  */
             breakpoint insertion failed (e.g., the remote target
             doesn't define error codes), so we must treat generic
             errors as memory errors.  */
-         if ((bp_err == GENERIC_ERROR || bp_err == MEMORY_ERROR)
+         if (bp_excpt.reason == RETURN_ERROR
+             && (bp_excpt.error == GENERIC_ERROR
+                 || bp_excpt.error == MEMORY_ERROR)
              && bl->loc_type == bp_loc_software_breakpoint
              && (solib_name_from_address (bl->pspace, bl->address)
                  || shared_objfile_contains_address_p (bl->pspace,
              && bl->loc_type == bp_loc_software_breakpoint
              && (solib_name_from_address (bl->pspace, bl->address)
                  || shared_objfile_contains_address_p (bl->pspace,
@@ -2858,7 +2648,7 @@ insert_bp_location (struct bp_location *bl,
            {
              /* See also: disable_breakpoints_in_shlibs.  */
              bl->shlib_disabled = 1;
            {
              /* See also: disable_breakpoints_in_shlibs.  */
              bl->shlib_disabled = 1;
-             observer_notify_breakpoint_modified (bl->owner);
+             gdb::observers::breakpoint_modified.notify (bl->owner);
              if (!*disabled_breaks)
                {
                  fprintf_unfiltered (tmp_error_stream, 
              if (!*disabled_breaks)
                {
                  fprintf_unfiltered (tmp_error_stream, 
@@ -2878,34 +2668,34 @@ insert_bp_location (struct bp_location *bl,
              if (bl->loc_type == bp_loc_hardware_breakpoint)
                {
                  *hw_breakpoint_error = 1;
              if (bl->loc_type == bp_loc_hardware_breakpoint)
                {
                  *hw_breakpoint_error = 1;
-                 *hw_bp_error_explained_already = bp_err_message != NULL;
+                 *hw_bp_error_explained_already = bp_excpt.message != NULL;
                   fprintf_unfiltered (tmp_error_stream,
                                       "Cannot insert hardware breakpoint %d%s",
                   fprintf_unfiltered (tmp_error_stream,
                                       "Cannot insert hardware breakpoint %d%s",
-                                      bl->owner->number, bp_err_message ? ":" : ".\n");
-                  if (bp_err_message != NULL)
-                    fprintf_unfiltered (tmp_error_stream, "%s.\n", bp_err_message);
+                                      bl->owner->number,
+                                     bp_excpt.message ? ":" : ".\n");
+                  if (bp_excpt.message != NULL)
+                    fprintf_unfiltered (tmp_error_stream, "%s.\n",
+                                       bp_excpt.message);
                }
              else
                {
                }
              else
                {
-                 if (bp_err_message == NULL)
+                 if (bp_excpt.message == NULL)
                    {
                    {
-                     char *message
+                     std::string message
                        = memory_error_message (TARGET_XFER_E_IO,
                                                bl->gdbarch, bl->address);
                        = memory_error_message (TARGET_XFER_E_IO,
                                                bl->gdbarch, bl->address);
-                     struct cleanup *old_chain = make_cleanup (xfree, message);
 
                      fprintf_unfiltered (tmp_error_stream,
                                          "Cannot insert breakpoint %d.\n"
                                          "%s\n",
 
                      fprintf_unfiltered (tmp_error_stream,
                                          "Cannot insert breakpoint %d.\n"
                                          "%s\n",
-                                         bl->owner->number, message);
-                     do_cleanups (old_chain);
+                                         bl->owner->number, message.c_str ());
                    }
                  else
                    {
                      fprintf_unfiltered (tmp_error_stream,
                                          "Cannot insert breakpoint %d: %s\n",
                                          bl->owner->number,
                    }
                  else
                    {
                      fprintf_unfiltered (tmp_error_stream,
                                          "Cannot insert breakpoint %d: %s\n",
                                          bl->owner->number,
-                                         bp_err_message);
+                                         bp_excpt.message);
                    }
                }
              return 1;
                    }
                }
              return 1;
@@ -3108,7 +2898,7 @@ update_inserted_breakpoint_locations (void)
       /* We only want to update locations that are already inserted
         and need updating.  This is to avoid unwanted insertion during
         deletion of breakpoints.  */
       /* We only want to update locations that are already inserted
         and need updating.  This is to avoid unwanted insertion during
         deletion of breakpoints.  */
-      if (!bl->inserted || (bl->inserted && !bl->needs_update))
+      if (!bl->inserted || !bl->needs_update)
        continue;
 
       switch_to_program_space_and_thread (bl->pspace);
        continue;
 
       switch_to_program_space_and_thread (bl->pspace);
@@ -3118,7 +2908,7 @@ update_inserted_breakpoint_locations (void)
         if we aren't attached to any process yet, we should still
         insert breakpoints.  */
       if (!gdbarch_has_global_breakpoints (target_gdbarch ())
         if we aren't attached to any process yet, we should still
         insert breakpoints.  */
       if (!gdbarch_has_global_breakpoints (target_gdbarch ())
-         && ptid_equal (inferior_ptid, null_ptid))
+         && inferior_ptid == null_ptid)
        continue;
 
       val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
        continue;
 
       val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
@@ -3129,7 +2919,7 @@ update_inserted_breakpoint_locations (void)
 
   if (error_flag)
     {
 
   if (error_flag)
     {
-      target_terminal_ours_for_output ();
+      target_terminal::ours_for_output ();
       error_stream (tmp_error_stream);
     }
 }
       error_stream (tmp_error_stream);
     }
 }
@@ -3174,7 +2964,7 @@ insert_breakpoint_locations (void)
         if we aren't attached to any process yet, we should still
         insert breakpoints.  */
       if (!gdbarch_has_global_breakpoints (target_gdbarch ())
         if we aren't attached to any process yet, we should still
         insert breakpoints.  */
       if (!gdbarch_has_global_breakpoints (target_gdbarch ())
-         && ptid_equal (inferior_ptid, null_ptid))
+         && inferior_ptid == null_ptid)
        continue;
 
       val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
        continue;
 
       val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
@@ -3228,7 +3018,7 @@ insert_breakpoint_locations (void)
          tmp_error_stream.printf ("Could not insert hardware breakpoints:\n\
 You may have requested too many hardware breakpoints/watchpoints.\n");
        }
          tmp_error_stream.printf ("Could not insert hardware breakpoints:\n\
 You may have requested too many hardware breakpoints/watchpoints.\n");
        }
-      target_terminal_ours_for_output ();
+      target_terminal::ours_for_output ();
       error_stream (tmp_error_stream);
     }
 }
       error_stream (tmp_error_stream);
     }
 }
@@ -3275,14 +3065,13 @@ Thread-specific breakpoint %d deleted - thread %s no longer in the thread list.\
     }
 }
 
     }
 }
 
-/* Remove breakpoints of process PID.  */
+/* Remove breakpoints of inferior INF.  */
 
 int
 
 int
-remove_breakpoints_pid (int pid)
+remove_breakpoints_inf (inferior *inf)
 {
   struct bp_location *bl, **blp_tmp;
   int val;
 {
   struct bp_location *bl, **blp_tmp;
   int val;
-  struct inferior *inf = find_inferior_pid (pid);
 
   ALL_BP_LOCATIONS (bl, blp_tmp)
   {
 
   ALL_BP_LOCATIONS (bl, blp_tmp)
   {
@@ -3299,47 +3088,6 @@ remove_breakpoints_pid (int pid)
   return 0;
 }
 
   return 0;
 }
 
-int
-reattach_breakpoints (int pid)
-{
-  struct cleanup *old_chain;
-  struct bp_location *bl, **blp_tmp;
-  int val;
-  int dummy1 = 0, dummy2 = 0, dummy3 = 0;
-  struct inferior *inf;
-  struct thread_info *tp;
-
-  tp = any_live_thread_of_process (pid);
-  if (tp == NULL)
-    return 1;
-
-  inf = find_inferior_pid (pid);
-  old_chain = save_inferior_ptid ();
-
-  inferior_ptid = tp->ptid;
-
-  string_file tmp_error_stream;
-
-  ALL_BP_LOCATIONS (bl, blp_tmp)
-  {
-    if (bl->pspace != inf->pspace)
-      continue;
-
-    if (bl->inserted)
-      {
-       bl->inserted = 0;
-       val = insert_bp_location (bl, &tmp_error_stream, &dummy1, &dummy2, &dummy3);
-       if (val != 0)
-         {
-           do_cleanups (old_chain);
-           return val;
-         }
-      }
-  }
-  do_cleanups (old_chain);
-  return 0;
-}
-
 static int internal_breakpoint_number = -1;
 
 /* Set the breakpoint number of B, depending on the value of INTERNAL.
 static int internal_breakpoint_number = -1;
 
 /* Set the breakpoint number of B, depending on the value of INTERNAL.
@@ -3365,16 +3113,12 @@ create_internal_breakpoint (struct gdbarch *gdbarch,
                            CORE_ADDR address, enum bptype type,
                            const struct breakpoint_ops *ops)
 {
                            CORE_ADDR address, enum bptype type,
                            const struct breakpoint_ops *ops)
 {
-  struct symtab_and_line sal;
-  struct breakpoint *b;
-
-  init_sal (&sal);             /* Initialize to zeroes.  */
-
+  symtab_and_line sal;
   sal.pc = address;
   sal.section = find_pc_overlay (sal.pc);
   sal.pspace = current_program_space;
 
   sal.pc = address;
   sal.section = find_pc_overlay (sal.pc);
   sal.pspace = current_program_space;
 
-  b = set_raw_breakpoint (gdbarch, sal, type, ops);
+  breakpoint *b = set_raw_breakpoint (gdbarch, sal, type, ops);
   b->number = internal_breakpoint_number--;
   b->disposition = disp_donttouch;
 
   b->number = internal_breakpoint_number--;
   b->disposition = disp_donttouch;
 
@@ -3391,28 +3135,30 @@ static const char *const longjmp_names[] =
 struct breakpoint_objfile_data
 {
   /* Minimal symbol for "_ovly_debug_event" (if any).  */
 struct breakpoint_objfile_data
 {
   /* Minimal symbol for "_ovly_debug_event" (if any).  */
-  struct bound_minimal_symbol overlay_msym;
+  struct bound_minimal_symbol overlay_msym {};
 
   /* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any).  */
 
   /* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any).  */
-  struct bound_minimal_symbol longjmp_msym[NUM_LONGJMP_NAMES];
+  struct bound_minimal_symbol longjmp_msym[NUM_LONGJMP_NAMES] {};
 
   /* True if we have looked for longjmp probes.  */
 
   /* True if we have looked for longjmp probes.  */
-  int longjmp_searched;
+  int longjmp_searched = 0;
 
 
-  /* SystemTap probe points for longjmp (if any).  */
-  VEC (probe_p) *longjmp_probes;
+  /* SystemTap probe points for longjmp (if any).  These are non-owning
+     references.  */
+  std::vector<probe *> longjmp_probes;
 
   /* Minimal symbol for "std::terminate()" (if any).  */
 
   /* Minimal symbol for "std::terminate()" (if any).  */
-  struct bound_minimal_symbol terminate_msym;
+  struct bound_minimal_symbol terminate_msym {};
 
   /* Minimal symbol for "_Unwind_DebugHook" (if any).  */
 
   /* Minimal symbol for "_Unwind_DebugHook" (if any).  */
-  struct bound_minimal_symbol exception_msym;
+  struct bound_minimal_symbol exception_msym {};
 
   /* True if we have looked for exception probes.  */
 
   /* True if we have looked for exception probes.  */
-  int exception_searched;
+  int exception_searched = 0;
 
 
-  /* SystemTap probe points for unwinding (if any).  */
-  VEC (probe_p) *exception_probes;
+  /* SystemTap probe points for unwinding (if any).  These are non-owning
+     references.  */
+  std::vector<probe *> exception_probes;
 };
 
 static const struct objfile_data *breakpoint_objfile_key;
 };
 
 static const struct objfile_data *breakpoint_objfile_key;
@@ -3440,23 +3186,19 @@ get_breakpoint_objfile_data (struct objfile *objfile)
                     objfile_data (objfile, breakpoint_objfile_key));
   if (bp_objfile_data == NULL)
     {
                     objfile_data (objfile, breakpoint_objfile_key));
   if (bp_objfile_data == NULL)
     {
-      bp_objfile_data =
-       XOBNEW (&objfile->objfile_obstack, struct breakpoint_objfile_data);
-
-      memset (bp_objfile_data, 0, sizeof (*bp_objfile_data));
+      bp_objfile_data = new breakpoint_objfile_data ();
       set_objfile_data (objfile, breakpoint_objfile_key, bp_objfile_data);
     }
   return bp_objfile_data;
 }
 
 static void
       set_objfile_data (objfile, breakpoint_objfile_key, bp_objfile_data);
     }
   return bp_objfile_data;
 }
 
 static void
-free_breakpoint_probes (struct objfile *obj, void *data)
+free_breakpoint_objfile_data (struct objfile *obj, void *data)
 {
   struct breakpoint_objfile_data *bp_objfile_data
     = (struct breakpoint_objfile_data *) data;
 
 {
   struct breakpoint_objfile_data *bp_objfile_data
     = (struct breakpoint_objfile_data *) data;
 
-  VEC_free (probe_p, bp_objfile_data->longjmp_probes);
-  VEC_free (probe_p, bp_objfile_data->exception_probes);
+  delete bp_objfile_data;
 }
 
 static void
 }
 
 static void
@@ -3537,43 +3279,33 @@ create_longjmp_master_breakpoint (void)
 
       if (!bp_objfile_data->longjmp_searched)
        {
 
       if (!bp_objfile_data->longjmp_searched)
        {
-         VEC (probe_p) *ret;
+         std::vector<probe *> ret
+           = find_probes_in_objfile (objfile, "libc", "longjmp");
 
 
-         ret = find_probes_in_objfile (objfile, "libc", "longjmp");
-         if (ret != NULL)
+         if (!ret.empty ())
            {
              /* We are only interested in checking one element.  */
            {
              /* We are only interested in checking one element.  */
-             struct probe *p = VEC_index (probe_p, ret, 0);
+             probe *p = ret[0];
 
 
-             if (!can_evaluate_probe_arguments (p))
+             if (!p->can_evaluate_arguments ())
                {
                  /* We cannot use the probe interface here, because it does
                     not know how to evaluate arguments.  */
                {
                  /* We cannot use the probe interface here, because it does
                     not know how to evaluate arguments.  */
-                 VEC_free (probe_p, ret);
-                 ret = NULL;
+                 ret.clear ();
                }
            }
          bp_objfile_data->longjmp_probes = ret;
          bp_objfile_data->longjmp_searched = 1;
        }
 
                }
            }
          bp_objfile_data->longjmp_probes = ret;
          bp_objfile_data->longjmp_searched = 1;
        }
 
-      if (bp_objfile_data->longjmp_probes != NULL)
+      if (!bp_objfile_data->longjmp_probes.empty ())
        {
        {
-         int i;
-         struct probe *probe;
-         struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
-         for (i = 0;
-              VEC_iterate (probe_p,
-                           bp_objfile_data->longjmp_probes,
-                           i, probe);
-              ++i)
+         for (probe *p : bp_objfile_data->longjmp_probes)
            {
              struct breakpoint *b;
 
              b = create_internal_breakpoint (gdbarch,
            {
              struct breakpoint *b;
 
              b = create_internal_breakpoint (gdbarch,
-                                             get_probe_address (probe,
-                                                                objfile),
+                                             p->get_relocated_address (objfile),
                                              bp_longjmp_master,
                                              &internal_breakpoint_ops);
              b->location = new_probe_location ("-probe-stap libc:longjmp");
                                              bp_longjmp_master,
                                              &internal_breakpoint_ops);
              b->location = new_probe_location ("-probe-stap libc:longjmp");
@@ -3698,44 +3430,33 @@ create_exception_master_breakpoint (void)
       /* We prefer the SystemTap probe point if it exists.  */
       if (!bp_objfile_data->exception_searched)
        {
       /* We prefer the SystemTap probe point if it exists.  */
       if (!bp_objfile_data->exception_searched)
        {
-         VEC (probe_p) *ret;
-
-         ret = find_probes_in_objfile (objfile, "libgcc", "unwind");
+         std::vector<probe *> ret
+           = find_probes_in_objfile (objfile, "libgcc", "unwind");
 
 
-         if (ret != NULL)
+         if (!ret.empty ())
            {
              /* We are only interested in checking one element.  */
            {
              /* We are only interested in checking one element.  */
-             struct probe *p = VEC_index (probe_p, ret, 0);
+             probe *p = ret[0];
 
 
-             if (!can_evaluate_probe_arguments (p))
+             if (!p->can_evaluate_arguments ())
                {
                  /* We cannot use the probe interface here, because it does
                     not know how to evaluate arguments.  */
                {
                  /* We cannot use the probe interface here, because it does
                     not know how to evaluate arguments.  */
-                 VEC_free (probe_p, ret);
-                 ret = NULL;
+                 ret.clear ();
                }
            }
          bp_objfile_data->exception_probes = ret;
          bp_objfile_data->exception_searched = 1;
        }
 
                }
            }
          bp_objfile_data->exception_probes = ret;
          bp_objfile_data->exception_searched = 1;
        }
 
-      if (bp_objfile_data->exception_probes != NULL)
+      if (!bp_objfile_data->exception_probes.empty ())
        {
        {
-         struct gdbarch *gdbarch = get_objfile_arch (objfile);
-         int i;
-         struct probe *probe;
-
-         for (i = 0;
-              VEC_iterate (probe_p,
-                           bp_objfile_data->exception_probes,
-                           i, probe);
-              ++i)
-           {
-             struct breakpoint *b;
+         gdbarch = get_objfile_arch (objfile);
 
 
+         for (probe *p : bp_objfile_data->exception_probes)
+           {
              b = create_internal_breakpoint (gdbarch,
              b = create_internal_breakpoint (gdbarch,
-                                             get_probe_address (probe,
-                                                                objfile),
+                                             p->get_relocated_address (objfile),
                                              bp_exception_master,
                                              &internal_breakpoint_ops);
              b->location = new_probe_location ("-probe-stap libgcc:unwind");
                                              bp_exception_master,
                                              &internal_breakpoint_ops);
              b->location = new_probe_location ("-probe-stap libgcc:unwind");
@@ -3768,7 +3489,7 @@ create_exception_master_breakpoint (void)
 
       addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
       addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
 
       addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
       addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
-                                                &current_target);
+                                                current_top_target ());
       b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
                                      &internal_breakpoint_ops);
       initialize_explicit_location (&explicit_loc);
       b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
                                      &internal_breakpoint_ops);
       initialize_explicit_location (&explicit_loc);
@@ -3913,10 +3634,10 @@ detach_breakpoints (ptid_t ptid)
 {
   struct bp_location *bl, **blp_tmp;
   int val = 0;
 {
   struct bp_location *bl, **blp_tmp;
   int val = 0;
-  struct cleanup *old_chain = save_inferior_ptid ();
+  scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
   struct inferior *inf = current_inferior ();
 
   struct inferior *inf = current_inferior ();
 
-  if (ptid_get_pid (ptid) == ptid_get_pid (inferior_ptid))
+  if (ptid.pid () == inferior_ptid.pid ())
     error (_("Cannot detach breakpoints of inferior_ptid"));
 
   /* Set inferior_ptid; remove_breakpoint_1 uses this global.  */
     error (_("Cannot detach breakpoints of inferior_ptid"));
 
   /* Set inferior_ptid; remove_breakpoint_1 uses this global.  */
@@ -3939,7 +3660,6 @@ detach_breakpoints (ptid_t ptid)
       val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT);
   }
 
       val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT);
   }
 
-  do_cleanups (old_chain);
   return val;
 }
 
   return val;
 }
 
@@ -4140,8 +3860,6 @@ void
 breakpoint_init_inferior (enum inf_context context)
 {
   struct breakpoint *b, *b_tmp;
 breakpoint_init_inferior (enum inf_context context)
 {
   struct breakpoint *b, *b_tmp;
-  struct bp_location *bl;
-  int ix;
   struct program_space *pspace = current_program_space;
 
   /* If breakpoint locations are shared across processes, then there's
   struct program_space *pspace = current_program_space;
 
   /* If breakpoint locations are shared across processes, then there's
@@ -4219,9 +3937,7 @@ breakpoint_init_inferior (enum inf_context context)
                {
                  /* Reset val field to force reread of starting value in
                     insert_breakpoints.  */
                {
                  /* Reset val field to force reread of starting value in
                     insert_breakpoints.  */
-                 if (w->val)
-                   value_free (w->val);
-                 w->val = NULL;
+                 w->val.reset (nullptr);
                  w->val_valid = 0;
                }
            }
                  w->val_valid = 0;
                }
            }
@@ -4233,9 +3949,9 @@ breakpoint_init_inferior (enum inf_context context)
   }
 
   /* Get rid of the moribund locations.  */
   }
 
   /* Get rid of the moribund locations.  */
-  for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, bl); ++ix)
+  for (bp_location *bl : moribund_locations)
     decref_bp_location (&bl);
     decref_bp_location (&bl);
-  VEC_free (bp_location_p, moribund_locations);
+  moribund_locations.clear ();
 }
 
 /* These functions concern about actual breakpoints inserted in the
 }
 
 /* These functions concern about actual breakpoints inserted in the
@@ -4254,7 +3970,7 @@ breakpoint_init_inferior (enum inf_context context)
      the target, to advance the PC past the breakpoint.  */
 
 enum breakpoint_here
      the target, to advance the PC past the breakpoint.  */
 
 enum breakpoint_here
-breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc)
+breakpoint_here_p (const address_space *aspace, CORE_ADDR pc)
 {
   struct bp_location *bl, **blp_tmp;
   int any_breakpoint_here = 0;
 {
   struct bp_location *bl, **blp_tmp;
   int any_breakpoint_here = 0;
@@ -4287,7 +4003,7 @@ breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc)
 /* See breakpoint.h.  */
 
 int
 /* See breakpoint.h.  */
 
 int
-breakpoint_in_range_p (struct address_space *aspace,
+breakpoint_in_range_p (const address_space *aspace,
                       CORE_ADDR addr, ULONGEST len)
 {
   struct bp_location *bl, **blp_tmp;
                       CORE_ADDR addr, ULONGEST len)
 {
   struct bp_location *bl, **blp_tmp;
@@ -4321,12 +4037,9 @@ breakpoint_in_range_p (struct address_space *aspace,
 /* Return true if there's a moribund breakpoint at PC.  */
 
 int
 /* Return true if there's a moribund breakpoint at PC.  */
 
 int
-moribund_breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc)
+moribund_breakpoint_here_p (const address_space *aspace, CORE_ADDR pc)
 {
 {
-  struct bp_location *loc;
-  int ix;
-
-  for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+  for (bp_location *loc : moribund_locations)
     if (breakpoint_location_address_match (loc, aspace, pc))
       return 1;
 
     if (breakpoint_location_address_match (loc, aspace, pc))
       return 1;
 
@@ -4338,7 +4051,7 @@ moribund_breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc)
 
 static int
 bp_location_inserted_here_p (struct bp_location *bl,
 
 static int
 bp_location_inserted_here_p (struct bp_location *bl,
-                            struct address_space *aspace, CORE_ADDR pc)
+                            const address_space *aspace, CORE_ADDR pc)
 {
   if (bl->inserted
       && breakpoint_address_match (bl->pspace->aspace, bl->address,
 {
   if (bl->inserted
       && breakpoint_address_match (bl->pspace->aspace, bl->address,
@@ -4357,7 +4070,7 @@ bp_location_inserted_here_p (struct bp_location *bl,
 /* Returns non-zero iff there's a breakpoint inserted at PC.  */
 
 int
 /* Returns non-zero iff there's a breakpoint inserted at PC.  */
 
 int
-breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc)
+breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc)
 {
   struct bp_location **blp, **blp_tmp = NULL;
 
 {
   struct bp_location **blp, **blp_tmp = NULL;
 
@@ -4379,7 +4092,7 @@ breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc)
    inserted at PC.  */
 
 int
    inserted at PC.  */
 
 int
-software_breakpoint_inserted_here_p (struct address_space *aspace,
+software_breakpoint_inserted_here_p (const address_space *aspace,
                                     CORE_ADDR pc)
 {
   struct bp_location **blp, **blp_tmp = NULL;
                                     CORE_ADDR pc)
 {
   struct bp_location **blp, **blp_tmp = NULL;
@@ -4401,7 +4114,7 @@ software_breakpoint_inserted_here_p (struct address_space *aspace,
 /* See breakpoint.h.  */
 
 int
 /* See breakpoint.h.  */
 
 int
-hardware_breakpoint_inserted_here_p (struct address_space *aspace,
+hardware_breakpoint_inserted_here_p (const address_space *aspace,
                                     CORE_ADDR pc)
 {
   struct bp_location **blp, **blp_tmp = NULL;
                                     CORE_ADDR pc)
 {
   struct bp_location **blp, **blp_tmp = NULL;
@@ -4421,7 +4134,7 @@ hardware_breakpoint_inserted_here_p (struct address_space *aspace,
 }
 
 int
 }
 
 int
-hardware_watchpoint_inserted_in_range (struct address_space *aspace,
+hardware_watchpoint_inserted_in_range (const address_space *aspace,
                                       CORE_ADDR addr, ULONGEST len)
 {
   struct breakpoint *bpt;
                                       CORE_ADDR addr, ULONGEST len)
 {
   struct breakpoint *bpt;
@@ -4465,14 +4178,10 @@ is_catchpoint (struct breakpoint *ep)
 /* Frees any storage that is part of a bpstat.  Does not walk the
    'next' chain.  */
 
 /* Frees any storage that is part of a bpstat.  Does not walk the
    'next' chain.  */
 
-static void
-bpstat_free (bpstat bs)
+bpstats::~bpstats ()
 {
 {
-  if (bs->old_val != NULL)
-    value_free (bs->old_val);
-  decref_counted_command_line (&bs->commands);
-  decref_bp_location (&bs->bp_location_at);
-  xfree (bs);
+  if (bp_location_at != NULL)
+    decref_bp_location (&bp_location_at);
 }
 
 /* Clear a bpstat so that it says we are not at any breakpoint.
 }
 
 /* Clear a bpstat so that it says we are not at any breakpoint.
@@ -4490,12 +4199,26 @@ bpstat_clear (bpstat *bsp)
   while (p != NULL)
     {
       q = p->next;
   while (p != NULL)
     {
       q = p->next;
-      bpstat_free (p);
+      delete p;
       p = q;
     }
   *bsp = NULL;
 }
 
       p = q;
     }
   *bsp = NULL;
 }
 
+bpstats::bpstats (const bpstats &other)
+  : next (NULL),
+    bp_location_at (other.bp_location_at),
+    breakpoint_at (other.breakpoint_at),
+    commands (other.commands),
+    print (other.print),
+    stop (other.stop),
+    print_it (other.print_it)
+{
+  if (other.old_val != NULL)
+    old_val = release_value (value_copy (other.old_val.get ()));
+  incref_bp_location (bp_location_at);
+}
+
 /* Return a copy of a bpstat.  Like "bs1 = bs2" but all storage that
    is part of the bpstat is copied as well.  */
 
 /* Return a copy of a bpstat.  Like "bs1 = bs2" but all storage that
    is part of the bpstat is copied as well.  */
 
@@ -4511,15 +4234,7 @@ bpstat_copy (bpstat bs)
 
   for (; bs != NULL; bs = bs->next)
     {
 
   for (; bs != NULL; bs = bs->next)
     {
-      tmp = (bpstat) xmalloc (sizeof (*tmp));
-      memcpy (tmp, bs, sizeof (*tmp));
-      incref_counted_command_line (tmp->commands);
-      incref_bp_location (tmp->bp_location_at);
-      if (bs->old_val != NULL)
-       {
-         tmp->old_val = value_copy (bs->old_val);
-         release_value (tmp->old_val);
-       }
+      tmp = new bpstats (*bs);
 
       if (p == NULL)
        /* This is the first thing in the chain.  */
 
       if (p == NULL)
        /* This is the first thing in the chain.  */
@@ -4608,25 +4323,16 @@ bpstat_num (bpstat *bsp, int *num)
 void
 bpstat_clear_actions (void)
 {
 void
 bpstat_clear_actions (void)
 {
-  struct thread_info *tp;
   bpstat bs;
 
   bpstat bs;
 
-  if (ptid_equal (inferior_ptid, null_ptid))
-    return;
-
-  tp = find_thread_ptid (inferior_ptid);
-  if (tp == NULL)
+  if (inferior_ptid == null_ptid)
     return;
 
     return;
 
+  thread_info *tp = inferior_thread ();
   for (bs = tp->control.stop_bpstat; bs != NULL; bs = bs->next)
     {
   for (bs = tp->control.stop_bpstat; bs != NULL; bs = bs->next)
     {
-      decref_counted_command_line (&bs->commands);
-
-      if (bs->old_val != NULL)
-       {
-         value_free (bs->old_val);
-         bs->old_val = NULL;
-       }
+      bs->commands = NULL;
+      bs->old_val.reset (nullptr);
     }
 }
 
     }
 }
 
@@ -4635,7 +4341,7 @@ bpstat_clear_actions (void)
 static void
 breakpoint_about_to_proceed (void)
 {
 static void
 breakpoint_about_to_proceed (void)
 {
-  if (!ptid_equal (inferior_ptid, null_ptid))
+  if (inferior_ptid != null_ptid)
     {
       struct thread_info *tp = inferior_thread ();
 
     {
       struct thread_info *tp = inferior_thread ();
 
@@ -4650,14 +4356,6 @@ breakpoint_about_to_proceed (void)
   breakpoint_proceeded = 1;
 }
 
   breakpoint_proceeded = 1;
 }
 
-/* Stub for cleaning up our state if we error-out of a breakpoint
-   command.  */
-static void
-cleanup_executing_breakpoints (void *ignore)
-{
-  executing_breakpoint_commands = 0;
-}
-
 /* Return non-zero iff CMD as the first line of a command sequence is `silent'
    or its equivalent.  */
 
 /* Return non-zero iff CMD as the first line of a command sequence is `silent'
    or its equivalent.  */
 
@@ -4680,7 +4378,6 @@ static int
 bpstat_do_actions_1 (bpstat *bsp)
 {
   bpstat bs;
 bpstat_do_actions_1 (bpstat *bsp)
 {
   bpstat bs;
-  struct cleanup *old_chain;
   int again = 0;
 
   /* Avoid endless recursion if a `source' command is contained
   int again = 0;
 
   /* Avoid endless recursion if a `source' command is contained
@@ -4688,8 +4385,8 @@ bpstat_do_actions_1 (bpstat *bsp)
   if (executing_breakpoint_commands)
     return 0;
 
   if (executing_breakpoint_commands)
     return 0;
 
-  executing_breakpoint_commands = 1;
-  old_chain = make_cleanup (cleanup_executing_breakpoints, 0);
+  scoped_restore save_executing
+    = make_scoped_restore (&executing_breakpoint_commands, 1);
 
   scoped_restore preventer = prevent_dont_repeat ();
 
 
   scoped_restore preventer = prevent_dont_repeat ();
 
@@ -4699,9 +4396,7 @@ bpstat_do_actions_1 (bpstat *bsp)
   breakpoint_proceeded = 0;
   for (; bs != NULL; bs = bs->next)
     {
   breakpoint_proceeded = 0;
   for (; bs != NULL; bs = bs->next)
     {
-      struct counted_command_line *ccmd;
-      struct command_line *cmd;
-      struct cleanup *this_cmd_tree_chain;
+      struct command_line *cmd = NULL;
 
       /* Take ownership of the BSP's command tree, if it has one.
 
 
       /* Take ownership of the BSP's command tree, if it has one.
 
@@ -4713,10 +4408,10 @@ bpstat_do_actions_1 (bpstat *bsp)
          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.  */
          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.  */
-      ccmd = bs->commands;
+      counted_command_line ccmd = bs->commands;
       bs->commands = NULL;
       bs->commands = NULL;
-      this_cmd_tree_chain = make_cleanup_decref_counted_command_line (&ccmd);
-      cmd = ccmd ? ccmd->commands : NULL;
+      if (ccmd != NULL)
+       cmd = ccmd.get ();
       if (command_line_is_silent (cmd))
        {
          /* The action has been already done by bpstat_stop_status.  */
       if (command_line_is_silent (cmd))
        {
          /* The action has been already done by bpstat_stop_status.  */
@@ -4733,9 +4428,6 @@ bpstat_do_actions_1 (bpstat *bsp)
            cmd = cmd->next;
        }
 
            cmd = cmd->next;
        }
 
-      /* We can free this command tree now.  */
-      do_cleanups (this_cmd_tree_chain);
-
       if (breakpoint_proceeded)
        {
          if (current_ui->async)
       if (breakpoint_proceeded)
        {
          if (current_ui->async)
@@ -4761,26 +4453,40 @@ bpstat_do_actions_1 (bpstat *bsp)
          break;
        }
     }
          break;
        }
     }
-  do_cleanups (old_chain);
   return again;
 }
 
   return again;
 }
 
+/* Helper for bpstat_do_actions.  Get the current thread, if there's
+   one, is alive and has execution.  Return NULL otherwise.  */
+
+static thread_info *
+get_bpstat_thread ()
+{
+  if (inferior_ptid == null_ptid || !target_has_execution)
+    return NULL;
+
+  thread_info *tp = inferior_thread ();
+  if (tp->state == THREAD_EXITED || tp->executing)
+    return NULL;
+  return tp;
+}
+
 void
 bpstat_do_actions (void)
 {
   struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup ();
 void
 bpstat_do_actions (void)
 {
   struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup ();
+  thread_info *tp;
 
   /* Do any commands attached to breakpoint we are stopped at.  */
 
   /* Do any commands attached to breakpoint we are stopped at.  */
-  while (!ptid_equal (inferior_ptid, null_ptid)
-        && target_has_execution
-        && !is_exited (inferior_ptid)
-        && !is_executing (inferior_ptid))
-    /* Since in sync mode, bpstat_do_actions may resume the inferior,
-       and only return when it is stopped at the next breakpoint, we
-       keep doing breakpoint actions until it returns false to
-       indicate the inferior was not resumed.  */
-    if (!bpstat_do_actions_1 (&inferior_thread ()->control.stop_bpstat))
-      break;
+  while ((tp = get_bpstat_thread ()) != NULL)
+    {
+      /* Since in sync mode, bpstat_do_actions may resume the
+        inferior, and only return when it is stopped at the next
+        breakpoint, we keep doing breakpoint actions until it returns
+        false to indicate the inferior was not resumed.  */
+      if (!bpstat_do_actions_1 (&tp->control.stop_bpstat))
+       break;
+    }
 
   discard_cleanups (cleanup_if_error);
 }
 
   discard_cleanups (cleanup_if_error);
 }
@@ -4879,10 +4585,8 @@ print_bp_stop_message (bpstat bs)
 static void
 print_solib_event (int is_catchpoint)
 {
 static void
 print_solib_event (int is_catchpoint)
 {
-  int any_deleted
-    = !VEC_empty (char_ptr, current_program_space->deleted_solibs);
-  int any_added
-    = !VEC_empty (so_list_ptr, current_program_space->added_solibs);
+  bool any_deleted = !current_program_space->deleted_solibs.empty ();
+  bool any_added = !current_program_space->added_solibs.empty ();
 
   if (!is_catchpoint)
     {
 
   if (!is_catchpoint)
     {
@@ -4899,16 +4603,12 @@ print_solib_event (int is_catchpoint)
 
   if (any_deleted)
     {
 
   if (any_deleted)
     {
-      char *name;
-      int ix;
-
       current_uiout->text (_("  Inferior unloaded "));
       ui_out_emit_list list_emitter (current_uiout, "removed");
       current_uiout->text (_("  Inferior unloaded "));
       ui_out_emit_list list_emitter (current_uiout, "removed");
-      for (ix = 0;
-          VEC_iterate (char_ptr, current_program_space->deleted_solibs,
-                       ix, name);
-          ++ix)
+      for (int ix = 0; ix < current_program_space->deleted_solibs.size (); ix++)
        {
        {
+         const std::string &name = current_program_space->deleted_solibs[ix];
+
          if (ix > 0)
            current_uiout->text ("    ");
          current_uiout->field_string ("library", name);
          if (ix > 0)
            current_uiout->text ("    ");
          current_uiout->field_string ("library", name);
@@ -4918,18 +4618,14 @@ print_solib_event (int is_catchpoint)
 
   if (any_added)
     {
 
   if (any_added)
     {
-      struct so_list *iter;
-      int ix;
-
       current_uiout->text (_("  Inferior loaded "));
       ui_out_emit_list list_emitter (current_uiout, "added");
       current_uiout->text (_("  Inferior loaded "));
       ui_out_emit_list list_emitter (current_uiout, "added");
-      for (ix = 0;
-          VEC_iterate (so_list_ptr, current_program_space->added_solibs,
-                       ix, iter);
-          ++ix)
+      bool first = true;
+      for (so_list *iter : current_program_space->added_solibs)
        {
        {
-         if (ix > 0)
+         if (!first)
            current_uiout->text ("    ");
            current_uiout->text ("    ");
+         first = false;
          current_uiout->field_string ("library", iter->so_name);
          current_uiout->text ("\n");
        }
          current_uiout->field_string ("library", iter->so_name);
          current_uiout->text ("\n");
        }
@@ -4989,42 +4685,43 @@ bpstat_print (bpstat bs, int kind)
   return PRINT_UNKNOWN;
 }
 
   return PRINT_UNKNOWN;
 }
 
-/* Evaluate the expression EXP and return 1 if value is zero.
-   This returns the inverse of the condition because it is called
-   from catch_errors which returns 0 if an exception happened, and if an
-   exception happens we want execution to stop.
-   The argument is a "struct expression *" that has been cast to a
-   "void *" to make it pass through catch_errors.  */
+/* Evaluate the boolean expression EXP and return the result.  */
 
 
-static int
-breakpoint_cond_eval (void *exp)
+static bool
+breakpoint_cond_eval (expression *exp)
 {
   struct value *mark = value_mark ();
 {
   struct value *mark = value_mark ();
-  int i = !value_true (evaluate_expression ((struct expression *) exp));
+  bool res = value_true (evaluate_expression (exp));
 
   value_free_to_mark (mark);
 
   value_free_to_mark (mark);
-  return i;
+  return res;
 }
 
 /* Allocate a new bpstat.  Link it to the FIFO list by BS_LINK_POINTER.  */
 
 }
 
 /* Allocate a new bpstat.  Link it to the FIFO list by BS_LINK_POINTER.  */
 
-static bpstat
-bpstat_alloc (struct bp_location *bl, bpstat **bs_link_pointer)
+bpstats::bpstats (struct bp_location *bl, bpstat **bs_link_pointer)
+  : next (NULL),
+    bp_location_at (bl),
+    breakpoint_at (bl->owner),
+    commands (NULL),
+    print (0),
+    stop (0),
+    print_it (print_it_normal)
 {
 {
-  bpstat bs;
-
-  bs = (bpstat) xmalloc (sizeof (*bs));
-  bs->next = NULL;
-  **bs_link_pointer = bs;
-  *bs_link_pointer = &bs->next;
-  bs->breakpoint_at = bl->owner;
-  bs->bp_location_at = bl;
   incref_bp_location (bl);
   incref_bp_location (bl);
-  /* If the condition is false, etc., don't do the commands.  */
-  bs->commands = NULL;
-  bs->old_val = NULL;
-  bs->print_it = print_it_normal;
-  return bs;
+  **bs_link_pointer = this;
+  *bs_link_pointer = &next;
+}
+
+bpstats::bpstats ()
+  : next (NULL),
+    bp_location_at (NULL),
+    breakpoint_at (NULL),
+    commands (NULL),
+    print (0),
+    stop (0),
+    print_it (print_it_normal)
+{
 }
 \f
 /* The target has stopped with waitstatus WS.  Check if any hardware
 }
 \f
 /* The target has stopped with waitstatus WS.  Check if any hardware
@@ -5033,7 +4730,7 @@ bpstat_alloc (struct bp_location *bl, bpstat **bs_link_pointer)
 int
 watchpoints_triggered (struct target_waitstatus *ws)
 {
 int
 watchpoints_triggered (struct target_waitstatus *ws)
 {
-  int stopped_by_watchpoint = target_stopped_by_watchpoint ();
+  bool stopped_by_watchpoint = target_stopped_by_watchpoint ();
   CORE_ADDR addr;
   struct breakpoint *b;
 
   CORE_ADDR addr;
   struct breakpoint *b;
 
@@ -5052,7 +4749,7 @@ watchpoints_triggered (struct target_waitstatus *ws)
       return 0;
     }
 
       return 0;
     }
 
-  if (!target_stopped_data_address (&current_target, &addr))
+  if (!target_stopped_data_address (current_top_target (), &addr))
     {
       /* We were stopped by a watchpoint, but we don't know where.
         Mark all watchpoints as unknown.  */
     {
       /* We were stopped by a watchpoint, but we don't know where.
         Mark all watchpoints as unknown.  */
@@ -5092,7 +4789,7 @@ watchpoints_triggered (struct target_waitstatus *ws)
                  }
              }
            /* Exact match not required.  Within range is sufficient.  */
                  }
              }
            /* Exact match not required.  Within range is sufficient.  */
-           else if (target_watchpoint_addr_within_range (&current_target,
+           else if (target_watchpoint_addr_within_range (current_top_target (),
                                                         addr, loc->address,
                                                         loc->length))
              {
                                                         addr, loc->address,
                                                         loc->length))
              {
@@ -5105,30 +4802,31 @@ watchpoints_triggered (struct target_waitstatus *ws)
   return 1;
 }
 
   return 1;
 }
 
-/* Possible return values for watchpoint_check (this can't be an enum
-   because of check_errors).  */
-/* The watchpoint has been deleted.  */
-#define WP_DELETED 1
-/* The value has changed.  */
-#define WP_VALUE_CHANGED 2
-/* The value has not changed.  */
-#define WP_VALUE_NOT_CHANGED 3
-/* Ignore this watchpoint, no matter if the value changed or not.  */
-#define WP_IGNORE 4
+/* Possible return values for watchpoint_check.  */
+enum wp_check_result
+  {
+    /* The watchpoint has been deleted.  */
+    WP_DELETED = 1,
+
+    /* The value has changed.  */
+    WP_VALUE_CHANGED = 2,
+
+    /* The value has not changed.  */
+    WP_VALUE_NOT_CHANGED = 3,
+
+    /* Ignore this watchpoint, no matter if the value changed or not.  */
+    WP_IGNORE = 4,
+  };
 
 #define BP_TEMPFLAG 1
 #define BP_HARDWAREFLAG 2
 
 /* Evaluate watchpoint condition expression and check if its value
 
 #define BP_TEMPFLAG 1
 #define BP_HARDWAREFLAG 2
 
 /* Evaluate watchpoint condition expression and check if its value
-   changed.
+   changed.  */
 
 
-   P should be a pointer to struct bpstat, but is defined as a void *
-   in order for this function to be usable with catch_errors.  */
-
-static int
-watchpoint_check (void *p)
+static wp_check_result
+watchpoint_check (bpstat bs)
 {
 {
-  bpstat bs = (bpstat) p;
   struct watchpoint *b;
   struct frame_info *fr;
   int within_current_scope;
   struct watchpoint *b;
   struct frame_info *fr;
   int within_current_scope;
@@ -5214,16 +4912,14 @@ watchpoint_check (void *p)
         the address of the array instead of its contents.  This is
         not what we want.  */
       if ((b->val != NULL) != (new_val != NULL)
         the address of the array instead of its contents.  This is
         not what we want.  */
       if ((b->val != NULL) != (new_val != NULL)
-         || (b->val != NULL && !value_equal_contents (b->val, new_val)))
+         || (b->val != NULL && !value_equal_contents (b->val.get (),
+                                                      new_val)))
        {
        {
-         if (new_val != NULL)
-           {
-             release_value (new_val);
-             value_free_to_mark (mark);
-           }
          bs->old_val = b->val;
          bs->old_val = b->val;
-         b->val = new_val;
+         b->val = release_value (new_val);
          b->val_valid = 1;
          b->val_valid = 1;
+         if (new_val != NULL)
+           value_free_to_mark (mark);
          return WP_VALUE_CHANGED;
        }
       else
          return WP_VALUE_CHANGED;
        }
       else
@@ -5263,7 +4959,7 @@ watchpoint_check (void *p)
        }
 
       /* Make sure the watchpoint's commands aren't executed.  */
        }
 
       /* Make sure the watchpoint's commands aren't executed.  */
-      decref_counted_command_line (&b->commands);
+      b->commands = NULL;
       watchpoint_del_at_next_stop (b);
 
       return WP_DELETED;
       watchpoint_del_at_next_stop (b);
 
       return WP_DELETED;
@@ -5276,7 +4972,7 @@ watchpoint_check (void *p)
 
 static int
 bpstat_check_location (const struct bp_location *bl,
 
 static int
 bpstat_check_location (const struct bp_location *bl,
-                      struct address_space *aspace, CORE_ADDR bp_addr,
+                      const address_space *aspace, CORE_ADDR bp_addr,
                       const struct target_waitstatus *ws)
 {
   struct breakpoint *b = bl->owner;
                       const struct target_waitstatus *ws)
 {
   struct breakpoint *b = bl->owner;
@@ -5324,13 +5020,29 @@ bpstat_check_watchpoint (bpstat bs)
 
       if (must_check_value)
        {
 
       if (must_check_value)
        {
-         char *message
-           = xstrprintf ("Error evaluating expression for watchpoint %d\n",
-                         b->number);
-         struct cleanup *cleanups = make_cleanup (xfree, message);
-         int e = catch_errors (watchpoint_check, bs, message,
-                               RETURN_MASK_ALL);
-         do_cleanups (cleanups);
+         wp_check_result e;
+
+         TRY
+           {
+             e = watchpoint_check (bs);
+           }
+         CATCH (ex, RETURN_MASK_ALL)
+           {
+             exception_fprintf (gdb_stderr, ex,
+                                "Error evaluating expression "
+                                "for watchpoint %d\n",
+                                b->number);
+
+             SWITCH_THRU_ALL_UIS ()
+               {
+                 printf_filtered (_("Watchpoint %d deleted.\n"),
+                                  b->number);
+               }
+             watchpoint_del_at_next_stop (b);
+             e = WP_DELETED;
+           }
+         END_CATCH
+
          switch (e)
            {
            case WP_DELETED:
          switch (e)
            {
            case WP_DELETED:
@@ -5426,18 +5138,6 @@ bpstat_check_watchpoint (bpstat bs)
              break;
            default:
              /* Can't happen.  */
              break;
            default:
              /* Can't happen.  */
-           case 0:
-             /* Error from catch_errors.  */
-             {
-               SWITCH_THRU_ALL_UIS ()
-                 {
-                   printf_filtered (_("Watchpoint %d deleted.\n"),
-                                    b->number);
-                 }
-               watchpoint_del_at_next_stop (b);
-               /* We've already printed what needs to be printed.  */
-               bs->print_it = print_it_done;
-             }
              break;
            }
        }
              break;
            }
        }
@@ -5459,11 +5159,12 @@ bpstat_check_watchpoint (bpstat bs)
    breakpoint, set BS->stop to 0.  */
 
 static void
    breakpoint, set BS->stop to 0.  */
 
 static void
-bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
+bpstat_check_breakpoint_conditions (bpstat bs, thread_info *thread)
 {
   const struct bp_location *bl;
   struct breakpoint *b;
 {
   const struct bp_location *bl;
   struct breakpoint *b;
-  int value_is_zero = 0;
+  /* Assume stop.  */
+  bool condition_result = true;
   struct expression *cond;
 
   gdb_assert (bs->stop);
   struct expression *cond;
 
   gdb_assert (bs->stop);
@@ -5488,9 +5189,8 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
   /* If this is a thread/task-specific breakpoint, don't waste cpu
      evaluating the condition if this isn't the specified
      thread/task.  */
   /* If this is a thread/task-specific breakpoint, don't waste cpu
      evaluating the condition if this isn't the specified
      thread/task.  */
-  if ((b->thread != -1 && b->thread != ptid_to_global_thread_id (ptid))
-      || (b->task != 0 && b->task != ada_get_task_number (ptid)))
-
+  if ((b->thread != -1 && b->thread != thread->global_num)
+      || (b->task != 0 && b->task != ada_get_task_number (thread)))
     {
       bs->stop = 0;
       return;
     {
       bs->stop = 0;
       return;
@@ -5559,23 +5259,30 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
            within_current_scope = 0;
        }
       if (within_current_scope)
            within_current_scope = 0;
        }
       if (within_current_scope)
-       value_is_zero
-         = catch_errors (breakpoint_cond_eval, cond,
-                         "Error in testing breakpoint condition:\n",
-                         RETURN_MASK_ALL);
+       {
+         TRY
+           {
+             condition_result = breakpoint_cond_eval (cond);
+           }
+         CATCH (ex, RETURN_MASK_ALL)
+           {
+             exception_fprintf (gdb_stderr, ex,
+                                "Error in testing breakpoint condition:\n");
+           }
+         END_CATCH
+       }
       else
        {
          warning (_("Watchpoint condition cannot be tested "
                     "in the current scope"));
          /* If we failed to set the right context for this
             watchpoint, unconditionally report it.  */
       else
        {
          warning (_("Watchpoint condition cannot be tested "
                     "in the current scope"));
          /* If we failed to set the right context for this
             watchpoint, unconditionally report it.  */
-         value_is_zero = 0;
        }
       /* FIXME-someday, should give breakpoint #.  */
       value_free_to_mark (mark);
     }
 
        }
       /* FIXME-someday, should give breakpoint #.  */
       value_free_to_mark (mark);
     }
 
-  if (cond && value_is_zero)
+  if (cond && !condition_result)
     {
       bs->stop = 0;
     }
     {
       bs->stop = 0;
     }
@@ -5585,7 +5292,7 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
       bs->stop = 0;
       /* Increase the hit count even though we don't stop.  */
       ++(b->hit_count);
       bs->stop = 0;
       /* Increase the hit count even though we don't stop.  */
       ++(b->hit_count);
-      observer_notify_breakpoint_modified (b);
+      gdb::observers::breakpoint_modified.notify (b);
     }  
 }
 
     }  
 }
 
@@ -5601,54 +5308,21 @@ need_moribund_for_location_type (struct bp_location *loc)
              && !target_supports_stopped_by_hw_breakpoint ()));
 }
 
              && !target_supports_stopped_by_hw_breakpoint ()));
 }
 
-
-/* Get a bpstat associated with having just stopped at address
-   BP_ADDR in thread PTID.
-
-   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:
-
-   if we don't understand the stop, the result is a null pointer.
-
-   if we understand why we stopped, the result is not null.
-
-   Each element of the chain refers to a particular breakpoint or
-   watchpoint at which we have stopped.  (We may have stopped for
-   several reasons concurrently.)
-
-   Each element of the chain has valid next, breakpoint_at,
-   commands, FIXME??? fields.  */
+/* See breakpoint.h.  */
 
 bpstat
 
 bpstat
-bpstat_stop_status (struct address_space *aspace,
-                   CORE_ADDR bp_addr, ptid_t ptid,
+build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
                    const struct target_waitstatus *ws)
 {
                    const struct target_waitstatus *ws)
 {
-  struct breakpoint *b = NULL;
-  struct bp_location *bl;
-  struct bp_location *loc;
-  /* First item of allocated bpstat's.  */
+  struct breakpoint *b;
   bpstat bs_head = NULL, *bs_link = &bs_head;
   bpstat bs_head = NULL, *bs_link = &bs_head;
-  /* Pointer to the last thing in the chain currently.  */
-  bpstat bs;
-  int ix;
-  int need_remove_insert;
-  int removed_any;
-
-  /* First, build the bpstat chain with locations that explain a
-     target stop, while being careful to not set the target running,
-     as that may invalidate locations (in particular watchpoint
-     locations are recreated).  Resuming will happen here with
-     breakpoint conditions or watchpoint expressions that include
-     inferior function calls.  */
 
   ALL_BREAKPOINTS (b)
     {
       if (!breakpoint_enabled (b))
        continue;
 
 
   ALL_BREAKPOINTS (b)
     {
       if (!breakpoint_enabled (b))
        continue;
 
-      for (bl = b->loc; bl != NULL; bl = bl->next)
+      for (bp_location *bl = b->loc; bl != NULL; bl = bl->next)
        {
          /* For hardware watchpoints, we look only at the first
             location.  The watchpoint_check function will work on the
        {
          /* For hardware watchpoints, we look only at the first
             location.  The watchpoint_check function will work on the
@@ -5667,8 +5341,8 @@ bpstat_stop_status (struct address_space *aspace,
          /* Come here if it's a watchpoint, or if the break address
             matches.  */
 
          /* Come here if it's a watchpoint, or if the break address
             matches.  */
 
-         bs = bpstat_alloc (bl, &bs_link);     /* Alloc a bpstat to
-                                                  explain stop.  */
+         bpstat bs = new bpstats (bl, &bs_link);       /* Alloc a bpstat to
+                                                          explain stop.  */
 
          /* Assume we stop.  Should we find a watchpoint that is not
             actually triggered, or if the condition of the breakpoint
 
          /* Assume we stop.  Should we find a watchpoint that is not
             actually triggered, or if the condition of the breakpoint
@@ -5693,12 +5367,12 @@ bpstat_stop_status (struct address_space *aspace,
   if (!target_supports_stopped_by_sw_breakpoint ()
       || !target_supports_stopped_by_hw_breakpoint ())
     {
   if (!target_supports_stopped_by_sw_breakpoint ()
       || !target_supports_stopped_by_hw_breakpoint ())
     {
-      for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+      for (bp_location *loc : moribund_locations)
        {
          if (breakpoint_location_address_match (loc, aspace, bp_addr)
              && need_moribund_for_location_type (loc))
            {
        {
          if (breakpoint_location_address_match (loc, aspace, bp_addr)
              && need_moribund_for_location_type (loc))
            {
-             bs = bpstat_alloc (loc, &bs_link);
+             bpstat bs = new bpstats (loc, &bs_link);
              /* For hits of moribund locations, we should just proceed.  */
              bs->stop = 0;
              bs->print = 0;
              /* For hits of moribund locations, we should just proceed.  */
              bs->stop = 0;
              bs->print = 0;
@@ -5707,6 +5381,33 @@ bpstat_stop_status (struct address_space *aspace,
        }
     }
 
        }
     }
 
+  return bs_head;
+}
+
+/* See breakpoint.h.  */
+
+bpstat
+bpstat_stop_status (const address_space *aspace,
+                   CORE_ADDR bp_addr, thread_info *thread,
+                   const struct target_waitstatus *ws,
+                   bpstat stop_chain)
+{
+  struct breakpoint *b = NULL;
+  /* First item of allocated bpstat's.  */
+  bpstat bs_head = stop_chain;
+  bpstat bs;
+  int need_remove_insert;
+  int removed_any;
+
+  /* First, build the bpstat chain with locations that explain a
+     target stop, while being careful to not set the target running,
+     as that may invalidate locations (in particular watchpoint
+     locations are recreated).  Resuming will happen here with
+     breakpoint conditions or watchpoint expressions that include
+     inferior function calls.  */
+  if (bs_head == NULL)
+    bs_head = build_bpstat_chain (aspace, bp_addr, ws);
+
   /* A bit of special processing for shlib breakpoints.  We need to
      process solib loading here, so that the lists of loaded and
      unloaded libraries are correct before we handle "catch load" and
   /* A bit of special processing for shlib breakpoints.  We need to
      process solib loading here, so that the lists of loaded and
      unloaded libraries are correct before we handle "catch load" and
@@ -5735,12 +5436,12 @@ bpstat_stop_status (struct address_space *aspace,
       b->ops->check_status (bs);
       if (bs->stop)
        {
       b->ops->check_status (bs);
       if (bs->stop)
        {
-         bpstat_check_breakpoint_conditions (bs, ptid);
+         bpstat_check_breakpoint_conditions (bs, thread);
 
          if (bs->stop)
            {
              ++(b->hit_count);
 
          if (bs->stop)
            {
              ++(b->hit_count);
-             observer_notify_breakpoint_modified (b);
+             gdb::observers::breakpoint_modified.notify (b);
 
              /* We will stop here.  */
              if (b->disposition == disp_disable)
 
              /* We will stop here.  */
              if (b->disposition == disp_disable)
@@ -5753,9 +5454,8 @@ bpstat_stop_status (struct address_space *aspace,
              if (b->silent)
                bs->print = 0;
              bs->commands = b->commands;
              if (b->silent)
                bs->print = 0;
              bs->commands = b->commands;
-             incref_counted_command_line (bs->commands);
              if (command_line_is_silent (bs->commands
              if (command_line_is_silent (bs->commands
-                                         ? bs->commands->commands : NULL))
+                                         ? bs->commands.get () : NULL))
                bs->print = 0;
 
              b->ops->after_condition_true (bs);
                bs->print = 0;
 
              b->ops->after_condition_true (bs);
@@ -5805,14 +5505,14 @@ handle_jit_event (void)
 
   /* Switch terminal for any messages produced by
      breakpoint_re_set.  */
 
   /* Switch terminal for any messages produced by
      breakpoint_re_set.  */
-  target_terminal_ours_for_output ();
+  target_terminal::ours_for_output ();
 
   frame = get_current_frame ();
   gdbarch = get_frame_arch (frame);
 
   jit_event_handler (gdbarch);
 
 
   frame = get_current_frame ();
   gdbarch = get_frame_arch (frame);
 
   jit_event_handler (gdbarch);
 
-  target_terminal_inferior ();
+  target_terminal::inferior ();
 }
 
 /* Prepare WHAT final decision for infrun.  */
 }
 
 /* Prepare WHAT final decision for infrun.  */
@@ -6157,8 +5857,8 @@ print_breakpoint_location (struct breakpoint *b,
     uiout->field_string ("what", event_location_to_string (b->location.get ()));
   else if (loc && loc->symtab)
     {
     uiout->field_string ("what", event_location_to_string (b->location.get ()));
   else if (loc && loc->symtab)
     {
-      struct symbol *sym 
-       = find_pc_sect_function (loc->address, loc->section);
+      const struct symbol *sym = loc->symbol;
+
       if (sym)
        {
          uiout->text ("in ");
       if (sym)
        {
          uiout->text ("in ");
@@ -6273,12 +5973,10 @@ bptype_string (enum bptype type)
 static void
 output_thread_groups (struct ui_out *uiout,
                      const char *field_name,
 static void
 output_thread_groups (struct ui_out *uiout,
                      const char *field_name,
-                     VEC(int) *inf_num,
+                     const std::vector<int> &inf_nums,
                      int mi_only)
 {
   int is_mi = uiout->is_mi_like_p ();
                      int mi_only)
 {
   int is_mi = uiout->is_mi_like_p ();
-  int inf;
-  int i;
 
   /* For backward compatibility, don't display inferiors in CLI unless
      there are several.  Always display them for MI. */
 
   /* For backward compatibility, don't display inferiors in CLI unless
      there are several.  Always display them for MI. */
@@ -6287,13 +5985,13 @@ output_thread_groups (struct ui_out *uiout,
 
   ui_out_emit_list list_emitter (uiout, field_name);
 
 
   ui_out_emit_list list_emitter (uiout, field_name);
 
-  for (i = 0; VEC_iterate (int, inf_num, i, inf); ++i)
+  for (size_t i = 0; i < inf_nums.size (); i++)
     {
       if (is_mi)
        {
          char mi_group[10];
 
     {
       if (is_mi)
        {
          char mi_group[10];
 
-         xsnprintf (mi_group, sizeof (mi_group), "i%d", inf);
+         xsnprintf (mi_group, sizeof (mi_group), "i%d", inf_nums[i]);
          uiout->field_string (NULL, mi_group);
        }
       else
          uiout->field_string (NULL, mi_group);
        }
       else
@@ -6303,7 +6001,7 @@ output_thread_groups (struct ui_out *uiout,
          else
            uiout->text (", ");
        
          else
            uiout->text (", ");
        
-         uiout->text (plongest (inf));
+         uiout->text (plongest (inf_nums[i]));
        }
     }
 }
        }
     }
 }
@@ -6342,16 +6040,9 @@ print_one_breakpoint_location (struct breakpoint *b,
   /* 1 */
   annotate_field (0);
   if (part_of_multiple)
   /* 1 */
   annotate_field (0);
   if (part_of_multiple)
-    {
-      char *formatted;
-      formatted = xstrprintf ("%d.%d", b->number, loc_number);
-      uiout->field_string ("number", formatted);
-      xfree (formatted);
-    }
+    uiout->field_fmt ("number", "%d.%d", b->number, loc_number);
   else
   else
-    {
-      uiout->field_int ("number", b->number);
-    }
+    uiout->field_int ("number", b->number);
 
   /* 2 */
   annotate_field (1);
 
   /* 2 */
   annotate_field (1);
@@ -6462,13 +6153,13 @@ print_one_breakpoint_location (struct breakpoint *b,
   if (loc != NULL && !header_of_multiple)
     {
       struct inferior *inf;
   if (loc != NULL && !header_of_multiple)
     {
       struct inferior *inf;
-      VEC(int) *inf_num = NULL;
+      std::vector<int> inf_nums;
       int mi_only = 1;
 
       ALL_INFERIORS (inf)
        {
          if (inf->pspace == loc->pspace)
       int mi_only = 1;
 
       ALL_INFERIORS (inf)
        {
          if (inf->pspace == loc->pspace)
-           VEC_safe_push (int, inf_num, inf->num);
+           inf_nums.push_back (inf->num);
        }
 
         /* For backward compatibility, don't display inferiors in CLI unless
        }
 
         /* For backward compatibility, don't display inferiors in CLI unless
@@ -6481,8 +6172,7 @@ print_one_breakpoint_location (struct breakpoint *b,
                   moribund_locations and thus having NULL OWNER.  */
                && loc->owner->type != bp_catchpoint))
        mi_only = 0;
                   moribund_locations and thus having NULL OWNER.  */
                && loc->owner->type != bp_catchpoint))
        mi_only = 0;
-      output_thread_groups (uiout, "thread-groups", inf_num, mi_only);
-      VEC_free (int, inf_num);
+      output_thread_groups (uiout, "thread-groups", inf_nums, mi_only);
     }
 
   if (!part_of_multiple)
     }
 
   if (!part_of_multiple)
@@ -6618,7 +6308,7 @@ print_one_breakpoint_location (struct breakpoint *b,
        }
     }
 
        }
     }
 
-  l = b->commands ? b->commands->commands : NULL;
+  l = b->commands ? b->commands.get () : NULL;
   if (!part_of_multiple && l)
     {
       annotate_field (9);
   if (!part_of_multiple && l)
     {
       annotate_field (9);
@@ -6737,44 +6427,13 @@ breakpoint_address_bits (struct breakpoint *b)
   return print_address_bits;
 }
 
   return print_address_bits;
 }
 
-struct captured_breakpoint_query_args
-  {
-    int bnum;
-  };
+/* See breakpoint.h.  */
 
 
-static int
-do_captured_breakpoint_query (struct ui_out *uiout, void *data)
+void
+print_breakpoint (breakpoint *b)
 {
 {
-  struct captured_breakpoint_query_args *args
-    = (struct captured_breakpoint_query_args *) data;
-  struct breakpoint *b;
   struct bp_location *dummy_loc = NULL;
   struct bp_location *dummy_loc = NULL;
-
-  ALL_BREAKPOINTS (b)
-    {
-      if (args->bnum == b->number)
-       {
-         print_one_breakpoint (b, &dummy_loc, 0);
-         return GDB_RC_OK;
-       }
-    }
-  return GDB_RC_NONE;
-}
-
-enum gdb_rc
-gdb_breakpoint_query (struct ui_out *uiout, int bnum, 
-                     char **error_message)
-{
-  struct captured_breakpoint_query_args args;
-
-  args.bnum = bnum;
-  /* For the moment we don't trust print_one_breakpoint() to not throw
-     an error.  */
-  if (catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args,
-                                error_message, RETURN_MASK_ALL) < 0)
-    return GDB_RC_FAIL;
-  else
-    return GDB_RC_OK;
+  print_one_breakpoint (b, &dummy_loc, 0);
 }
 
 /* Return true if this breakpoint was set by the user, false if it is
 }
 
 /* Return true if this breakpoint was set by the user, false if it is
@@ -6802,7 +6461,7 @@ pending_breakpoint_p (struct breakpoint *b)
    breakpoints listed.  */
 
 static int
    breakpoints listed.  */
 
 static int
-breakpoint_1 (char *args, int allflag, 
+breakpoint_1 (const char *args, int allflag, 
              int (*filter) (const struct breakpoint *))
 {
   struct breakpoint *b;
              int (*filter) (const struct breakpoint *))
 {
   struct breakpoint *b;
@@ -6964,7 +6623,7 @@ default_collect_info (void)
 }
   
 static void
 }
   
 static void
-breakpoints_info (char *args, int from_tty)
+info_breakpoints_command (const char *args, int from_tty)
 {
   breakpoint_1 (args, 0, NULL);
 
 {
   breakpoint_1 (args, 0, NULL);
 
@@ -6972,7 +6631,7 @@ breakpoints_info (char *args, int from_tty)
 }
 
 static void
 }
 
 static void
-watchpoints_info (char *args, int from_tty)
+info_watchpoints_command (const char *args, int from_tty)
 {
   int num_printed = breakpoint_1 (args, 0, is_watchpoint);
   struct ui_out *uiout = current_uiout;
 {
   int num_printed = breakpoint_1 (args, 0, is_watchpoint);
   struct ui_out *uiout = current_uiout;
@@ -6987,7 +6646,7 @@ watchpoints_info (char *args, int from_tty)
 }
 
 static void
 }
 
 static void
-maintenance_info_breakpoints (char *args, int from_tty)
+maintenance_info_breakpoints (const char *args, int from_tty)
 {
   breakpoint_1 (args, 1, NULL);
 
 {
   breakpoint_1 (args, 1, NULL);
 
@@ -7126,8 +6785,8 @@ watchpoint_locations_match (struct bp_location *loc1,
 /* See breakpoint.h.  */
 
 int
 /* See breakpoint.h.  */
 
 int
-breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1,
-                         struct address_space *aspace2, CORE_ADDR addr2)
+breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1,
+                         const address_space *aspace2, CORE_ADDR addr2)
 {
   return ((gdbarch_has_global_breakpoints (target_gdbarch ())
           || aspace1 == aspace2)
 {
   return ((gdbarch_has_global_breakpoints (target_gdbarch ())
           || aspace1 == aspace2)
@@ -7140,8 +6799,9 @@ breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1,
    space doesn't really matter.  */
 
 static int
    space doesn't really matter.  */
 
 static int
-breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1,
-                               int len1, struct address_space *aspace2,
+breakpoint_address_match_range (const address_space *aspace1,
+                               CORE_ADDR addr1,
+                               int len1, const address_space *aspace2,
                                CORE_ADDR addr2)
 {
   return ((gdbarch_has_global_breakpoints (target_gdbarch ())
                                CORE_ADDR addr2)
 {
   return ((gdbarch_has_global_breakpoints (target_gdbarch ())
@@ -7156,7 +6816,7 @@ breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1,
 
 static int
 breakpoint_location_address_match (struct bp_location *bl,
 
 static int
 breakpoint_location_address_match (struct bp_location *bl,
-                                  struct address_space *aspace,
+                                  const address_space *aspace,
                                   CORE_ADDR addr)
 {
   return (breakpoint_address_match (bl->pspace->aspace, bl->address,
                                   CORE_ADDR addr)
 {
   return (breakpoint_address_match (bl->pspace->aspace, bl->address,
@@ -7175,7 +6835,7 @@ breakpoint_location_address_match (struct bp_location *bl,
 
 static int
 breakpoint_location_address_range_overlap (struct bp_location *bl,
 
 static int
 breakpoint_location_address_range_overlap (struct bp_location *bl,
-                                          struct address_space *aspace,
+                                          const address_space *aspace,
                                           CORE_ADDR addr, int len)
 {
   if (gdbarch_has_global_breakpoints (target_gdbarch ())
                                           CORE_ADDR addr, int len)
 {
   if (gdbarch_has_global_breakpoints (target_gdbarch ())
@@ -7263,16 +6923,11 @@ static CORE_ADDR
 adjust_breakpoint_address (struct gdbarch *gdbarch,
                           CORE_ADDR bpaddr, enum bptype bptype)
 {
 adjust_breakpoint_address (struct gdbarch *gdbarch,
                           CORE_ADDR bpaddr, enum bptype bptype)
 {
-  if (!gdbarch_adjust_breakpoint_address_p (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_catchpoint)
+  if (bptype == bp_watchpoint
+      || bptype == bp_hardware_watchpoint
+      || bptype == bp_read_watchpoint
+      || bptype == bp_access_watchpoint
+      || bptype == bp_catchpoint)
     {
       /* Watchpoints and the various bp_catch_* eventpoints should not
          have their addresses modified.  */
     {
       /* Watchpoints and the various bp_catch_* eventpoints should not
          have their addresses modified.  */
@@ -7290,11 +6945,16 @@ adjust_breakpoint_address (struct gdbarch *gdbarch,
     }
   else
     {
     }
   else
     {
-      CORE_ADDR adjusted_bpaddr;
+      CORE_ADDR adjusted_bpaddr = bpaddr;
 
 
-      /* Some targets have architectural constraints on the placement
-         of breakpoint instructions.  Obtain the adjusted address.  */
-      adjusted_bpaddr = gdbarch_adjust_breakpoint_address (gdbarch, bpaddr);
+      if (gdbarch_adjust_breakpoint_address_p (gdbarch))
+       {
+         /* Some targets have architectural constraints on the placement
+            of breakpoint instructions.  Obtain the adjusted address.  */
+         adjusted_bpaddr = gdbarch_adjust_breakpoint_address (gdbarch, bpaddr);
+       }
+
+      adjusted_bpaddr = address_significant (gdbarch, adjusted_bpaddr);
 
       /* An adjusted breakpoint address can significantly alter
          a user's expectations.  Print a warning if an adjustment
 
       /* An adjusted breakpoint address can significantly alter
          a user's expectations.  Print a warning if an adjustment
@@ -7408,23 +7068,26 @@ decref_bp_location (struct bp_location **blp)
 
 /* Add breakpoint B at the end of the global breakpoint chain.  */
 
 
 /* Add breakpoint B at the end of the global breakpoint chain.  */
 
-static void
-add_to_breakpoint_chain (struct breakpoint *b)
+static breakpoint *
+add_to_breakpoint_chain (std::unique_ptr<breakpoint> &&b)
 {
   struct breakpoint *b1;
 {
   struct breakpoint *b1;
+  struct breakpoint *result = b.get ();
 
   /* Add this breakpoint to the end of the chain so that a list of
      breakpoints will come out in order of increasing numbers.  */
 
   b1 = breakpoint_chain;
   if (b1 == 0)
 
   /* Add this breakpoint to the end of the chain so that a list of
      breakpoints will come out in order of increasing numbers.  */
 
   b1 = breakpoint_chain;
   if (b1 == 0)
-    breakpoint_chain = b;
+    breakpoint_chain = b.release ();
   else
     {
       while (b1->next)
        b1 = b1->next;
   else
     {
       while (b1->next)
        b1 = b1->next;
-      b1->next = b;
+      b1->next = b.release ();
     }
     }
+
+  return result;
 }
 
 /* Initializes breakpoint B with type BPTYPE and no locations yet.  */
 }
 
 /* Initializes breakpoint B with type BPTYPE and no locations yet.  */
@@ -7456,9 +7119,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch,
   std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
 
   init_raw_breakpoint_without_location (b.get (), gdbarch, bptype, ops);
   std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
 
   init_raw_breakpoint_without_location (b.get (), gdbarch, bptype, ops);
-  add_to_breakpoint_chain (b.get ());
-
-  return b.release ();
+  return add_to_breakpoint_chain (std::move (b));
 }
 
 /* Initialize loc->function_name.  EXPLICIT_LOC says no indirect function
 }
 
 /* Initialize loc->function_name.  EXPLICIT_LOC says no indirect function
@@ -7474,37 +7135,30 @@ set_breakpoint_location_function (struct bp_location *loc, int explicit_loc)
       || loc->owner->type == bp_hardware_breakpoint
       || is_tracepoint (loc->owner))
     {
       || loc->owner->type == bp_hardware_breakpoint
       || is_tracepoint (loc->owner))
     {
-      int is_gnu_ifunc;
       const char *function_name;
       const char *function_name;
-      CORE_ADDR func_addr;
-
-      find_pc_partial_function_gnu_ifunc (loc->address, &function_name,
-                                         &func_addr, NULL, &is_gnu_ifunc);
 
 
-      if (is_gnu_ifunc && !explicit_loc)
+      if (loc->msymbol != NULL
+         && (MSYMBOL_TYPE (loc->msymbol) == mst_text_gnu_ifunc
+             || MSYMBOL_TYPE (loc->msymbol) == mst_data_gnu_ifunc)
+         && !explicit_loc)
        {
          struct breakpoint *b = loc->owner;
 
        {
          struct breakpoint *b = loc->owner;
 
-         gdb_assert (loc->pspace == current_program_space);
-         if (gnu_ifunc_resolve_name (function_name,
-                                     &loc->requested_address))
-           {
-             /* Recalculate ADDRESS based on new REQUESTED_ADDRESS.  */
-             loc->address = adjust_breakpoint_address (loc->gdbarch,
-                                                       loc->requested_address,
-                                                       b->type);
-           }
-         else if (b->type == bp_breakpoint && b->loc == loc
-                  && loc->next == NULL && b->related_breakpoint == b)
+         function_name = MSYMBOL_LINKAGE_NAME (loc->msymbol);
+
+         if (b->type == bp_breakpoint && b->loc == loc
+             && loc->next == NULL && b->related_breakpoint == b)
            {
              /* Create only the whole new breakpoint of this type but do not
                 mess more complicated breakpoints with multiple locations.  */
              b->type = bp_gnu_ifunc_resolver;
              /* Remember the resolver's address for use by the return
                 breakpoint.  */
            {
              /* Create only the whole new breakpoint of this type but do not
                 mess more complicated breakpoints with multiple locations.  */
              b->type = bp_gnu_ifunc_resolver;
              /* Remember the resolver's address for use by the return
                 breakpoint.  */
-             loc->related_address = func_addr;
+             loc->related_address = loc->address;
            }
        }
            }
        }
+      else
+       find_pc_partial_function (loc->address, &function_name, NULL, NULL);
 
       if (function_name)
        loc->function_name = xstrdup (function_name);
 
       if (function_name)
        loc->function_name = xstrdup (function_name);
@@ -7573,9 +7227,7 @@ set_raw_breakpoint (struct gdbarch *gdbarch,
   std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
 
   init_raw_breakpoint (b.get (), gdbarch, sal, bptype, ops);
   std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
 
   init_raw_breakpoint (b.get (), gdbarch, sal, bptype, ops);
-  add_to_breakpoint_chain (b.get ());
-
-  return b.release ();
+  return add_to_breakpoint_chain (std::move (b));
 }
 
 /* Call this routine when stepping and nexting to enable a breakpoint
 }
 
 /* Call this routine when stepping and nexting to enable a breakpoint
@@ -7655,7 +7307,7 @@ set_longjmp_breakpoint_for_call_dummy (void)
        new_b = momentary_breakpoint_from_master (b, bp_longjmp_call_dummy,
                                                  &momentary_breakpoint_ops,
                                                  1);
        new_b = momentary_breakpoint_from_master (b, bp_longjmp_call_dummy,
                                                  &momentary_breakpoint_ops,
                                                  1);
-       new_b->thread = ptid_to_global_thread_id (inferior_ptid);
+       new_b->thread = inferior_thread ()->global_num;
 
        /* Link NEW_B into the chain of RETVAL breakpoints.  */
 
 
        /* Link NEW_B into the chain of RETVAL breakpoints.  */
 
@@ -7695,7 +7347,7 @@ check_longjmp_breakpoint_for_call_dummy (struct thread_info *tp)
            || frame_find_by_id (dummy_b->frame_id) != NULL)
          continue;
        
            || frame_find_by_id (dummy_b->frame_id) != NULL)
          continue;
        
-       dummy_frame_discard (dummy_b->frame_id, tp->ptid);
+       dummy_frame_discard (dummy_b->frame_id, tp);
 
        while (b->related_breakpoint != b)
          {
 
        while (b->related_breakpoint != b)
          {
@@ -7935,11 +7587,11 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
        loc->inserted = 0;
 
        /* This may cause duplicate notifications for the same breakpoint.  */
        loc->inserted = 0;
 
        /* This may cause duplicate notifications for the same breakpoint.  */
-       observer_notify_breakpoint_modified (b);
+       gdb::observers::breakpoint_modified.notify (b);
 
        if (!disabled_shlib_breaks)
          {
 
        if (!disabled_shlib_breaks)
          {
-           target_terminal_ours_for_output ();
+           target_terminal::ours_for_output ();
            warning (_("Temporarily disabling breakpoints "
                       "for unloaded shared library \"%s\""),
                     solib->so_name);
            warning (_("Temporarily disabling breakpoints "
                       "for unloaded shared library \"%s\""),
                     solib->so_name);
@@ -8018,7 +7670,7 @@ disable_breakpoints_in_freed_objfile (struct objfile *objfile)
        }
 
       if (bp_modified)
        }
 
       if (bp_modified)
-       observer_notify_breakpoint_modified (b);
+       gdb::observers::breakpoint_modified.notify (b);
     }
 }
 
     }
 }
 
@@ -8042,7 +7694,7 @@ struct fork_catchpoint : public breakpoint
 static int
 insert_catch_fork (struct bp_location *bl)
 {
 static int
 insert_catch_fork (struct bp_location *bl)
 {
-  return target_insert_fork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_insert_fork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "remove" breakpoint_ops method for fork
 }
 
 /* Implement the "remove" breakpoint_ops method for fork
@@ -8051,7 +7703,7 @@ insert_catch_fork (struct bp_location *bl)
 static int
 remove_catch_fork (struct bp_location *bl, enum remove_bp_reason reason)
 {
 static int
 remove_catch_fork (struct bp_location *bl, enum remove_bp_reason reason)
 {
-  return target_remove_fork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_remove_fork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "breakpoint_hit" breakpoint_ops method for fork
 }
 
 /* Implement the "breakpoint_hit" breakpoint_ops method for fork
@@ -8059,7 +7711,7 @@ remove_catch_fork (struct bp_location *bl, enum remove_bp_reason reason)
 
 static int
 breakpoint_hit_catch_fork (const struct bp_location *bl,
 
 static int
 breakpoint_hit_catch_fork (const struct bp_location *bl,
-                          struct address_space *aspace, CORE_ADDR bp_addr,
+                          const address_space *aspace, CORE_ADDR bp_addr,
                           const struct target_waitstatus *ws)
 {
   struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner;
                           const struct target_waitstatus *ws)
 {
   struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner;
@@ -8094,7 +7746,7 @@ print_it_catch_fork (bpstat bs)
     }
   uiout->field_int ("bkptno", b->number);
   uiout->text (" (forked process ");
     }
   uiout->field_int ("bkptno", b->number);
   uiout->text (" (forked process ");
-  uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+  uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
   uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
   uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
@@ -8118,10 +7770,10 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
     uiout->field_skip ("addr");
   annotate_field (5);
   uiout->text ("fork");
     uiout->field_skip ("addr");
   annotate_field (5);
   uiout->text ("fork");
-  if (!ptid_equal (c->forked_inferior_pid, null_ptid))
+  if (c->forked_inferior_pid != null_ptid)
     {
       uiout->text (", process ");
     {
       uiout->text (", process ");
-      uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+      uiout->field_int ("what", c->forked_inferior_pid.pid ());
       uiout->spaces (1);
     }
 
       uiout->spaces (1);
     }
 
@@ -8158,7 +7810,7 @@ static struct breakpoint_ops catch_fork_breakpoint_ops;
 static int
 insert_catch_vfork (struct bp_location *bl)
 {
 static int
 insert_catch_vfork (struct bp_location *bl)
 {
-  return target_insert_vfork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_insert_vfork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "remove" breakpoint_ops method for vfork
 }
 
 /* Implement the "remove" breakpoint_ops method for vfork
@@ -8167,7 +7819,7 @@ insert_catch_vfork (struct bp_location *bl)
 static int
 remove_catch_vfork (struct bp_location *bl, enum remove_bp_reason reason)
 {
 static int
 remove_catch_vfork (struct bp_location *bl, enum remove_bp_reason reason)
 {
-  return target_remove_vfork_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_remove_vfork_catchpoint (inferior_ptid.pid ());
 }
 
 /* Implement the "breakpoint_hit" breakpoint_ops method for vfork
 }
 
 /* Implement the "breakpoint_hit" breakpoint_ops method for vfork
@@ -8175,7 +7827,7 @@ remove_catch_vfork (struct bp_location *bl, enum remove_bp_reason reason)
 
 static int
 breakpoint_hit_catch_vfork (const struct bp_location *bl,
 
 static int
 breakpoint_hit_catch_vfork (const struct bp_location *bl,
-                           struct address_space *aspace, CORE_ADDR bp_addr,
+                           const address_space *aspace, CORE_ADDR bp_addr,
                            const struct target_waitstatus *ws)
 {
   struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner;
                            const struct target_waitstatus *ws)
 {
   struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner;
@@ -8210,7 +7862,7 @@ print_it_catch_vfork (bpstat bs)
     }
   uiout->field_int ("bkptno", b->number);
   uiout->text (" (vforked process ");
     }
   uiout->field_int ("bkptno", b->number);
   uiout->text (" (vforked process ");
-  uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+  uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
   uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
   uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
@@ -8233,10 +7885,10 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc)
     uiout->field_skip ("addr");
   annotate_field (5);
   uiout->text ("vfork");
     uiout->field_skip ("addr");
   annotate_field (5);
   uiout->text ("vfork");
-  if (!ptid_equal (c->forked_inferior_pid, null_ptid))
+  if (c->forked_inferior_pid != null_ptid)
     {
       uiout->text (", process ");
     {
       uiout->text (", process ");
-      uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+      uiout->field_int ("what", c->forked_inferior_pid.pid ());
       uiout->spaces (1);
     }
 
       uiout->spaces (1);
     }
 
@@ -8303,7 +7955,7 @@ remove_catch_solib (struct bp_location *ignore, enum remove_bp_reason reason)
 
 static int
 breakpoint_hit_catch_solib (const struct bp_location *bl,
 
 static int
 breakpoint_hit_catch_solib (const struct bp_location *bl,
-                           struct address_space *aspace,
+                           const address_space *aspace,
                            CORE_ADDR bp_addr,
                            const struct target_waitstatus *ws)
 {
                            CORE_ADDR bp_addr,
                            const struct target_waitstatus *ws)
 {
@@ -8341,16 +7993,10 @@ check_status_catch_solib (struct bpstats *bs)
 {
   struct solib_catchpoint *self
     = (struct solib_catchpoint *) bs->breakpoint_at;
 {
   struct solib_catchpoint *self
     = (struct solib_catchpoint *) bs->breakpoint_at;
-  int ix;
 
   if (self->is_load)
     {
 
   if (self->is_load)
     {
-      struct so_list *iter;
-
-      for (ix = 0;
-          VEC_iterate (so_list_ptr, current_program_space->added_solibs,
-                       ix, iter);
-          ++ix)
+      for (so_list *iter : current_program_space->added_solibs)
        {
          if (!self->regex
              || self->compiled->exec (iter->so_name, 0, NULL, 0) == 0)
        {
          if (!self->regex
              || self->compiled->exec (iter->so_name, 0, NULL, 0) == 0)
@@ -8359,15 +8005,10 @@ check_status_catch_solib (struct bpstats *bs)
     }
   else
     {
     }
   else
     {
-      char *iter;
-
-      for (ix = 0;
-          VEC_iterate (char_ptr, current_program_space->deleted_solibs,
-                       ix, iter);
-          ++ix)
+      for (const std::string &iter : current_program_space->deleted_solibs)
        {
          if (!self->regex
        {
          if (!self->regex
-             || self->compiled->exec (iter, 0, NULL, 0) == 0)
+             || self->compiled->exec (iter.c_str (), 0, NULL, 0) == 0)
            return;
        }
     }
            return;
        }
     }
@@ -8402,7 +8043,6 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
   struct solib_catchpoint *self = (struct solib_catchpoint *) b;
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
   struct solib_catchpoint *self = (struct solib_catchpoint *) b;
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
-  char *msg;
 
   get_user_print_options (&opts);
   /* Field 4, the address, is omitted (which makes the columns not
 
   get_user_print_options (&opts);
   /* Field 4, the address, is omitted (which makes the columns not
@@ -8414,23 +8054,23 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
       uiout->field_skip ("addr");
     }
 
       uiout->field_skip ("addr");
     }
 
+  std::string msg;
   annotate_field (5);
   if (self->is_load)
     {
       if (self->regex)
   annotate_field (5);
   if (self->is_load)
     {
       if (self->regex)
-       msg = xstrprintf (_("load of library matching %s"), self->regex);
+       msg = string_printf (_("load of library matching %s"), self->regex);
       else
       else
-       msg = xstrdup (_("load of library"));
+       msg = _("load of library");
     }
   else
     {
       if (self->regex)
     }
   else
     {
       if (self->regex)
-       msg = xstrprintf (_("unload of library matching %s"), self->regex);
+       msg = string_printf (_("unload of library matching %s"), self->regex);
       else
       else
-       msg = xstrdup (_("unload of library"));
+       msg = _("unload of library");
     }
   uiout->field_string ("what", msg);
     }
   uiout->field_string ("what", msg);
-  xfree (msg);
 
   if (uiout->is_mi_like_p ())
     uiout->field_string ("catch-type", self->is_load ? "load" : "unload");
 
   if (uiout->is_mi_like_p ())
     uiout->field_string ("catch-type", self->is_load ? "load" : "unload");
@@ -8470,16 +8110,13 @@ static struct breakpoint_ops catch_solib_breakpoint_ops;
 void
 add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
 {
 void
 add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
 {
-  struct solib_catchpoint *c;
   struct gdbarch *gdbarch = get_current_arch ();
   struct gdbarch *gdbarch = get_current_arch ();
-  struct cleanup *cleanup;
 
   if (!arg)
     arg = "";
 
   if (!arg)
     arg = "";
-  arg = skip_spaces_const (arg);
+  arg = skip_spaces (arg);
 
 
-  c = new solib_catchpoint ();
-  cleanup = make_cleanup (xfree, c);
+  std::unique_ptr<solib_catchpoint> c (new solib_catchpoint ());
 
   if (*arg != '\0')
     {
 
   if (*arg != '\0')
     {
@@ -8489,20 +8126,19 @@ add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
     }
 
   c->is_load = is_load;
     }
 
   c->is_load = is_load;
-  init_catchpoint (c, gdbarch, is_temp, NULL,
+  init_catchpoint (c.get (), gdbarch, is_temp, NULL,
                   &catch_solib_breakpoint_ops);
 
   c->enable_state = enabled ? bp_enabled : bp_disabled;
 
                   &catch_solib_breakpoint_ops);
 
   c->enable_state = enabled ? bp_enabled : bp_disabled;
 
-  discard_cleanups (cleanup);
-  install_breakpoint (0, c, 1);
+  install_breakpoint (0, std::move (c), 1);
 }
 
 /* A helper function that does all the work for "catch load" and
    "catch unload".  */
 
 static void
 }
 
 /* A helper function that does all the work for "catch load" and
    "catch unload".  */
 
 static void
-catch_load_or_unload (char *arg, int from_tty, int is_load,
+catch_load_or_unload (const char *arg, int from_tty, int is_load,
                      struct cmd_list_element *command)
 {
   int tempflag;
                      struct cmd_list_element *command)
 {
   int tempflag;
@@ -8514,14 +8150,14 @@ catch_load_or_unload (char *arg, int from_tty, int is_load,
 }
 
 static void
 }
 
 static void
-catch_load_command_1 (char *arg, int from_tty,
+catch_load_command_1 (const char *arg, int from_tty,
                      struct cmd_list_element *command)
 {
   catch_load_or_unload (arg, from_tty, 1, command);
 }
 
 static void
                      struct cmd_list_element *command)
 {
   catch_load_or_unload (arg, from_tty, 1, command);
 }
 
 static void
-catch_unload_command_1 (char *arg, int from_tty,
+catch_unload_command_1 (const char *arg, int from_tty,
                        struct cmd_list_element *command)
 {
   catch_load_or_unload (arg, from_tty, 0, command);
                        struct cmd_list_element *command)
 {
   catch_load_or_unload (arg, from_tty, 0, command);
@@ -8538,9 +8174,7 @@ init_catchpoint (struct breakpoint *b,
                 const char *cond_string,
                 const struct breakpoint_ops *ops)
 {
                 const char *cond_string,
                 const struct breakpoint_ops *ops)
 {
-  struct symtab_and_line sal;
-
-  init_sal (&sal);
+  symtab_and_line sal;
   sal.pspace = current_program_space;
 
   init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
   sal.pspace = current_program_space;
 
   init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
@@ -8550,15 +8184,15 @@ init_catchpoint (struct breakpoint *b,
 }
 
 void
 }
 
 void
-install_breakpoint (int internal, struct breakpoint *b, int update_gll)
+install_breakpoint (int internal, std::unique_ptr<breakpoint> &&arg, int update_gll)
 {
 {
-  add_to_breakpoint_chain (b);
+  breakpoint *b = add_to_breakpoint_chain (std::move (arg));
   set_breakpoint_number (internal, b);
   if (is_tracepoint (b))
     set_tracepoint_count (breakpoint_count);
   if (!internal)
     mention (b);
   set_breakpoint_number (internal, b);
   if (is_tracepoint (b))
     set_tracepoint_count (breakpoint_count);
   if (!internal)
     mention (b);
-  observer_notify_breakpoint_created (b);
+  gdb::observers::breakpoint_created.notify (b);
 
   if (update_gll)
     update_global_location_list (UGLL_MAY_INSERT);
 
   if (update_gll)
     update_global_location_list (UGLL_MAY_INSERT);
@@ -8569,13 +8203,13 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
                                    int tempflag, const char *cond_string,
                                     const struct breakpoint_ops *ops)
 {
                                    int tempflag, const char *cond_string,
                                     const struct breakpoint_ops *ops)
 {
-  struct fork_catchpoint *c = new fork_catchpoint ();
+  std::unique_ptr<fork_catchpoint> c (new fork_catchpoint ());
 
 
-  init_catchpoint (c, gdbarch, tempflag, cond_string, ops);
+  init_catchpoint (c.get (), gdbarch, tempflag, cond_string, ops);
 
   c->forked_inferior_pid = null_ptid;
 
 
   c->forked_inferior_pid = null_ptid;
 
-  install_breakpoint (0, c, 1);
+  install_breakpoint (0, std::move (c), 1);
 }
 
 /* Exec catchpoints.  */
 }
 
 /* Exec catchpoints.  */
@@ -8604,18 +8238,18 @@ exec_catchpoint::~exec_catchpoint ()
 static int
 insert_catch_exec (struct bp_location *bl)
 {
 static int
 insert_catch_exec (struct bp_location *bl)
 {
-  return target_insert_exec_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_insert_exec_catchpoint (inferior_ptid.pid ());
 }
 
 static int
 remove_catch_exec (struct bp_location *bl, enum remove_bp_reason reason)
 {
 }
 
 static int
 remove_catch_exec (struct bp_location *bl, enum remove_bp_reason reason)
 {
-  return target_remove_exec_catchpoint (ptid_get_pid (inferior_ptid));
+  return target_remove_exec_catchpoint (inferior_ptid.pid ());
 }
 
 static int
 breakpoint_hit_catch_exec (const struct bp_location *bl,
 }
 
 static int
 breakpoint_hit_catch_exec (const struct bp_location *bl,
-                          struct address_space *aspace, CORE_ADDR bp_addr,
+                          const address_space *aspace, CORE_ADDR bp_addr,
                           const struct target_waitstatus *ws)
 {
   struct exec_catchpoint *c = (struct exec_catchpoint *) bl->owner;
                           const struct target_waitstatus *ws)
 {
   struct exec_catchpoint *c = (struct exec_catchpoint *) bl->owner;
@@ -8820,9 +8454,9 @@ enable_breakpoints_after_startup (void)
 static struct breakpoint *
 new_single_step_breakpoint (int thread, struct gdbarch *gdbarch)
 {
 static struct breakpoint *
 new_single_step_breakpoint (int thread, struct gdbarch *gdbarch)
 {
-  struct breakpoint *b = new breakpoint ();
+  std::unique_ptr<breakpoint> b (new breakpoint ());
 
 
-  init_raw_breakpoint_without_location (b, gdbarch, bp_single_step,
+  init_raw_breakpoint_without_location (b.get (), gdbarch, bp_single_step,
                                        &momentary_breakpoint_ops);
 
   b->disposition = disp_donttouch;
                                        &momentary_breakpoint_ops);
 
   b->disposition = disp_donttouch;
@@ -8831,16 +8465,14 @@ new_single_step_breakpoint (int thread, struct gdbarch *gdbarch)
   b->thread = thread;
   gdb_assert (b->thread != 0);
 
   b->thread = thread;
   gdb_assert (b->thread != 0);
 
-  add_to_breakpoint_chain (b);
-
-  return b;
+  return add_to_breakpoint_chain (std::move (b));
 }
 
 /* Set a momentary breakpoint of type TYPE at address specified by
    SAL.  If FRAME_ID is valid, the breakpoint is restricted to that
    frame.  */
 
 }
 
 /* Set a momentary breakpoint of type TYPE at address specified by
    SAL.  If FRAME_ID is valid, the breakpoint is restricted to that
    frame.  */
 
-struct breakpoint *
+breakpoint_up
 set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal,
                          struct frame_id frame_id, enum bptype type)
 {
 set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal,
                          struct frame_id frame_id, enum bptype type)
 {
@@ -8855,15 +8487,11 @@ set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal,
   b->disposition = disp_donttouch;
   b->frame_id = frame_id;
 
   b->disposition = disp_donttouch;
   b->frame_id = frame_id;
 
-  /* If we're debugging a multi-threaded program, then we want
-     momentary breakpoints to be active in only a single thread of
-     control.  */
-  if (in_thread_list (inferior_ptid))
-    b->thread = ptid_to_global_thread_id (inferior_ptid);
+  b->thread = inferior_thread ()->global_num;
 
   update_global_location_list_nothrow (UGLL_MAY_INSERT);
 
 
   update_global_location_list_nothrow (UGLL_MAY_INSERT);
 
-  return b;
+  return breakpoint_up (b);
 }
 
 /* Make a momentary breakpoint based on the master breakpoint ORIG.
 }
 
 /* Make a momentary breakpoint based on the master breakpoint ORIG.
@@ -8916,7 +8544,7 @@ clone_momentary_breakpoint (struct breakpoint *orig)
   return momentary_breakpoint_from_master (orig, orig->type, orig->ops, 0);
 }
 
   return momentary_breakpoint_from_master (orig, orig->type, orig->ops, 0);
 }
 
-struct breakpoint *
+breakpoint_up
 set_momentary_breakpoint_at_pc (struct gdbarch *gdbarch, CORE_ADDR pc,
                                enum bptype type)
 {
 set_momentary_breakpoint_at_pc (struct gdbarch *gdbarch, CORE_ADDR pc,
                                enum bptype type)
 {
@@ -8937,9 +8565,7 @@ static void
 mention (struct breakpoint *b)
 {
   b->ops->print_mention (b);
 mention (struct breakpoint *b)
 {
   b->ops->print_mention (b);
-  if (current_uiout->is_mi_like_p ())
-    return;
-  printf_filtered ("\n");
+  current_uiout->text ("\n");
 }
 \f
 
 }
 \f
 
@@ -8976,13 +8602,16 @@ add_location_to_breakpoint (struct breakpoint *b,
   loc->requested_address = sal->pc;
   loc->address = adjusted_address;
   loc->pspace = sal->pspace;
   loc->requested_address = sal->pc;
   loc->address = adjusted_address;
   loc->pspace = sal->pspace;
-  loc->probe.probe = sal->probe;
+  loc->probe.prob = sal->prob;
   loc->probe.objfile = sal->objfile;
   gdb_assert (loc->pspace != NULL);
   loc->section = sal->section;
   loc->gdbarch = loc_gdbarch;
   loc->line_number = sal->line;
   loc->symtab = sal->symtab;
   loc->probe.objfile = sal->objfile;
   gdb_assert (loc->pspace != NULL);
   loc->section = sal->section;
   loc->gdbarch = loc_gdbarch;
   loc->line_number = sal->line;
   loc->symtab = sal->symtab;
+  loc->symbol = sal->symbol;
+  loc->msymbol = sal->msymbol;
+  loc->objfile = sal->objfile;
 
   set_breakpoint_location_function (loc,
                                    sal->explicit_pc || sal->explicit_line);
 
   set_breakpoint_location_function (loc,
                                    sal->explicit_pc || sal->explicit_line);
@@ -9016,8 +8645,6 @@ program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
   CORE_ADDR addr;
   const gdb_byte *bpoint;
   gdb_byte *target_mem;
   CORE_ADDR addr;
   const gdb_byte *bpoint;
   gdb_byte *target_mem;
-  struct cleanup *cleanup;
-  int retval = 0;
 
   addr = address;
   bpoint = gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
 
   addr = address;
   bpoint = gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
@@ -9031,15 +8658,14 @@ program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
   /* Enable the automatic memory restoration from breakpoints while
      we read the memory.  Otherwise we could say about our temporary
      breakpoints they are permanent.  */
   /* Enable the automatic memory restoration from breakpoints while
      we read the memory.  Otherwise we could say about our temporary
      breakpoints they are permanent.  */
-  cleanup = make_show_memory_breakpoints_cleanup (0);
+  scoped_restore restore_memory
+    = make_scoped_restore_show_memory_breakpoints (0);
 
   if (target_read_memory (address, target_mem, len) == 0
       && memcmp (target_mem, bpoint, len) == 0)
 
   if (target_read_memory (address, target_mem, len) == 0
       && memcmp (target_mem, bpoint, len) == 0)
-    retval = 1;
-
-  do_cleanups (cleanup);
+    return 1;
 
 
-  return retval;
+  return 0;
 }
 
 /* Return 1 if LOC is pointing to a permanent breakpoint,
 }
 
 /* Return 1 if LOC is pointing to a permanent breakpoint,
@@ -9117,25 +8743,19 @@ update_dprintf_command_list (struct breakpoint *b)
                    _("Invalid dprintf style."));
 
   gdb_assert (printf_line != NULL);
                    _("Invalid dprintf style."));
 
   gdb_assert (printf_line != NULL);
-  /* Manufacture a printf sequence.  */
-  {
-    struct command_line *printf_cmd_line = XNEW (struct command_line);
-
-    printf_cmd_line->control_type = simple_control;
-    printf_cmd_line->body_count = 0;
-    printf_cmd_line->body_list = NULL;
-    printf_cmd_line->next = NULL;
-    printf_cmd_line->line = printf_line;
 
 
-    breakpoint_set_commands (b, command_line_up (printf_cmd_line));
-  }
+  /* Manufacture a printf sequence.  */
+  struct command_line *printf_cmd_line
+    = new struct command_line (simple_control, printf_line);
+  breakpoint_set_commands (b, counted_command_line (printf_cmd_line,
+                                                   command_lines_deleter ()));
 }
 
 /* Update all dprintf commands, making their command lists reflect
    current style settings.  */
 
 static void
 }
 
 /* Update all dprintf commands, making their command lists reflect
    current style settings.  */
 
 static void
-update_dprintf_commands (char *args, int from_tty,
+update_dprintf_commands (const char *args, int from_tty,
                         struct cmd_list_element *c)
 {
   struct breakpoint *b;
                         struct cmd_list_element *c)
 {
   struct breakpoint *b;
@@ -9154,7 +8774,7 @@ update_dprintf_commands (char *args, int from_tty,
 
 static void
 init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
 
 static void
 init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
-                    struct symtabs_and_lines sals,
+                    gdb::array_view<const symtab_and_line> sals,
                     event_location_up &&location,
                     gdb::unique_xmalloc_ptr<char> filter,
                     gdb::unique_xmalloc_ptr<char> cond_string,
                     event_location_up &&location,
                     gdb::unique_xmalloc_ptr<char> filter,
                     gdb::unique_xmalloc_ptr<char> cond_string,
@@ -9181,11 +8801,10 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
        error (_("Hardware breakpoints used exceeds limit."));
     }
 
        error (_("Hardware breakpoints used exceeds limit."));
     }
 
-  gdb_assert (sals.nelts > 0);
+  gdb_assert (!sals.empty ());
 
 
-  for (i = 0; i < sals.nelts; ++i)
+  for (const auto &sal : sals)
     {
     {
-      struct symtab_and_line sal = sals.sals[i];
       struct bp_location *loc;
 
       if (from_tty)
       struct bp_location *loc;
 
       if (from_tty)
@@ -9198,7 +8817,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
                                      sal.pspace, sal.pc, sal.section, thread);
        }
 
                                      sal.pspace, sal.pc, sal.section, thread);
        }
 
-      if (i == 0)
+      if (&sal == &sals[0])
        {
          init_raw_breakpoint (b, gdbarch, sal, type, ops);
          b->thread = thread;
        {
          init_raw_breakpoint (b, gdbarch, sal, type, ops);
          b->thread = thread;
@@ -9225,27 +8844,24 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
                  const char *p
                    = &event_location_to_string (b->location.get ())[3];
                  const char *endp;
                  const char *p
                    = &event_location_to_string (b->location.get ())[3];
                  const char *endp;
-                 char *marker_str;
 
 
-                 p = skip_spaces_const (p);
+                 p = skip_spaces (p);
 
 
-                 endp = skip_to_space_const (p);
+                 endp = skip_to_space (p);
 
 
-                 marker_str = savestring (p, endp - p);
-                 t->static_trace_marker_id = marker_str;
+                 t->static_trace_marker_id.assign (p, endp - p);
 
                  printf_filtered (_("Probed static tracepoint "
                                     "marker \"%s\"\n"),
 
                  printf_filtered (_("Probed static tracepoint "
                                     "marker \"%s\"\n"),
-                                  t->static_trace_marker_id);
+                                  t->static_trace_marker_id.c_str ());
                }
              else if (target_static_tracepoint_marker_at (sal.pc, &marker))
                {
                }
              else if (target_static_tracepoint_marker_at (sal.pc, &marker))
                {
-                 t->static_trace_marker_id = xstrdup (marker.str_id);
-                 release_static_tracepoint_marker (&marker);
+                 t->static_trace_marker_id = std::move (marker.str_id);
 
                  printf_filtered (_("Probed static tracepoint "
                                     "marker \"%s\"\n"),
 
                  printf_filtered (_("Probed static tracepoint "
                                     "marker \"%s\"\n"),
-                                  t->static_trace_marker_id);
+                                  t->static_trace_marker_id.c_str ());
                }
              else
                warning (_("Couldn't determine the static "
                }
              else
                warning (_("Couldn't determine the static "
@@ -9294,7 +8910,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
 
 static void
 create_breakpoint_sal (struct gdbarch *gdbarch,
 
 static void
 create_breakpoint_sal (struct gdbarch *gdbarch,
-                      struct symtabs_and_lines sals,
+                      gdb::array_view<const symtab_and_line> sals,
                       event_location_up &&location,
                       gdb::unique_xmalloc_ptr<char> filter,
                       gdb::unique_xmalloc_ptr<char> cond_string,
                       event_location_up &&location,
                       gdb::unique_xmalloc_ptr<char> filter,
                       gdb::unique_xmalloc_ptr<char> cond_string,
@@ -9318,7 +8934,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
                       enabled, internal, flags,
                       display_canonical);
 
                       enabled, internal, flags,
                       display_canonical);
 
-  install_breakpoint (internal, b.release (), 0);
+  install_breakpoint (internal, std::move (b), 0);
 }
 
 /* Add SALS.nelts breakpoints to the breakpoint table.  For each
 }
 
 /* Add SALS.nelts breakpoints to the breakpoint table.  For each
@@ -9346,13 +8962,10 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
                        const struct breakpoint_ops *ops, int from_tty,
                        int enabled, int internal, unsigned flags)
 {
                        const struct breakpoint_ops *ops, int from_tty,
                        int enabled, int internal, unsigned flags)
 {
-  int i;
-  struct linespec_sals *lsal;
-
   if (canonical->pre_expanded)
   if (canonical->pre_expanded)
-    gdb_assert (VEC_length (linespec_sals, canonical->sals) == 1);
+    gdb_assert (canonical->lsals.size () == 1);
 
 
-  for (i = 0; VEC_iterate (linespec_sals, canonical->sals, i, lsal); ++i)
+  for (const auto &lsal : canonical->lsals)
     {
       /* Note that 'location' can be NULL in the case of a plain
         'break', without arguments.  */
     {
       /* Note that 'location' can be NULL in the case of a plain
         'break', without arguments.  */
@@ -9360,9 +8973,9 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
        = (canonical->location != NULL
           ? copy_event_location (canonical->location.get ()) : NULL);
       gdb::unique_xmalloc_ptr<char> filter_string
        = (canonical->location != NULL
           ? copy_event_location (canonical->location.get ()) : NULL);
       gdb::unique_xmalloc_ptr<char> filter_string
-       (lsal->canonical != NULL ? xstrdup (lsal->canonical) : NULL);
+       (lsal.canonical != NULL ? xstrdup (lsal.canonical) : NULL);
 
 
-      create_breakpoint_sal (gdbarch, lsal->sals,
+      create_breakpoint_sal (gdbarch, lsal.sals,
                             std::move (location),
                             std::move (filter_string),
                             std::move (cond_string),
                             std::move (location),
                             std::move (filter_string),
                             std::move (cond_string),
@@ -9390,28 +9003,22 @@ parse_breakpoint_sals (const struct event_location *location,
 
   if (event_location_type (location) == LINESPEC_LOCATION)
     {
 
   if (event_location_type (location) == LINESPEC_LOCATION)
     {
-      const char *address = get_linespec_location (location);
+      const char *spec = get_linespec_location (location)->spec_string;
 
 
-      if (address == NULL)
+      if (spec == NULL)
        {
          /* The last displayed codepoint, if it's valid, is our default
             breakpoint address.  */
          if (last_displayed_sal_is_valid ())
            {
        {
          /* The last displayed codepoint, if it's valid, is our default
             breakpoint address.  */
          if (last_displayed_sal_is_valid ())
            {
-             struct linespec_sals lsal;
-             struct symtab_and_line sal;
-             CORE_ADDR pc;
-
-             init_sal (&sal);          /* Initialize to zeroes.  */
-             lsal.sals.sals = XNEW (struct symtab_and_line);
-
              /* Set sal's pspace, pc, symtab, and line to the values
                 corresponding to the last call to print_frame_info.
                 Be sure to reinitialize LINE with NOTCURRENT == 0
                 as the breakpoint line number is inappropriate otherwise.
                 find_pc_line would adjust PC, re-set it back.  */
              /* Set sal's pspace, pc, symtab, and line to the values
                 corresponding to the last call to print_frame_info.
                 Be sure to reinitialize LINE with NOTCURRENT == 0
                 as the breakpoint line number is inappropriate otherwise.
                 find_pc_line would adjust PC, re-set it back.  */
-             get_last_displayed_sal (&sal);
-             pc = sal.pc;
+             symtab_and_line sal = get_last_displayed_sal ();
+             CORE_ADDR pc = sal.pc;
+
              sal = find_pc_line (pc, 0);
 
              /* "break" without arguments is equivalent to "break *PC"
              sal = find_pc_line (pc, 0);
 
              /* "break" without arguments is equivalent to "break *PC"
@@ -9422,11 +9029,11 @@ parse_breakpoint_sals (const struct event_location *location,
              sal.pc = pc;
              sal.explicit_pc = 1;
 
              sal.pc = pc;
              sal.explicit_pc = 1;
 
-             lsal.sals.sals[0] = sal;
-             lsal.sals.nelts = 1;
+             struct linespec_sals lsal;
+             lsal.sals = {sal};
              lsal.canonical = NULL;
 
              lsal.canonical = NULL;
 
-             VEC_safe_push (linespec_sals, canonical->sals, &lsal);
+             canonical->lsals.push_back (std::move (lsal));
              return;
            }
          else
              return;
            }
          else
@@ -9444,15 +9051,15 @@ parse_breakpoint_sals (const struct event_location *location,
   cursal = get_current_source_symtab_and_line ();
   if (last_displayed_sal_is_valid ())
     {
   cursal = get_current_source_symtab_and_line ();
   if (last_displayed_sal_is_valid ())
     {
-      const char *address = NULL;
+      const char *spec = NULL;
 
       if (event_location_type (location) == LINESPEC_LOCATION)
 
       if (event_location_type (location) == LINESPEC_LOCATION)
-       address = get_linespec_location (location);
+       spec = get_linespec_location (location)->spec_string;
 
       if (!cursal.symtab
 
       if (!cursal.symtab
-         || (address != NULL
-             && strchr ("+-", address[0]) != NULL
-             && address[1] != '['))
+         || (spec != NULL
+             && strchr ("+-", spec[0]) != NULL
+             && spec[1] != '['))
        {
          decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, NULL,
                            get_last_displayed_symtab (),
        {
          decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, NULL,
                            get_last_displayed_symtab (),
@@ -9471,12 +9078,10 @@ parse_breakpoint_sals (const struct event_location *location,
    inserted as a breakpoint.  If it can't throw an error.  */
 
 static void
    inserted as a breakpoint.  If it can't throw an error.  */
 
 static void
-breakpoint_sals_to_pc (struct symtabs_and_lines *sals)
+breakpoint_sals_to_pc (std::vector<symtab_and_line> &sals)
 {    
 {    
-  int i;
-
-  for (i = 0; i < sals->nelts; i++)
-    resolve_sal_pc (&sals->sals[i]);
+  for (auto &sal : sals)
+    resolve_sal_pc (&sal);
 }
 
 /* Fast tracepoints may have restrictions on valid locations.  For
 }
 
 /* Fast tracepoints may have restrictions on valid locations.  For
@@ -9488,32 +9093,21 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals)
 
 static void
 check_fast_tracepoint_sals (struct gdbarch *gdbarch,
 
 static void
 check_fast_tracepoint_sals (struct gdbarch *gdbarch,
-                           struct symtabs_and_lines *sals)
+                           gdb::array_view<const symtab_and_line> sals)
 {
 {
-  int i, rslt;
-  struct symtab_and_line *sal;
-  char *msg;
-  struct cleanup *old_chain;
-
-  for (i = 0; i < sals->nelts; i++)
+  for (const auto &sal : sals)
     {
       struct gdbarch *sarch;
 
     {
       struct gdbarch *sarch;
 
-      sal = &sals->sals[i];
-
-      sarch = get_sal_arch (*sal);
+      sarch = get_sal_arch (sal);
       /* We fall back to GDBARCH if there is no architecture
         associated with SAL.  */
       if (sarch == NULL)
        sarch = gdbarch;
       /* We fall back to GDBARCH if there is no architecture
         associated with SAL.  */
       if (sarch == NULL)
        sarch = gdbarch;
-      rslt = gdbarch_fast_tracepoint_valid_at (sarch, sal->pc, &msg);
-      old_chain = make_cleanup (xfree, msg);
-
-      if (!rslt)
+      std::string msg;
+      if (!gdbarch_fast_tracepoint_valid_at (sarch, sal.pc, &msg))
        error (_("May not have a fast tracepoint at %s%s"),
        error (_("May not have a fast tracepoint at %s%s"),
-              paddress (sarch, sal->pc), (msg ? msg : ""));
-
-      do_cleanups (old_chain);
+              paddress (sarch, sal.pc), msg.c_str ());
     }
 }
 
     }
 }
 
@@ -9541,7 +9135,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
       const char *cond_start = NULL;
       const char *cond_end = NULL;
 
       const char *cond_start = NULL;
       const char *cond_end = NULL;
 
-      tok = skip_spaces_const (tok);
+      tok = skip_spaces (tok);
 
       if ((*tok == '"' || *tok == ',') && rest)
        {
 
       if ((*tok == '"' || *tok == ',') && rest)
        {
@@ -9549,7 +9143,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
          return;
        }
 
          return;
        }
 
-      end_tok = skip_to_space_const (tok);
+      end_tok = skip_to_space (tok);
 
       toklen = end_tok - tok;
 
 
       toklen = end_tok - tok;
 
@@ -9596,46 +9190,33 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
 
 /* Decode a static tracepoint marker spec.  */
 
 
 /* Decode a static tracepoint marker spec.  */
 
-static struct symtabs_and_lines
+static std::vector<symtab_and_line>
 decode_static_tracepoint_spec (const char **arg_p)
 {
 decode_static_tracepoint_spec (const char **arg_p)
 {
-  VEC(static_tracepoint_marker_p) *markers = NULL;
-  struct symtabs_and_lines sals;
-  struct cleanup *old_chain;
   const char *p = &(*arg_p)[3];
   const char *endp;
   const char *p = &(*arg_p)[3];
   const char *endp;
-  char *marker_str;
-  int i;
 
 
-  p = skip_spaces_const (p);
+  p = skip_spaces (p);
 
 
-  endp = skip_to_space_const (p);
+  endp = skip_to_space (p);
 
 
-  marker_str = savestring (p, endp - p);
-  old_chain = make_cleanup (xfree, marker_str);
+  std::string marker_str (p, endp - p);
 
 
-  markers = target_static_tracepoint_markers_by_strid (marker_str);
-  if (VEC_empty(static_tracepoint_marker_p, markers))
-    error (_("No known static tracepoint marker named %s"), marker_str);
+  std::vector<static_tracepoint_marker> markers
+    = target_static_tracepoint_markers_by_strid (marker_str.c_str ());
+  if (markers.empty ())
+    error (_("No known static tracepoint marker named %s"),
+          marker_str.c_str ());
 
 
-  sals.nelts = VEC_length(static_tracepoint_marker_p, markers);
-  sals.sals = XNEWVEC (struct symtab_and_line, sals.nelts);
+  std::vector<symtab_and_line> sals;
+  sals.reserve (markers.size ());
 
 
-  for (i = 0; i < sals.nelts; i++)
+  for (const static_tracepoint_marker &marker : markers)
     {
     {
-      struct static_tracepoint_marker *marker;
-
-      marker = VEC_index (static_tracepoint_marker_p, markers, i);
-
-      init_sal (&sals.sals[i]);
-
-      sals.sals[i] = find_pc_line (marker->address, 0);
-      sals.sals[i].pc = marker->address;
-
-      release_static_tracepoint_marker (marker);
-    }
-
-  do_cleanups (old_chain);
+      symtab_and_line sal = find_pc_line (marker.address, 0);
+      sal.pc = marker.address;
+      sals.push_back (sal);
+   }
 
   *arg_p = endp;
   return sals;
 
   *arg_p = endp;
   return sals;
@@ -9704,7 +9285,7 @@ create_breakpoint (struct gdbarch *gdbarch,
     }
   END_CATCH
 
     }
   END_CATCH
 
-  if (!pending && VEC_empty (linespec_sals, canonical.sals))
+  if (!pending && canonical.lsals.empty ())
     return 0;
 
   /* ----------------------------- SNIP -----------------------------
     return 0;
 
   /* ----------------------------- SNIP -----------------------------
@@ -9717,21 +9298,15 @@ create_breakpoint (struct gdbarch *gdbarch,
      are ok for the target.  */
   if (!pending)
     {
      are ok for the target.  */
   if (!pending)
     {
-      int ix;
-      struct linespec_sals *iter;
-
-      for (ix = 0; VEC_iterate (linespec_sals, canonical.sals, ix, iter); ++ix)
-       breakpoint_sals_to_pc (&iter->sals);
+      for (auto &lsal : canonical.lsals)
+       breakpoint_sals_to_pc (lsal.sals);
     }
 
   /* Fast tracepoints may have additional restrictions on location.  */
   if (!pending && type_wanted == bp_fast_tracepoint)
     {
     }
 
   /* Fast tracepoints may have additional restrictions on location.  */
   if (!pending && type_wanted == bp_fast_tracepoint)
     {
-      int ix;
-      struct linespec_sals *iter;
-
-      for (ix = 0; VEC_iterate (linespec_sals, canonical.sals, ix, iter); ++ix)
-       check_fast_tracepoint_sals (gdbarch, &iter->sals);
+      for (const auto &lsal : canonical.lsals)
+       check_fast_tracepoint_sals (gdbarch, lsal.sals);
     }
 
   /* Verify that condition can be parsed, before setting any
     }
 
   /* Verify that condition can be parsed, before setting any
@@ -9746,16 +9321,15 @@ create_breakpoint (struct gdbarch *gdbarch,
         {
          char *rest;
          char *cond;
         {
          char *rest;
          char *cond;
-         struct linespec_sals *lsal;
 
 
-         lsal = VEC_index (linespec_sals, canonical.sals, 0);
+         const linespec_sals &lsal = canonical.lsals[0];
 
          /* Here we only parse 'arg' to separate condition
             from thread number, so parsing in context of first
             sal is OK.  When setting the breakpoint we'll
             re-parse it in context of each sal.  */
 
 
          /* Here we only parse 'arg' to separate condition
             from thread number, so parsing in context of first
             sal is OK.  When setting the breakpoint we'll
             re-parse it in context of each sal.  */
 
-         find_condition_and_thread (extra_string, lsal->sals.sals[0].pc,
+         find_condition_and_thread (extra_string, lsal.sals[0].pc,
                                     &cond, &thread, &task, &rest);
          cond_string_copy.reset (cond);
          extra_string_copy.reset (rest);
                                     &cond, &thread, &task, &rest);
          cond_string_copy.reset (cond);
          extra_string_copy.reset (rest);
@@ -9808,10 +9382,10 @@ create_breakpoint (struct gdbarch *gdbarch,
            && type_wanted != bp_hardware_breakpoint) || thread != -1)
        b->pspace = current_program_space;
 
            && type_wanted != bp_hardware_breakpoint) || thread != -1)
        b->pspace = current_program_space;
 
-      install_breakpoint (internal, b.release (), 0);
+      install_breakpoint (internal, std::move (b), 0);
     }
   
     }
   
-  if (VEC_length (linespec_sals, canonical.sals) > 1)
+  if (canonical.lsals.size () > 1)
     {
       warning (_("Multiple breakpoints were set.\nUse the "
                 "\"delete\" command to delete unwanted breakpoints."));
     {
       warning (_("Multiple breakpoints were set.\nUse the "
                 "\"delete\" command to delete unwanted breakpoints."));
@@ -9836,7 +9410,7 @@ create_breakpoint (struct gdbarch *gdbarch,
    and BP_TEMPFLAG.  */
 
 static void
    and BP_TEMPFLAG.  */
 
 static void
-break_command_1 (char *arg, int flag, int from_tty)
+break_command_1 (const char *arg, int flag, int from_tty)
 {
   int tempflag = flag & BP_TEMPFLAG;
   enum bptype type_wanted = (flag & BP_HARDWAREFLAG
 {
   int tempflag = flag & BP_TEMPFLAG;
   enum bptype type_wanted = (flag & BP_HARDWAREFLAG
@@ -9922,31 +9496,31 @@ resolve_sal_pc (struct symtab_and_line *sal)
 }
 
 void
 }
 
 void
-break_command (char *arg, int from_tty)
+break_command (const char *arg, int from_tty)
 {
   break_command_1 (arg, 0, from_tty);
 }
 
 void
 {
   break_command_1 (arg, 0, from_tty);
 }
 
 void
-tbreak_command (char *arg, int from_tty)
+tbreak_command (const char *arg, int from_tty)
 {
   break_command_1 (arg, BP_TEMPFLAG, from_tty);
 }
 
 static void
 {
   break_command_1 (arg, BP_TEMPFLAG, from_tty);
 }
 
 static void
-hbreak_command (char *arg, int from_tty)
+hbreak_command (const char *arg, int from_tty)
 {
   break_command_1 (arg, BP_HARDWAREFLAG, from_tty);
 }
 
 static void
 {
   break_command_1 (arg, BP_HARDWAREFLAG, from_tty);
 }
 
 static void
-thbreak_command (char *arg, int from_tty)
+thbreak_command (const char *arg, int from_tty)
 {
   break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty);
 }
 
 static void
 {
   break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty);
 }
 
 static void
-stop_command (char *arg, int from_tty)
+stop_command (const char *arg, int from_tty)
 {
   printf_filtered (_("Specify the type of breakpoint to set.\n\
 Usage: stop in <function | address>\n\
 {
   printf_filtered (_("Specify the type of breakpoint to set.\n\
 Usage: stop in <function | address>\n\
@@ -9954,7 +9528,7 @@ Usage: stop in <function | address>\n\
 }
 
 static void
 }
 
 static void
-stopin_command (char *arg, int from_tty)
+stopin_command (const char *arg, int from_tty)
 {
   int badInput = 0;
 
 {
   int badInput = 0;
 
@@ -9962,7 +9536,7 @@ stopin_command (char *arg, int from_tty)
     badInput = 1;
   else if (*arg != '*')
     {
     badInput = 1;
   else if (*arg != '*')
     {
-      char *argptr = arg;
+      const char *argptr = arg;
       int hasColon = 0;
 
       /* Look for a ':'.  If this is a line number specification, then
       int hasColon = 0;
 
       /* Look for a ':'.  If this is a line number specification, then
@@ -9987,7 +9561,7 @@ stopin_command (char *arg, int from_tty)
 }
 
 static void
 }
 
 static void
-stopat_command (char *arg, int from_tty)
+stopat_command (const char *arg, int from_tty)
 {
   int badInput = 0;
 
 {
   int badInput = 0;
 
@@ -9995,7 +9569,7 @@ stopat_command (char *arg, int from_tty)
     badInput = 1;
   else
     {
     badInput = 1;
   else
     {
-      char *argptr = arg;
+      const char *argptr = arg;
       int hasColon = 0;
 
       /* Look for a ':'.  If there is a '::' then get out, otherwise
       int hasColon = 0;
 
       /* Look for a ':'.  If there is a '::' then get out, otherwise
@@ -10013,7 +9587,7 @@ stopat_command (char *arg, int from_tty)
     }
 
   if (badInput)
     }
 
   if (badInput)
-    printf_filtered (_("Usage: stop at <line>\n"));
+    printf_filtered (_("Usage: stop at LINE\n"));
   else
     break_command_1 (arg, 0, from_tty);
 }
   else
     break_command_1 (arg, 0, from_tty);
 }
@@ -10024,7 +9598,7 @@ stopat_command (char *arg, int from_tty)
    line.  */
 
 static void
    line.  */
 
 static void
-dprintf_command (char *arg, int from_tty)
+dprintf_command (const char *arg, int from_tty)
 {
   event_location_up location = string_to_event_location (&arg, current_language);
 
 {
   event_location_up location = string_to_event_location (&arg, current_language);
 
@@ -10055,7 +9629,7 @@ dprintf_command (char *arg, int from_tty)
 }
 
 static void
 }
 
 static void
-agent_printf_command (char *arg, int from_tty)
+agent_printf_command (const char *arg, int from_tty)
 {
   error (_("May only run agent-printf on the target"));
 }
 {
   error (_("May only run agent-printf on the target"));
 }
@@ -10065,7 +9639,7 @@ agent_printf_command (char *arg, int from_tty)
 
 static int
 breakpoint_hit_ranged_breakpoint (const struct bp_location *bl,
 
 static int
 breakpoint_hit_ranged_breakpoint (const struct bp_location *bl,
-                                 struct address_space *aspace,
+                                 const address_space *aspace,
                                  CORE_ADDR bp_addr,
                                  const struct target_waitstatus *ws)
 {
                                  CORE_ADDR bp_addr,
                                  const struct target_waitstatus *ws)
 {
@@ -10182,12 +9756,9 @@ print_mention_ranged_breakpoint (struct breakpoint *b)
   gdb_assert (bl);
   gdb_assert (b->type == bp_hardware_breakpoint);
 
   gdb_assert (bl);
   gdb_assert (b->type == bp_hardware_breakpoint);
 
-  if (uiout->is_mi_like_p ())
-    return;
-
-  printf_filtered (_("Hardware assisted ranged breakpoint %d from %s to %s."),
-                  b->number, paddress (bl->gdbarch, bl->address),
-                  paddress (bl->gdbarch, bl->address + bl->length - 1));
+  uiout->message (_("Hardware assisted ranged breakpoint %d from %s to %s."),
+                 b->number, paddress (bl->gdbarch, bl->address),
+                 paddress (bl->gdbarch, bl->address + bl->length - 1));
 }
 
 /* Implement the "print_recreate" breakpoint_ops method for
 }
 
 /* Implement the "print_recreate" breakpoint_ops method for
@@ -10239,16 +9810,13 @@ find_breakpoint_range_end (struct symtab_and_line sal)
 /* Implement the "break-range" CLI command.  */
 
 static void
 /* Implement the "break-range" CLI command.  */
 
 static void
-break_range_command (char *arg, int from_tty)
+break_range_command (const char *arg, int from_tty)
 {
 {
-  char *arg_start, *addr_string_start;
+  const char *arg_start;
   struct linespec_result canonical_start, canonical_end;
   int bp_count, can_use_bp, length;
   CORE_ADDR end;
   struct breakpoint *b;
   struct linespec_result canonical_start, canonical_end;
   int bp_count, can_use_bp, length;
   CORE_ADDR end;
   struct breakpoint *b;
-  struct symtab_and_line sal_start, sal_end;
-  struct cleanup *cleanup_bkpt;
-  struct linespec_sals *lsal_start, *lsal_end;
 
   /* We don't support software ranged breakpoints.  */
   if (target_ranged_break_num_registers () < 0)
 
   /* We don't support software ranged breakpoints.  */
   if (target_ranged_break_num_registers () < 0)
@@ -10272,18 +9840,17 @@ break_range_command (char *arg, int from_tty)
 
   if (arg[0] != ',')
     error (_("Too few arguments."));
 
   if (arg[0] != ',')
     error (_("Too few arguments."));
-  else if (VEC_empty (linespec_sals, canonical_start.sals))
+  else if (canonical_start.lsals.empty ())
     error (_("Could not find location of the beginning of the range."));
 
     error (_("Could not find location of the beginning of the range."));
 
-  lsal_start = VEC_index (linespec_sals, canonical_start.sals, 0);
+  const linespec_sals &lsal_start = canonical_start.lsals[0];
 
 
-  if (VEC_length (linespec_sals, canonical_start.sals) > 1
-      || lsal_start->sals.nelts != 1)
+  if (canonical_start.lsals.size () > 1
+      || lsal_start.sals.size () != 1)
     error (_("Cannot create a ranged breakpoint with multiple locations."));
 
     error (_("Cannot create a ranged breakpoint with multiple locations."));
 
-  sal_start = lsal_start->sals.sals[0];
-  addr_string_start = savestring (arg_start, arg - arg_start);
-  cleanup_bkpt = make_cleanup (xfree, addr_string_start);
+  const symtab_and_line &sal_start = lsal_start.sals[0];
+  std::string addr_string_start (arg_start, arg - arg_start);
 
   arg++;       /* Skip the comma.  */
   arg = skip_spaces (arg);
 
   arg++;       /* Skip the comma.  */
   arg = skip_spaces (arg);
@@ -10303,15 +9870,15 @@ break_range_command (char *arg, int from_tty)
                    sal_start.symtab, sal_start.line,
                    &canonical_end, NULL, NULL);
 
                    sal_start.symtab, sal_start.line,
                    &canonical_end, NULL, NULL);
 
-  if (VEC_empty (linespec_sals, canonical_end.sals))
+  if (canonical_end.lsals.empty ())
     error (_("Could not find location of the end of the range."));
 
     error (_("Could not find location of the end of the range."));
 
-  lsal_end = VEC_index (linespec_sals, canonical_end.sals, 0);
-  if (VEC_length (linespec_sals, canonical_end.sals) > 1
-      || lsal_end->sals.nelts != 1)
+  const linespec_sals &lsal_end = canonical_end.lsals[0];
+  if (canonical_end.lsals.size () > 1
+      || lsal_end.sals.size () != 1)
     error (_("Cannot create a ranged breakpoint with multiple locations."));
 
     error (_("Cannot create a ranged breakpoint with multiple locations."));
 
-  sal_end = lsal_end->sals.sals[0];
+  const symtab_and_line &sal_end = lsal_end.sals[0];
 
   end = find_breakpoint_range_end (sal_end);
   if (sal_start.pc > end)
 
   end = find_breakpoint_range_end (sal_end);
   if (sal_start.pc > end)
@@ -10325,9 +9892,7 @@ break_range_command (char *arg, int from_tty)
     {
       /* This range is simple enough to be handled by
         the `hbreak' command.  */
     {
       /* This range is simple enough to be handled by
         the `hbreak' command.  */
-      hbreak_command (addr_string_start, 1);
-
-      do_cleanups (cleanup_bkpt);
+      hbreak_command (&addr_string_start[0], 1);
 
       return;
     }
 
       return;
     }
@@ -10342,10 +9907,8 @@ break_range_command (char *arg, int from_tty)
   b->location_range_end = std::move (end_location);
   b->loc->length = length;
 
   b->location_range_end = std::move (end_location);
   b->loc->length = length;
 
-  do_cleanups (cleanup_bkpt);
-
   mention (b);
   mention (b);
-  observer_notify_breakpoint_created (b);
+  gdb::observers::breakpoint_created.notify (b);
   update_global_location_list (UGLL_MAY_INSERT);
 }
 
   update_global_location_list (UGLL_MAY_INSERT);
 }
 
@@ -10399,8 +9962,7 @@ watchpoint_exp_is_const (const struct expression *exp)
        case TERNOP_SLICE:
 
        case OP_LONG:
        case TERNOP_SLICE:
 
        case OP_LONG:
-       case OP_DOUBLE:
-       case OP_DECFLOAT:
+       case OP_FLOAT:
        case OP_LAST:
        case OP_COMPLEX:
        case OP_STRING:
        case OP_LAST:
        case OP_COMPLEX:
        case OP_STRING:
@@ -10469,7 +10031,6 @@ watchpoint::~watchpoint ()
 {
   xfree (this->exp_string);
   xfree (this->exp_string_reparse);
 {
   xfree (this->exp_string);
   xfree (this->exp_string_reparse);
-  value_free (this->val);
 }
 
 /* Implement the "re_set" breakpoint_ops method for watchpoints.  */
 }
 
 /* Implement the "re_set" breakpoint_ops method for watchpoints.  */
@@ -10533,7 +10094,7 @@ remove_watchpoint (struct bp_location *bl, enum remove_bp_reason reason)
 
 static int
 breakpoint_hit_watchpoint (const struct bp_location *bl,
 
 static int
 breakpoint_hit_watchpoint (const struct bp_location *bl,
-                          struct address_space *aspace, CORE_ADDR bp_addr,
+                          const address_space *aspace, CORE_ADDR bp_addr,
                           const struct target_waitstatus *ws)
 {
   struct breakpoint *b = bl->owner;
                           const struct target_waitstatus *ws)
 {
   struct breakpoint *b = bl->owner;
@@ -10585,7 +10146,6 @@ works_in_software_mode_watchpoint (const struct breakpoint *b)
 static enum print_stop_action
 print_it_watchpoint (bpstat bs)
 {
 static enum print_stop_action
 print_it_watchpoint (bpstat bs)
 {
-  struct cleanup *old_chain;
   struct breakpoint *b;
   enum print_stop_action result;
   struct watchpoint *w;
   struct breakpoint *b;
   enum print_stop_action result;
   struct watchpoint *w;
@@ -10596,13 +10156,12 @@ print_it_watchpoint (bpstat bs)
   b = bs->breakpoint_at;
   w = (struct watchpoint *) b;
 
   b = bs->breakpoint_at;
   w = (struct watchpoint *) b;
 
-  old_chain = make_cleanup (null_cleanup, NULL);
-
   annotate_watchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
 
   string_file stb;
 
   annotate_watchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
 
   string_file stb;
 
+  gdb::optional<ui_out_emit_tuple> tuple_emitter;
   switch (b->type)
     {
     case bp_watchpoint:
   switch (b->type)
     {
     case bp_watchpoint:
@@ -10611,12 +10170,12 @@ print_it_watchpoint (bpstat bs)
        uiout->field_string
          ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
       mention (b);
        uiout->field_string
          ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
       mention (b);
-      make_cleanup_ui_out_tuple_begin_end (uiout, "value");
+      tuple_emitter.emplace (uiout, "value");
       uiout->text ("\nOld value = ");
       uiout->text ("\nOld value = ");
-      watchpoint_value_print (bs->old_val, &stb);
+      watchpoint_value_print (bs->old_val.get (), &stb);
       uiout->field_stream ("old", stb);
       uiout->text ("\nNew value = ");
       uiout->field_stream ("old", stb);
       uiout->text ("\nNew value = ");
-      watchpoint_value_print (w->val, &stb);
+      watchpoint_value_print (w->val.get (), &stb);
       uiout->field_stream ("new", stb);
       uiout->text ("\n");
       /* More than one watchpoint may have been triggered.  */
       uiout->field_stream ("new", stb);
       uiout->text ("\n");
       /* More than one watchpoint may have been triggered.  */
@@ -10628,9 +10187,9 @@ print_it_watchpoint (bpstat bs)
        uiout->field_string
          ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
       mention (b);
        uiout->field_string
          ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
       mention (b);
-      make_cleanup_ui_out_tuple_begin_end (uiout, "value");
+      tuple_emitter.emplace (uiout, "value");
       uiout->text ("\nValue = ");
       uiout->text ("\nValue = ");
-      watchpoint_value_print (w->val, &stb);
+      watchpoint_value_print (w->val.get (), &stb);
       uiout->field_stream ("value", stb);
       uiout->text ("\n");
       result = PRINT_UNKNOWN;
       uiout->field_stream ("value", stb);
       uiout->text ("\n");
       result = PRINT_UNKNOWN;
@@ -10644,9 +10203,9 @@ print_it_watchpoint (bpstat bs)
              ("reason",
               async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
          mention (b);
              ("reason",
               async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
          mention (b);
-         make_cleanup_ui_out_tuple_begin_end (uiout, "value");
+         tuple_emitter.emplace (uiout, "value");
          uiout->text ("\nOld value = ");
          uiout->text ("\nOld value = ");
-         watchpoint_value_print (bs->old_val, &stb);
+         watchpoint_value_print (bs->old_val.get (), &stb);
          uiout->field_stream ("old", stb);
          uiout->text ("\nNew value = ");
        }
          uiout->field_stream ("old", stb);
          uiout->text ("\nNew value = ");
        }
@@ -10657,10 +10216,10 @@ print_it_watchpoint (bpstat bs)
            uiout->field_string
              ("reason",
               async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
            uiout->field_string
              ("reason",
               async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
-         make_cleanup_ui_out_tuple_begin_end (uiout, "value");
+         tuple_emitter.emplace (uiout, "value");
          uiout->text ("\nValue = ");
        }
          uiout->text ("\nValue = ");
        }
-      watchpoint_value_print (w->val, &stb);
+      watchpoint_value_print (w->val.get (), &stb);
       uiout->field_stream ("new", stb);
       uiout->text ("\n");
       result = PRINT_UNKNOWN;
       uiout->field_stream ("new", stb);
       uiout->text ("\n");
       result = PRINT_UNKNOWN;
@@ -10669,7 +10228,6 @@ print_it_watchpoint (bpstat bs)
       result = PRINT_UNKNOWN;
     }
 
       result = PRINT_UNKNOWN;
     }
 
-  do_cleanups (old_chain);
   return result;
 }
 
   return result;
 }
 
@@ -10956,7 +10514,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
 {
   struct breakpoint *scope_breakpoint = NULL;
   const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
 {
   struct breakpoint *scope_breakpoint = NULL;
   const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
-  struct value *val, *mark, *result;
+  struct value *result;
   int saved_bitpos = 0, saved_bitsize = 0;
   const char *exp_start = NULL;
   const char *exp_end = NULL;
   int saved_bitpos = 0, saved_bitsize = 0;
   const char *exp_start = NULL;
   const char *exp_end = NULL;
@@ -10971,9 +10529,6 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
      the hardware watchpoint.  */
   int use_mask = 0;
   CORE_ADDR mask = 0;
      the hardware watchpoint.  */
   int use_mask = 0;
   CORE_ADDR mask = 0;
-  struct watchpoint *w;
-  char *expression;
-  struct cleanup *back_to;
 
   /* Make sure that we actually have parameters to parse.  */
   if (arg != NULL && arg[0] != '\0')
 
   /* Make sure that we actually have parameters to parse.  */
   if (arg != NULL && arg[0] != '\0')
@@ -11061,10 +10616,9 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   /* Parse the rest of the arguments.  From here on out, everything
      is in terms of a newly allocated string instead of the original
      ARG.  */
   /* Parse the rest of the arguments.  From here on out, everything
      is in terms of a newly allocated string instead of the original
      ARG.  */
-  innermost_block = NULL;
-  expression = savestring (arg, exp_end - arg);
-  back_to = make_cleanup (xfree, expression);
-  exp_start = arg = expression;
+  innermost_block.reset ();
+  std::string expression (arg, exp_end - arg);
+  exp_start = arg = expression.c_str ();
   expression_up exp = parse_exp_1 (&arg, 0, 0, 0);
   exp_end = arg;
   /* Remove trailing whitespace from the expression before saving it.
   expression_up exp = parse_exp_1 (&arg, 0, 0, 0);
   exp_end = arg;
   /* Remove trailing whitespace from the expression before saving it.
@@ -11084,28 +10638,30 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
       error (_("Cannot watch constant value `%.*s'."), len, exp_start);
     }
 
       error (_("Cannot watch constant value `%.*s'."), len, exp_start);
     }
 
-  exp_valid_block = innermost_block;
-  mark = value_mark ();
-  fetch_subexp_value (exp.get (), &pc, &val, &result, NULL, just_location);
+  exp_valid_block = innermost_block.block ();
+  struct value *mark = value_mark ();
+  struct value *val_as_value = nullptr;
+  fetch_subexp_value (exp.get (), &pc, &val_as_value, &result, NULL,
+                     just_location);
 
 
-  if (val != NULL && just_location)
+  if (val_as_value != NULL && just_location)
     {
     {
-      saved_bitpos = value_bitpos (val);
-      saved_bitsize = value_bitsize (val);
+      saved_bitpos = value_bitpos (val_as_value);
+      saved_bitsize = value_bitsize (val_as_value);
     }
 
     }
 
+  value_ref_ptr val;
   if (just_location)
     {
       int ret;
 
       exp_valid_block = NULL;
   if (just_location)
     {
       int ret;
 
       exp_valid_block = NULL;
-      val = value_addr (result);
-      release_value (val);
+      val = release_value (value_addr (result));
       value_free_to_mark (mark);
 
       if (use_mask)
        {
       value_free_to_mark (mark);
 
       if (use_mask)
        {
-         ret = target_masked_watch_num_registers (value_as_address (val),
+         ret = target_masked_watch_num_registers (value_as_address (val.get ()),
                                                   mask);
          if (ret == -1)
            error (_("This target does not support masked watchpoints."));
                                                   mask);
          if (ret == -1)
            error (_("This target does not support masked watchpoints."));
@@ -11113,22 +10669,22 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
            error (_("Invalid mask or memory region."));
        }
     }
            error (_("Invalid mask or memory region."));
        }
     }
-  else if (val != NULL)
-    release_value (val);
+  else if (val_as_value != NULL)
+    val = release_value (val_as_value);
 
 
-  tok = skip_spaces_const (arg);
-  end_tok = skip_to_space_const (tok);
+  tok = skip_spaces (arg);
+  end_tok = skip_to_space (tok);
 
   toklen = end_tok - tok;
   if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
     {
 
   toklen = end_tok - tok;
   if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
     {
-      innermost_block = NULL;
+      innermost_block.reset ();
       tok = cond_start = end_tok + 1;
       parse_exp_1 (&tok, 0, 0, 0);
 
       /* The watchpoint expression may not be local, but the condition
         may still be.  E.g.: `watch global if local > 0'.  */
       tok = cond_start = end_tok + 1;
       parse_exp_1 (&tok, 0, 0, 0);
 
       /* The watchpoint expression may not be local, but the condition
         may still be.  E.g.: `watch global if local > 0'.  */
-      cond_exp_valid_block = innermost_block;
+      cond_exp_valid_block = innermost_block.block ();
 
       cond_end = tok;
     }
 
       cond_end = tok;
     }
@@ -11192,13 +10748,13 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   else
     bp_type = bp_hardware_watchpoint;
 
   else
     bp_type = bp_hardware_watchpoint;
 
-  w = new watchpoint ();
+  std::unique_ptr<watchpoint> w (new watchpoint ());
 
   if (use_mask)
 
   if (use_mask)
-    init_raw_breakpoint_without_location (w, NULL, bp_type,
+    init_raw_breakpoint_without_location (w.get (), NULL, bp_type,
                                          &masked_watchpoint_breakpoint_ops);
   else
                                          &masked_watchpoint_breakpoint_ops);
   else
-    init_raw_breakpoint_without_location (w, NULL, bp_type,
+    init_raw_breakpoint_without_location (w.get (), NULL, bp_type,
                                          &watchpoint_breakpoint_ops);
   w->thread = thread;
   w->disposition = disp_donttouch;
                                          &watchpoint_breakpoint_ops);
   w->thread = thread;
   w->disposition = disp_donttouch;
@@ -11208,8 +10764,8 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   w->cond_exp_valid_block = cond_exp_valid_block;
   if (just_location)
     {
   w->cond_exp_valid_block = cond_exp_valid_block;
   if (just_location)
     {
-      struct type *t = value_type (val);
-      CORE_ADDR addr = value_as_address (val);
+      struct type *t = value_type (val.get ());
+      CORE_ADDR addr = value_as_address (val.get ());
 
       w->exp_string_reparse
        = current_language->la_watch_location_expression (t, addr).release ();
 
       w->exp_string_reparse
        = current_language->la_watch_location_expression (t, addr).release ();
@@ -11253,42 +10809,34 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
       /* The scope breakpoint is related to the watchpoint.  We will
         need to act on them together.  */
       w->related_breakpoint = scope_breakpoint;
       /* The scope breakpoint is related to the watchpoint.  We will
         need to act on them together.  */
       w->related_breakpoint = scope_breakpoint;
-      scope_breakpoint->related_breakpoint = w;
+      scope_breakpoint->related_breakpoint = w.get ();
     }
 
   if (!just_location)
     value_free_to_mark (mark);
 
     }
 
   if (!just_location)
     value_free_to_mark (mark);
 
-  TRY
-    {
-      /* Finally update the new watchpoint.  This creates the locations
-        that should be inserted.  */
-      update_watchpoint (w, 1);
-    }
-  CATCH (e, RETURN_MASK_ALL)
-    {
-      delete_breakpoint (w);
-      throw_exception (e);
-    }
-  END_CATCH
+  /* Finally update the new watchpoint.  This creates the locations
+     that should be inserted.  */
+  update_watchpoint (w.get (), 1);
 
 
-  install_breakpoint (internal, w, 1);
-  do_cleanups (back_to);
+  install_breakpoint (internal, std::move (w), 1);
 }
 
 /* Return count of debug registers needed to watch the given expression.
    If the watchpoint cannot be handled in hardware return zero.  */
 
 static int
 }
 
 /* Return count of debug registers needed to watch the given expression.
    If the watchpoint cannot be handled in hardware return zero.  */
 
 static int
-can_use_hardware_watchpoint (struct value *v)
+can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
 {
   int found_memory_cnt = 0;
 {
   int found_memory_cnt = 0;
-  struct value *head = v;
 
   /* Did the user specifically forbid us to use hardware watchpoints? */
   if (!can_use_hw_watchpoints)
     return 0;
 
 
   /* Did the user specifically forbid us to use hardware watchpoints? */
   if (!can_use_hw_watchpoints)
     return 0;
 
+  gdb_assert (!vals.empty ());
+  struct value *head = vals[0].get ();
+
   /* Make sure that the value of the expression depends only upon
      memory contents, and values computed from them within GDB.  If we
      find any register references or function calls, we can't use a
   /* Make sure that the value of the expression depends only upon
      memory contents, and values computed from them within GDB.  If we
      find any register references or function calls, we can't use a
@@ -11308,8 +10856,10 @@ can_use_hardware_watchpoint (struct value *v)
      function calls are special in any way.  So this function may not
      notice that an expression involving an inferior function call
      can't be watched with hardware watchpoints.  FIXME.  */
      function calls are special in any way.  So this function may not
      notice that an expression involving an inferior function call
      can't be watched with hardware watchpoints.  FIXME.  */
-  for (; v; v = value_next (v))
+  for (const value_ref_ptr &iter : vals)
     {
     {
+      struct value *v = iter.get ();
+
       if (VALUE_LVAL (v) == lval_memory)
        {
          if (v != head && value_lazy (v))
       if (VALUE_LVAL (v) == lval_memory)
        {
          if (v != head && value_lazy (v))
@@ -11361,7 +10911,7 @@ can_use_hardware_watchpoint (struct value *v)
 }
 
 void
 }
 
 void
-watch_command_wrapper (char *arg, int from_tty, int internal)
+watch_command_wrapper (const char *arg, int from_tty, int internal)
 {
   watch_command_1 (arg, hw_write, from_tty, 0, internal);
 }
 {
   watch_command_1 (arg, hw_write, from_tty, 0, internal);
 }
@@ -11370,7 +10920,7 @@ watch_command_wrapper (char *arg, int from_tty, int internal)
    calls watch_command_1.  */
 
 static void
    calls watch_command_1.  */
 
 static void
-watch_maybe_just_location (char *arg, int accessflag, int from_tty)
+watch_maybe_just_location (const char *arg, int accessflag, int from_tty)
 {
   int just_location = 0;
 
 {
   int just_location = 0;
 
@@ -11386,31 +10936,31 @@ watch_maybe_just_location (char *arg, int accessflag, int from_tty)
 }
 
 static void
 }
 
 static void
-watch_command (char *arg, int from_tty)
+watch_command (const char *arg, int from_tty)
 {
   watch_maybe_just_location (arg, hw_write, from_tty);
 }
 
 void
 {
   watch_maybe_just_location (arg, hw_write, from_tty);
 }
 
 void
-rwatch_command_wrapper (char *arg, int from_tty, int internal)
+rwatch_command_wrapper (const char *arg, int from_tty, int internal)
 {
   watch_command_1 (arg, hw_read, from_tty, 0, internal);
 }
 
 static void
 {
   watch_command_1 (arg, hw_read, from_tty, 0, internal);
 }
 
 static void
-rwatch_command (char *arg, int from_tty)
+rwatch_command (const char *arg, int from_tty)
 {
   watch_maybe_just_location (arg, hw_read, from_tty);
 }
 
 void
 {
   watch_maybe_just_location (arg, hw_read, from_tty);
 }
 
 void
-awatch_command_wrapper (char *arg, int from_tty, int internal)
+awatch_command_wrapper (const char *arg, int from_tty, int internal)
 {
   watch_command_1 (arg, hw_access, from_tty, 0, internal);
 }
 
 static void
 {
   watch_command_1 (arg, hw_access, from_tty, 0, internal);
 }
 
 static void
-awatch_command (char *arg, int from_tty)
+awatch_command (const char *arg, int from_tty)
 {
   watch_maybe_just_location (arg, hw_access, from_tty);
 }
 {
   watch_maybe_just_location (arg, hw_access, from_tty);
 }
@@ -11458,8 +11008,8 @@ static struct thread_fsm_ops until_break_fsm_ops =
 
 static struct until_break_fsm *
 new_until_break_fsm (struct interp *cmd_interp, int thread,
 
 static struct until_break_fsm *
 new_until_break_fsm (struct interp *cmd_interp, int thread,
-                    struct breakpoint *location_breakpoint,
-                    struct breakpoint *caller_breakpoint)
+                    breakpoint_up &&location_breakpoint,
+                    breakpoint_up &&caller_breakpoint)
 {
   struct until_break_fsm *sm;
 
 {
   struct until_break_fsm *sm;
 
@@ -11467,8 +11017,8 @@ new_until_break_fsm (struct interp *cmd_interp, int thread,
   thread_fsm_ctor (&sm->thread_fsm, &until_break_fsm_ops, cmd_interp);
 
   sm->thread = thread;
   thread_fsm_ctor (&sm->thread_fsm, &until_break_fsm_ops, cmd_interp);
 
   sm->thread = thread;
-  sm->location_breakpoint = location_breakpoint;
-  sm->caller_breakpoint = caller_breakpoint;
+  sm->location_breakpoint = location_breakpoint.release ();
+  sm->caller_breakpoint = caller_breakpoint.release ();
 
   return sm;
 }
 
   return sm;
 }
@@ -11525,16 +11075,12 @@ until_break_fsm_async_reply_reason (struct thread_fsm *self)
 }
 
 void
 }
 
 void
-until_break_command (char *arg, int from_tty, int anywhere)
+until_break_command (const char *arg, int from_tty, int anywhere)
 {
 {
-  struct symtabs_and_lines sals;
-  struct symtab_and_line sal;
   struct frame_info *frame;
   struct gdbarch *frame_gdbarch;
   struct frame_id stack_frame_id;
   struct frame_id caller_frame_id;
   struct frame_info *frame;
   struct gdbarch *frame_gdbarch;
   struct frame_id stack_frame_id;
   struct frame_id caller_frame_id;
-  struct breakpoint *location_breakpoint;
-  struct breakpoint *caller_breakpoint = NULL;
   struct cleanup *old_chain;
   int thread;
   struct thread_info *tp;
   struct cleanup *old_chain;
   int thread;
   struct thread_info *tp;
@@ -11547,19 +11093,18 @@ until_break_command (char *arg, int from_tty, int anywhere)
 
   event_location_up location = string_to_event_location (&arg, current_language);
 
 
   event_location_up location = string_to_event_location (&arg, current_language);
 
-  if (last_displayed_sal_is_valid ())
-    sals = decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
-                         get_last_displayed_symtab (),
-                         get_last_displayed_line ());
-  else
-    sals = decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE,
-                         NULL, (struct symtab *) NULL, 0);
+  std::vector<symtab_and_line> sals
+    = (last_displayed_sal_is_valid ()
+       ? decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
+                       get_last_displayed_symtab (),
+                       get_last_displayed_line ())
+       : decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE,
+                       NULL, (struct symtab *) NULL, 0));
 
 
-  if (sals.nelts != 1)
+  if (sals.size () != 1)
     error (_("Couldn't get information on specified line."));
 
     error (_("Couldn't get information on specified line."));
 
-  sal = sals.sals[0];
-  xfree (sals.sals);   /* malloc'd, so freed.  */
+  symtab_and_line &sal = sals[0];
 
   if (*arg)
     error (_("Junk at end of arguments."));
 
   if (*arg)
     error (_("Junk at end of arguments."));
@@ -11584,6 +11129,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
   /* Keep within the current frame, or in frames called by the current
      one.  */
 
   /* Keep within the current frame, or in frames called by the current
      one.  */
 
+  breakpoint_up caller_breakpoint;
   if (frame_id_p (caller_frame_id))
     {
       struct symtab_and_line sal2;
   if (frame_id_p (caller_frame_id))
     {
       struct symtab_and_line sal2;
@@ -11596,7 +11142,6 @@ until_break_command (char *arg, int from_tty, int anywhere)
                                                    sal2,
                                                    caller_frame_id,
                                                    bp_until);
                                                    sal2,
                                                    caller_frame_id,
                                                    bp_until);
-      make_cleanup_delete_breakpoint (caller_breakpoint);
 
       set_longjmp_breakpoint (tp, caller_frame_id);
       make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
 
       set_longjmp_breakpoint (tp, caller_frame_id);
       make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
@@ -11605,6 +11150,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
   /* set_momentary_breakpoint could invalidate FRAME.  */
   frame = NULL;
 
   /* set_momentary_breakpoint could invalidate FRAME.  */
   frame = NULL;
 
+  breakpoint_up location_breakpoint;
   if (anywhere)
     /* If the user told us to continue until a specified location,
        we don't specify a frame at which we need to stop.  */
   if (anywhere)
     /* If the user told us to continue until a specified location,
        we don't specify a frame at which we need to stop.  */
@@ -11615,10 +11161,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
        only at the very same frame.  */
     location_breakpoint = set_momentary_breakpoint (frame_gdbarch, sal,
                                                    stack_frame_id, bp_until);
        only at the very same frame.  */
     location_breakpoint = set_momentary_breakpoint (frame_gdbarch, sal,
                                                    stack_frame_id, bp_until);
-  make_cleanup_delete_breakpoint (location_breakpoint);
 
   sm = new_until_break_fsm (command_interp (), tp->global_num,
 
   sm = new_until_break_fsm (command_interp (), tp->global_num,
-                           location_breakpoint, caller_breakpoint);
+                           std::move (location_breakpoint),
+                           std::move (caller_breakpoint));
   tp->thread_fsm = &sm->thread_fsm;
 
   discard_cleanups (old_chain);
   tp->thread_fsm = &sm->thread_fsm;
 
   discard_cleanups (old_chain);
@@ -11647,7 +11193,7 @@ ep_parse_optional_if_clause (const char **arg)
 
   /* Skip any extra leading whitespace, and record the start of the
      condition string.  */
 
   /* Skip any extra leading whitespace, and record the start of the
      condition string.  */
-  *arg = skip_spaces_const (*arg);
+  *arg = skip_spaces (*arg);
   cond_string = *arg;
 
   /* Assume that the condition occupies the remainder of the arg
   cond_string = *arg;
 
   /* Assume that the condition occupies the remainder of the arg
@@ -11668,10 +11214,9 @@ typedef enum
 catch_fork_kind;
 
 static void
 catch_fork_kind;
 
 static void
-catch_fork_command_1 (char *arg_entry, int from_tty,
+catch_fork_command_1 (const char *arg, int from_tty,
                      struct cmd_list_element *command)
 {
                      struct cmd_list_element *command)
 {
-  const char *arg = arg_entry;
   struct gdbarch *gdbarch = get_current_arch ();
   const char *cond_string = NULL;
   catch_fork_kind fork_kind;
   struct gdbarch *gdbarch = get_current_arch ();
   const char *cond_string = NULL;
   catch_fork_kind fork_kind;
@@ -11683,7 +11228,7 @@ catch_fork_command_1 (char *arg_entry, int from_tty,
 
   if (!arg)
     arg = "";
 
   if (!arg)
     arg = "";
-  arg = skip_spaces_const (arg);
+  arg = skip_spaces (arg);
 
   /* The allowed syntax is:
      catch [v]fork
 
   /* The allowed syntax is:
      catch [v]fork
@@ -11716,11 +11261,9 @@ catch_fork_command_1 (char *arg_entry, int from_tty,
 }
 
 static void
 }
 
 static void
-catch_exec_command_1 (char *arg_entry, int from_tty,
+catch_exec_command_1 (const char *arg, int from_tty,
                      struct cmd_list_element *command)
 {
                      struct cmd_list_element *command)
 {
-  const char *arg = arg_entry;
-  struct exec_catchpoint *c;
   struct gdbarch *gdbarch = get_current_arch ();
   int tempflag;
   const char *cond_string = NULL;
   struct gdbarch *gdbarch = get_current_arch ();
   int tempflag;
   const char *cond_string = NULL;
@@ -11729,7 +11272,7 @@ catch_exec_command_1 (char *arg_entry, int from_tty,
 
   if (!arg)
     arg = "";
 
   if (!arg)
     arg = "";
-  arg = skip_spaces_const (arg);
+  arg = skip_spaces (arg);
 
   /* The allowed syntax is:
      catch exec
 
   /* The allowed syntax is:
      catch exec
@@ -11741,19 +11284,19 @@ catch_exec_command_1 (char *arg_entry, int from_tty,
   if ((*arg != '\0') && !isspace (*arg))
     error (_("Junk at end of arguments."));
 
   if ((*arg != '\0') && !isspace (*arg))
     error (_("Junk at end of arguments."));
 
-  c = new exec_catchpoint ();
-  init_catchpoint (c, gdbarch, tempflag, cond_string,
+  std::unique_ptr<exec_catchpoint> c (new exec_catchpoint ());
+  init_catchpoint (c.get (), gdbarch, tempflag, cond_string,
                   &catch_exec_breakpoint_ops);
   c->exec_pathname = NULL;
 
                   &catch_exec_breakpoint_ops);
   c->exec_pathname = NULL;
 
-  install_breakpoint (0, c, 1);
+  install_breakpoint (0, std::move (c), 1);
 }
 
 void
 init_ada_exception_breakpoint (struct breakpoint *b,
                               struct gdbarch *gdbarch,
                               struct symtab_and_line sal,
 }
 
 void
 init_ada_exception_breakpoint (struct breakpoint *b,
                               struct gdbarch *gdbarch,
                               struct symtab_and_line sal,
-                              char *addr_string,
+                              const char *addr_string,
                               const struct breakpoint_ops *ops,
                               int tempflag,
                               int enabled,
                               const struct breakpoint_ops *ops,
                               int tempflag,
                               int enabled,
@@ -11787,31 +11330,29 @@ init_ada_exception_breakpoint (struct breakpoint *b,
 }
 
 static void
 }
 
 static void
-catch_command (char *arg, int from_tty)
+catch_command (const char *arg, int from_tty)
 {
   error (_("Catch requires an event name."));
 }
 \f
 
 static void
 {
   error (_("Catch requires an event name."));
 }
 \f
 
 static void
-tcatch_command (char *arg, int from_tty)
+tcatch_command (const char *arg, int from_tty)
 {
   error (_("Catch requires an event name."));
 }
 
 {
   error (_("Catch requires an event name."));
 }
 
-/* A qsort comparison function that sorts breakpoints in order.  */
+/* Compare two breakpoints and return a strcmp-like result.  */
 
 static int
 
 static int
-compare_breakpoints (const void *a, const void *b)
+compare_breakpoints (const breakpoint *a, const breakpoint *b)
 {
 {
-  const breakpoint_p *ba = (const breakpoint_p *) a;
-  uintptr_t ua = (uintptr_t) *ba;
-  const breakpoint_p *bb = (const breakpoint_p *) b;
-  uintptr_t ub = (uintptr_t) *bb;
+  uintptr_t ua = (uintptr_t) a;
+  uintptr_t ub = (uintptr_t) b;
 
 
-  if ((*ba)->number < (*bb)->number)
+  if (a->number < b->number)
     return -1;
     return -1;
-  else if ((*ba)->number > (*bb)->number)
+  else if (a->number > b->number)
     return 1;
 
   /* Now sort by address, in case we see, e..g, two breakpoints with
     return 1;
 
   /* Now sort by address, in case we see, e..g, two breakpoints with
@@ -11824,42 +11365,34 @@ compare_breakpoints (const void *a, const void *b)
 /* Delete breakpoints by address or line.  */
 
 static void
 /* Delete breakpoints by address or line.  */
 
 static void
-clear_command (char *arg, int from_tty)
+clear_command (const char *arg, int from_tty)
 {
 {
-  struct breakpoint *b, *prev;
-  VEC(breakpoint_p) *found = 0;
-  int ix;
+  struct breakpoint *b;
   int default_match;
   int default_match;
-  struct symtabs_and_lines sals;
-  struct symtab_and_line sal;
-  int i;
-  struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
 
 
+  std::vector<symtab_and_line> decoded_sals;
+  symtab_and_line last_sal;
+  gdb::array_view<symtab_and_line> sals;
   if (arg)
     {
   if (arg)
     {
-      sals = decode_line_with_current_source (arg,
-                                             (DECODE_LINE_FUNFIRSTLINE
-                                              | DECODE_LINE_LIST_MODE));
-      make_cleanup (xfree, sals.sals);
+      decoded_sals
+       = decode_line_with_current_source (arg,
+                                          (DECODE_LINE_FUNFIRSTLINE
+                                           | DECODE_LINE_LIST_MODE));
       default_match = 0;
       default_match = 0;
+      sals = decoded_sals;
     }
   else
     {
     }
   else
     {
-      sals.sals = XNEW (struct symtab_and_line);
-      make_cleanup (xfree, sals.sals);
-      init_sal (&sal);         /* Initialize to zeroes.  */
-
       /* Set sal's line, symtab, pc, and pspace to the values
         corresponding to the last call to print_frame_info.  If the
         codepoint is not valid, this will set all the fields to 0.  */
       /* Set sal's line, symtab, pc, and pspace to the values
         corresponding to the last call to print_frame_info.  If the
         codepoint is not valid, this will set all the fields to 0.  */
-      get_last_displayed_sal (&sal);
-      if (sal.symtab == 0)
+      last_sal = get_last_displayed_sal ();
+      if (last_sal.symtab == 0)
        error (_("No source file specified."));
 
        error (_("No source file specified."));
 
-      sals.sals[0] = sal;
-      sals.nelts = 1;
-
       default_match = 1;
       default_match = 1;
+      sals = last_sal;
     }
 
   /* We don't call resolve_sal_pc here.  That's not as bad as it
     }
 
   /* We don't call resolve_sal_pc here.  That's not as bad as it
@@ -11884,9 +11417,8 @@ clear_command (char *arg, int from_tty)
      from_tty is forced true if we delete more than one
      breakpoint.  */
 
      from_tty is forced true if we delete more than one
      breakpoint.  */
 
-  found = NULL;
-  make_cleanup (VEC_cleanup (breakpoint_p), &found);
-  for (i = 0; i < sals.nelts; i++)
+  std::vector<struct breakpoint *> found;
+  for (const auto &sal : sals)
     {
       const char *sal_fullname;
 
     {
       const char *sal_fullname;
 
@@ -11902,7 +11434,6 @@ clear_command (char *arg, int from_tty)
          0              0             line
          1              0             <can't happen> */
 
          0              0             line
          1              0             <can't happen> */
 
-      sal = sals.sals[i];
       sal_fullname = (sal.symtab == NULL
                      ? NULL : symtab_to_fullname (sal.symtab));
 
       sal_fullname = (sal.symtab == NULL
                      ? NULL : symtab_to_fullname (sal.symtab));
 
@@ -11944,12 +11475,12 @@ clear_command (char *arg, int from_tty)
            }
 
          if (match)
            }
 
          if (match)
-           VEC_safe_push(breakpoint_p, found, b);
+           found.push_back (b);
        }
     }
 
   /* Now go thru the 'found' chain and delete them.  */
        }
     }
 
   /* Now go thru the 'found' chain and delete them.  */
-  if (VEC_empty(breakpoint_p, found))
+  if (found.empty ())
     {
       if (arg)
        error (_("No breakpoint at %s."), arg);
     {
       if (arg)
        error (_("No breakpoint at %s."), arg);
@@ -11958,40 +11489,36 @@ clear_command (char *arg, int from_tty)
     }
 
   /* Remove duplicates from the vec.  */
     }
 
   /* Remove duplicates from the vec.  */
-  qsort (VEC_address (breakpoint_p, found),
-        VEC_length (breakpoint_p, found),
-        sizeof (breakpoint_p),
-        compare_breakpoints);
-  prev = VEC_index (breakpoint_p, found, 0);
-  for (ix = 1; VEC_iterate (breakpoint_p, found, ix, b); ++ix)
-    {
-      if (b == prev)
-       {
-         VEC_ordered_remove (breakpoint_p, found, ix);
-         --ix;
-       }
-    }
+  std::sort (found.begin (), found.end (),
+            [] (const breakpoint *bp_a, const breakpoint *bp_b)
+            {
+              return compare_breakpoints (bp_a, bp_b) < 0;
+            });
+  found.erase (std::unique (found.begin (), found.end (),
+                           [] (const breakpoint *bp_a, const breakpoint *bp_b)
+                           {
+                             return compare_breakpoints (bp_a, bp_b) == 0;
+                           }),
+              found.end ());
 
 
-  if (VEC_length(breakpoint_p, found) > 1)
+  if (found.size () > 1)
     from_tty = 1;      /* Always report if deleted more than one.  */
   if (from_tty)
     {
     from_tty = 1;      /* Always report if deleted more than one.  */
   if (from_tty)
     {
-      if (VEC_length(breakpoint_p, found) == 1)
+      if (found.size () == 1)
        printf_unfiltered (_("Deleted breakpoint "));
       else
        printf_unfiltered (_("Deleted breakpoints "));
     }
 
        printf_unfiltered (_("Deleted breakpoint "));
       else
        printf_unfiltered (_("Deleted breakpoints "));
     }
 
-  for (ix = 0; VEC_iterate(breakpoint_p, found, ix, b); ix++)
+  for (breakpoint *iter : found)
     {
       if (from_tty)
     {
       if (from_tty)
-       printf_unfiltered ("%d ", b->number);
-      delete_breakpoint (b);
+       printf_unfiltered ("%d ", iter->number);
+      delete_breakpoint (iter);
     }
   if (from_tty)
     putchar_unfiltered ('\n');
     }
   if (from_tty)
     putchar_unfiltered ('\n');
-
-  do_cleanups (cleanups);
 }
 \f
 /* Delete breakpoint in BS if they are `delete' breakpoints and
 }
 \f
 /* Delete breakpoint in BS if they are `delete' breakpoints and
@@ -12141,7 +11668,7 @@ download_tracepoint_locations (void)
       t = (struct tracepoint *) b;
       t->number_on_target = b->number;
       if (bp_location_downloaded)
       t = (struct tracepoint *) b;
       t->number_on_target = b->number;
       if (bp_location_downloaded)
-       observer_notify_breakpoint_modified (b);
+       gdb::observers::breakpoint_modified.notify (b);
     }
 }
 
     }
 }
 
@@ -12232,7 +11759,6 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
 {
   struct breakpoint *b;
   struct bp_location **locp, *loc;
 {
   struct breakpoint *b;
   struct bp_location **locp, *loc;
-  struct cleanup *cleanups;
   /* Last breakpoint location address that was marked for update.  */
   CORE_ADDR last_addr = 0;
   /* Last breakpoint location program space that was marked for update.  */
   /* Last breakpoint location address that was marked for update.  */
   CORE_ADDR last_addr = 0;
   /* Last breakpoint location program space that was marked for update.  */
@@ -12251,14 +11777,13 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
 
   /* Saved former bp_locations array which we compare against the newly
      built bp_locations from the current state of ALL_BREAKPOINTS.  */
 
   /* Saved former bp_locations array which we compare against the newly
      built bp_locations from the current state of ALL_BREAKPOINTS.  */
-  struct bp_location **old_locations, **old_locp;
+  struct bp_location **old_locp;
   unsigned old_locations_count;
   unsigned old_locations_count;
+  gdb::unique_xmalloc_ptr<struct bp_location *> old_locations (bp_locations);
 
 
-  old_locations = bp_locations;
   old_locations_count = bp_locations_count;
   bp_locations = NULL;
   bp_locations_count = 0;
   old_locations_count = bp_locations_count;
   bp_locations = NULL;
   bp_locations_count = 0;
-  cleanups = make_cleanup (xfree, old_locations);
 
   ALL_BREAKPOINTS (b)
     for (loc = b->loc; loc; loc = loc->next)
 
   ALL_BREAKPOINTS (b)
     for (loc = b->loc; loc; loc = loc->next)
@@ -12285,8 +11810,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
      and former bp_location array state respectively.  */
 
   locp = bp_locations;
      and former bp_location array state respectively.  */
 
   locp = bp_locations;
-  for (old_locp = old_locations;
-       old_locp < old_locations + old_locations_count;
+  for (old_locp = old_locations.get ();
+       old_locp < old_locations.get () + old_locations_count;
        old_locp++)
     {
       struct bp_location *old_loc = *old_locp;
        old_locp++)
     {
       struct bp_location *old_loc = *old_locp;
@@ -12471,7 +11996,7 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
              old_loc->events_till_retirement = 3 * (thread_count () + 1);
              old_loc->owner = NULL;
 
              old_loc->events_till_retirement = 3 * (thread_count () + 1);
              old_loc->owner = NULL;
 
-             VEC_safe_push (bp_location_p, moribund_locations, old_loc);
+             moribund_locations.push_back (old_loc);
            }
          else
            {
            }
          else
            {
@@ -12569,23 +12094,21 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
 
   if (insert_mode != UGLL_DONT_INSERT)
     download_tracepoint_locations ();
 
   if (insert_mode != UGLL_DONT_INSERT)
     download_tracepoint_locations ();
-
-  do_cleanups (cleanups);
 }
 
 void
 breakpoint_retire_moribund (void)
 {
 }
 
 void
 breakpoint_retire_moribund (void)
 {
-  struct bp_location *loc;
-  int ix;
-
-  for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
-    if (--(loc->events_till_retirement) == 0)
-      {
-       decref_bp_location (&loc);
-       VEC_unordered_remove (bp_location_p, moribund_locations, ix);
-       --ix;
-      }
+  for (int ix = 0; ix < moribund_locations.size (); ++ix)
+    {
+      struct bp_location *loc = moribund_locations[ix];
+      if (--(loc->events_till_retirement) == 0)
+       {
+         decref_bp_location (&loc);
+         unordered_remove (moribund_locations, ix);
+         --ix;
+       }
+    }
 }
 
 static void
 }
 
 static void
@@ -12715,7 +12238,6 @@ static const struct bp_location_ops bp_location_ops =
 
 breakpoint::~breakpoint ()
 {
 
 breakpoint::~breakpoint ()
 {
-  decref_counted_command_line (&this->commands);
   xfree (this->cond_string);
   xfree (this->extra_string);
   xfree (this->filter);
   xfree (this->cond_string);
   xfree (this->extra_string);
   xfree (this->filter);
@@ -12751,7 +12273,7 @@ base_breakpoint_remove_location (struct bp_location *bl,
 
 static int
 base_breakpoint_breakpoint_hit (const struct bp_location *bl,
 
 static int
 base_breakpoint_breakpoint_hit (const struct bp_location *bl,
-                               struct address_space *aspace,
+                               const address_space *aspace,
                                CORE_ADDR bp_addr,
                                const struct target_waitstatus *ws)
 {
                                CORE_ADDR bp_addr,
                                const struct target_waitstatus *ws)
 {
@@ -12832,11 +12354,10 @@ base_breakpoint_create_breakpoints_sal (struct gdbarch *gdbarch,
   internal_error_pure_virtual_called ();
 }
 
   internal_error_pure_virtual_called ();
 }
 
-static void
+static std::vector<symtab_and_line>
 base_breakpoint_decode_location (struct breakpoint *b,
                                 const struct event_location *location,
 base_breakpoint_decode_location (struct breakpoint *b,
                                 const struct event_location *location,
-                                struct program_space *search_pspace,
-                                struct symtabs_and_lines *sals)
+                                struct program_space *search_pspace)
 {
   internal_error_pure_virtual_called ();
 }
 {
   internal_error_pure_virtual_called ();
 }
@@ -12920,7 +12441,7 @@ bkpt_remove_location (struct bp_location *bl, enum remove_bp_reason reason)
 
 static int
 bkpt_breakpoint_hit (const struct bp_location *bl,
 
 static int
 bkpt_breakpoint_hit (const struct bp_location *bl,
-                    struct address_space *aspace, CORE_ADDR bp_addr,
+                    const address_space *aspace, CORE_ADDR bp_addr,
                     const struct target_waitstatus *ws)
 {
   if (ws->kind != TARGET_WAITKIND_STOPPED
                     const struct target_waitstatus *ws)
 {
   if (ws->kind != TARGET_WAITKIND_STOPPED
@@ -12941,7 +12462,7 @@ bkpt_breakpoint_hit (const struct bp_location *bl,
 
 static int
 dprintf_breakpoint_hit (const struct bp_location *bl,
 
 static int
 dprintf_breakpoint_hit (const struct bp_location *bl,
-                       struct address_space *aspace, CORE_ADDR bp_addr,
+                       const address_space *aspace, CORE_ADDR bp_addr,
                        const struct target_waitstatus *ws)
 {
   if (dprintf_style == dprintf_style_agent
                        const struct target_waitstatus *ws)
 {
   if (dprintf_style == dprintf_style_agent
@@ -13087,13 +12608,12 @@ bkpt_create_breakpoints_sal (struct gdbarch *gdbarch,
                                  enabled, internal, flags);
 }
 
                                  enabled, internal, flags);
 }
 
-static void
+static std::vector<symtab_and_line>
 bkpt_decode_location (struct breakpoint *b,
                      const struct event_location *location,
 bkpt_decode_location (struct breakpoint *b,
                      const struct event_location *location,
-                     struct program_space *search_pspace,
-                     struct symtabs_and_lines *sals)
+                     struct program_space *search_pspace)
 {
 {
-  decode_location_default (b, location, search_pspace, sals);
+  return decode_location_default (b, location, search_pspace);
 }
 
 /* Virtual table for internal breakpoints.  */
 }
 
 /* Virtual table for internal breakpoints.  */
@@ -13246,10 +12766,7 @@ bkpt_probe_insert_location (struct bp_location *bl)
     {
       /* The insertion was successful, now let's set the probe's semaphore
         if needed.  */
     {
       /* The insertion was successful, now let's set the probe's semaphore
         if needed.  */
-      if (bl->probe.probe->pops->set_semaphore != NULL)
-       bl->probe.probe->pops->set_semaphore (bl->probe.probe,
-                                             bl->probe.objfile,
-                                             bl->gdbarch);
+      bl->probe.prob->set_semaphore (bl->probe.objfile, bl->gdbarch);
     }
 
   return v;
     }
 
   return v;
@@ -13260,10 +12777,7 @@ bkpt_probe_remove_location (struct bp_location *bl,
                            enum remove_bp_reason reason)
 {
   /* Let's clear the semaphore before removing the location.  */
                            enum remove_bp_reason reason)
 {
   /* Let's clear the semaphore before removing the location.  */
-  if (bl->probe.probe->pops->clear_semaphore != NULL)
-    bl->probe.probe->pops->clear_semaphore (bl->probe.probe,
-                                           bl->probe.objfile,
-                                           bl->gdbarch);
+  bl->probe.prob->clear_semaphore (bl->probe.objfile, bl->gdbarch);
 
   return bkpt_remove_location (bl, reason);
 }
 
   return bkpt_remove_location (bl, reason);
 }
@@ -13278,18 +12792,18 @@ bkpt_probe_create_sals_from_location (const struct event_location *location,
   lsal.sals = parse_probes (location, NULL, canonical);
   lsal.canonical
     = xstrdup (event_location_to_string (canonical->location.get ()));
   lsal.sals = parse_probes (location, NULL, canonical);
   lsal.canonical
     = xstrdup (event_location_to_string (canonical->location.get ()));
-  VEC_safe_push (linespec_sals, canonical->sals, &lsal);
+  canonical->lsals.push_back (std::move (lsal));
 }
 
 }
 
-static void
+static std::vector<symtab_and_line>
 bkpt_probe_decode_location (struct breakpoint *b,
                            const struct event_location *location,
 bkpt_probe_decode_location (struct breakpoint *b,
                            const struct event_location *location,
-                           struct program_space *search_pspace,
-                           struct symtabs_and_lines *sals)
+                           struct program_space *search_pspace)
 {
 {
-  *sals = parse_probes (location, search_pspace, NULL);
-  if (!sals->sals)
+  std::vector<symtab_and_line> sals = parse_probes (location, search_pspace, NULL);
+  if (sals.empty ())
     error (_("probe not found"));
     error (_("probe not found"));
+  return sals;
 }
 
 /* The breakpoint_ops structure to be used in tracepoints.  */
 }
 
 /* The breakpoint_ops structure to be used in tracepoints.  */
@@ -13302,7 +12816,7 @@ tracepoint_re_set (struct breakpoint *b)
 
 static int
 tracepoint_breakpoint_hit (const struct bp_location *bl,
 
 static int
 tracepoint_breakpoint_hit (const struct bp_location *bl,
-                          struct address_space *aspace, CORE_ADDR bp_addr,
+                          const address_space *aspace, CORE_ADDR bp_addr,
                           const struct target_waitstatus *ws)
 {
   /* By definition, the inferior does not report stops at
                           const struct target_waitstatus *ws)
 {
   /* By definition, the inferior does not report stops at
@@ -13315,7 +12829,7 @@ tracepoint_print_one_detail (const struct breakpoint *self,
                             struct ui_out *uiout)
 {
   struct tracepoint *tp = (struct tracepoint *) self;
                             struct ui_out *uiout)
 {
   struct tracepoint *tp = (struct tracepoint *) self;
-  if (tp->static_trace_marker_id)
+  if (!tp->static_trace_marker_id.empty ())
     {
       gdb_assert (self->type == bp_static_tracepoint);
 
     {
       gdb_assert (self->type == bp_static_tracepoint);
 
@@ -13407,13 +12921,12 @@ tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch,
                                  enabled, internal, flags);
 }
 
                                  enabled, internal, flags);
 }
 
-static void
+static std::vector<symtab_and_line>
 tracepoint_decode_location (struct breakpoint *b,
                            const struct event_location *location,
 tracepoint_decode_location (struct breakpoint *b,
                            const struct event_location *location,
-                           struct program_space *search_pspace,
-                           struct symtabs_and_lines *sals)
+                           struct program_space *search_pspace)
 {
 {
-  decode_location_default (b, location, search_pspace, sals);
+  return decode_location_default (b, location, search_pspace);
 }
 
 struct breakpoint_ops tracepoint_breakpoint_ops;
 }
 
 struct breakpoint_ops tracepoint_breakpoint_ops;
@@ -13431,14 +12944,13 @@ tracepoint_probe_create_sals_from_location
   bkpt_probe_create_sals_from_location (location, canonical, type_wanted);
 }
 
   bkpt_probe_create_sals_from_location (location, canonical, type_wanted);
 }
 
-static void
+static std::vector<symtab_and_line>
 tracepoint_probe_decode_location (struct breakpoint *b,
                                  const struct event_location *location,
 tracepoint_probe_decode_location (struct breakpoint *b,
                                  const struct event_location *location,
-                                 struct program_space *search_pspace,
-                                 struct symtabs_and_lines *sals)
+                                 struct program_space *search_pspace)
 {
   /* We use the same method for breakpoint on probes.  */
 {
   /* We use the same method for breakpoint on probes.  */
-  bkpt_probe_decode_location (b, location, search_pspace, sals);
+  return bkpt_probe_decode_location (b, location, search_pspace);
 }
 
 static struct breakpoint_ops tracepoint_probe_breakpoint_ops;
 }
 
 static struct breakpoint_ops tracepoint_probe_breakpoint_ops;
@@ -13490,8 +13002,7 @@ dprintf_print_recreate (struct breakpoint *tp, struct ui_file *fp)
 static void
 dprintf_after_condition_true (struct bpstats *bs)
 {
 static void
 dprintf_after_condition_true (struct bpstats *bs)
 {
-  struct cleanup *old_chain;
-  struct bpstats tmp_bs = { NULL };
+  struct bpstats tmp_bs;
   struct bpstats *tmp_bs_p = &tmp_bs;
 
   /* dprintf's never cause a stop.  This wasn't set in the
   struct bpstats *tmp_bs_p = &tmp_bs;
 
   /* dprintf's never cause a stop.  This wasn't set in the
@@ -13506,14 +13017,12 @@ dprintf_after_condition_true (struct bpstats *bs)
      commands here throws.  */
   tmp_bs.commands = bs->commands;
   bs->commands = NULL;
      commands here throws.  */
   tmp_bs.commands = bs->commands;
   bs->commands = NULL;
-  old_chain = make_cleanup_decref_counted_command_line (&tmp_bs.commands);
 
   bpstat_do_actions_1 (&tmp_bs_p);
 
   /* 'tmp_bs.commands' will usually be NULL by now, but
      bpstat_do_actions_1 may return early without processing the whole
      list.  */
 
   bpstat_do_actions_1 (&tmp_bs_p);
 
   /* 'tmp_bs.commands' will usually be NULL by now, but
      bpstat_do_actions_1 may return early without processing the whole
      list.  */
-  do_cleanups (old_chain);
 }
 
 /* The breakpoint_ops structure to be used on static tracepoints with
 }
 
 /* The breakpoint_ops structure to be used on static tracepoints with
@@ -13526,20 +13035,18 @@ strace_marker_create_sals_from_location (const struct event_location *location,
 {
   struct linespec_sals lsal;
   const char *arg_start, *arg;
 {
   struct linespec_sals lsal;
   const char *arg_start, *arg;
-  char *str;
-  struct cleanup *cleanup;
 
 
-  arg = arg_start = get_linespec_location (location);
+  arg = arg_start = get_linespec_location (location)->spec_string;
   lsal.sals = decode_static_tracepoint_spec (&arg);
 
   lsal.sals = decode_static_tracepoint_spec (&arg);
 
-  str = savestring (arg_start, arg - arg_start);
-  cleanup = make_cleanup (xfree, str);
-  canonical->location = new_linespec_location (&str);
-  do_cleanups (cleanup);
+  std::string str (arg_start, arg - arg_start);
+  const char *ptr = str.c_str ();
+  canonical->location
+    = new_linespec_location (&ptr, symbol_name_match_type::FULL);
 
   lsal.canonical
     = xstrdup (event_location_to_string (canonical->location.get ()));
 
   lsal.canonical
     = xstrdup (event_location_to_string (canonical->location.get ()));
-  VEC_safe_push (linespec_sals, canonical->sals, &lsal);
+  canonical->lsals.push_back (std::move (lsal));
 }
 
 static void
 }
 
 static void
@@ -13555,9 +13062,7 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
                                      int from_tty, int enabled,
                                      int internal, unsigned flags)
 {
                                      int from_tty, int enabled,
                                      int internal, unsigned flags)
 {
-  int i;
-  struct linespec_sals *lsal = VEC_index (linespec_sals,
-                                         canonical->sals, 0);
+  const linespec_sals &lsal = canonical->lsals[0];
 
   /* If the user is creating a static tracepoint by marker id
      (strace -m MARKER_ID), then store the sals index, so that
 
   /* If the user is creating a static tracepoint by marker id
      (strace -m MARKER_ID), then store the sals index, so that
@@ -13566,19 +13071,13 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
      expand multiple locations for each sal, given than SALS
      already should contain all sals for MARKER_ID.  */
 
      expand multiple locations for each sal, given than SALS
      already should contain all sals for MARKER_ID.  */
 
-  for (i = 0; i < lsal->sals.nelts; ++i)
+  for (size_t i = 0; i < lsal.sals.size (); i++)
     {
     {
-      struct symtabs_and_lines expanded;
-      struct tracepoint *tp;
-      event_location_up location;
-
-      expanded.nelts = 1;
-      expanded.sals = &lsal->sals.sals[i];
-
-      location = copy_event_location (canonical->location.get ());
+      event_location_up location
+       = copy_event_location (canonical->location.get ());
 
 
-      tp = new tracepoint ();
-      init_breakpoint_sal (tp, gdbarch, expanded,
+      std::unique_ptr<tracepoint> tp (new tracepoint ());
+      init_breakpoint_sal (tp.get (), gdbarch, lsal.sals[i],
                           std::move (location), NULL,
                           std::move (cond_string),
                           std::move (extra_string),
                           std::move (location), NULL,
                           std::move (cond_string),
                           std::move (extra_string),
@@ -13594,27 +13093,27 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
         corresponds to this one  */
       tp->static_trace_marker_id_idx = i;
 
         corresponds to this one  */
       tp->static_trace_marker_id_idx = i;
 
-      install_breakpoint (internal, tp, 0);
+      install_breakpoint (internal, std::move (tp), 0);
     }
 }
 
     }
 }
 
-static void
+static std::vector<symtab_and_line>
 strace_marker_decode_location (struct breakpoint *b,
                               const struct event_location *location,
 strace_marker_decode_location (struct breakpoint *b,
                               const struct event_location *location,
-                              struct program_space *search_pspace,
-                              struct symtabs_and_lines *sals)
+                              struct program_space *search_pspace)
 {
   struct tracepoint *tp = (struct tracepoint *) b;
 {
   struct tracepoint *tp = (struct tracepoint *) b;
-  const char *s = get_linespec_location (location);
+  const char *s = get_linespec_location (location)->spec_string;
 
 
-  *sals = decode_static_tracepoint_spec (&s);
-  if (sals->nelts > tp->static_trace_marker_id_idx)
+  std::vector<symtab_and_line> sals = decode_static_tracepoint_spec (&s);
+  if (sals.size () > tp->static_trace_marker_id_idx)
     {
     {
-      sals->sals[0] = sals->sals[tp->static_trace_marker_id_idx];
-      sals->nelts = 1;
+      sals[0] = sals[tp->static_trace_marker_id_idx];
+      sals.resize (1);
+      return sals;
     }
   else
     }
   else
-    error (_("marker %s not found"), tp->static_trace_marker_id);
+    error (_("marker %s not found"), tp->static_trace_marker_id.c_str ());
 }
 
 static struct breakpoint_ops strace_marker_breakpoint_ops;
 }
 
 static struct breakpoint_ops strace_marker_breakpoint_ops;
@@ -13682,7 +13181,7 @@ delete_breakpoint (struct breakpoint *bpt)
      a problem in that process, we'll be asked to delete the half-created
      watchpoint.  In that case, don't announce the deletion.  */
   if (bpt->number)
      a problem in that process, we'll be asked to delete the half-created
      watchpoint.  In that case, don't announce the deletion.  */
   if (bpt->number)
-    observer_notify_breakpoint_deleted (bpt);
+    gdb::observers::breakpoint_deleted.notify (bpt);
 
   if (breakpoint_chain == bpt)
     breakpoint_chain = bpt->next;
 
   if (breakpoint_chain == bpt)
     breakpoint_chain = bpt->next;
@@ -13720,26 +13219,12 @@ delete_breakpoint (struct breakpoint *bpt)
   delete bpt;
 }
 
   delete bpt;
 }
 
-static void
-do_delete_breakpoint_cleanup (void *b)
-{
-  delete_breakpoint ((struct breakpoint *) b);
-}
-
-struct cleanup *
-make_cleanup_delete_breakpoint (struct breakpoint *b)
-{
-  return make_cleanup (do_delete_breakpoint_cleanup, b);
-}
-
 /* Iterator function to call a user-provided callback function once
    for each of B and its related breakpoints.  */
 
 static void
 iterate_over_related_breakpoints (struct breakpoint *b,
 /* Iterator function to call a user-provided callback function once
    for each of B and its related breakpoints.  */
 
 static void
 iterate_over_related_breakpoints (struct breakpoint *b,
-                                 void (*function) (struct breakpoint *,
-                                                   void *),
-                                 void *data)
+                                 gdb::function_view<void (breakpoint *)> function)
 {
   struct breakpoint *related;
 
 {
   struct breakpoint *related;
 
@@ -13754,7 +13239,7 @@ iterate_over_related_breakpoints (struct breakpoint *b,
       if (next == related)
        {
          /* RELATED is the last ring entry.  */
       if (next == related)
        {
          /* RELATED is the last ring entry.  */
-         function (related, data);
+         function (related);
 
          /* FUNCTION may have deleted it, so we'd never reach back to
             B.  There's nothing left to do anyway, so just break
 
          /* FUNCTION may have deleted it, so we'd never reach back to
             B.  There's nothing left to do anyway, so just break
@@ -13762,7 +13247,7 @@ iterate_over_related_breakpoints (struct breakpoint *b,
          break;
        }
       else
          break;
        }
       else
-       function (related, data);
+       function (related);
 
       related = next;
     }
 
       related = next;
     }
@@ -13770,22 +13255,7 @@ iterate_over_related_breakpoints (struct breakpoint *b,
 }
 
 static void
 }
 
 static void
-do_delete_breakpoint (struct breakpoint *b, void *ignore)
-{
-  delete_breakpoint (b);
-}
-
-/* A callback for map_breakpoint_numbers that calls
-   delete_breakpoint.  */
-
-static void
-do_map_delete_breakpoint (struct breakpoint *b, void *ignore)
-{
-  iterate_over_related_breakpoints (b, do_delete_breakpoint, NULL);
-}
-
-void
-delete_command (char *arg, int from_tty)
+delete_command (const char *arg, int from_tty)
 {
   struct breakpoint *b, *b_tmp;
 
 {
   struct breakpoint *b, *b_tmp;
 
@@ -13815,7 +13285,11 @@ delete_command (char *arg, int from_tty)
        }
     }
   else
        }
     }
   else
-    map_breakpoint_numbers (arg, do_map_delete_breakpoint, NULL);
+    map_breakpoint_numbers
+      (arg, [&] (breakpoint *br)
+       {
+        iterate_over_related_breakpoints (br, delete_breakpoint);
+       });
 }
 
 /* Return true if all locations of B bound to PSPACE are pending.  If
 }
 
 /* Return true if all locations of B bound to PSPACE are pending.  If
@@ -13844,10 +13318,8 @@ static int
 ambiguous_names_p (struct bp_location *loc)
 {
   struct bp_location *l;
 ambiguous_names_p (struct bp_location *loc)
 {
   struct bp_location *l;
-  htab_t htab = htab_create_alloc (13, htab_hash_string,
-                                  (int (*) (const void *, 
-                                            const void *)) streq,
-                                  NULL, xcalloc, xfree);
+  htab_t htab = htab_create_alloc (13, htab_hash_string, streq_hash, NULL,
+                                  xcalloc, xfree);
 
   for (l = loc; l != NULL; l = l->next)
     {
 
   for (l = loc; l != NULL; l = l->next)
     {
@@ -13920,14 +13392,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
 
   if (target_static_tracepoint_marker_at (pc, &marker))
     {
 
   if (target_static_tracepoint_marker_at (pc, &marker))
     {
-      if (strcmp (tp->static_trace_marker_id, marker.str_id) != 0)
+      if (tp->static_trace_marker_id != marker.str_id)
        warning (_("static tracepoint %d changed probed marker from %s to %s"),
        warning (_("static tracepoint %d changed probed marker from %s to %s"),
-                b->number,
-                tp->static_trace_marker_id, marker.str_id);
+                b->number, tp->static_trace_marker_id.c_str (),
+                marker.str_id.c_str ());
 
 
-      xfree (tp->static_trace_marker_id);
-      tp->static_trace_marker_id = xstrdup (marker.str_id);
-      release_static_tracepoint_marker (&marker);
+      tp->static_trace_marker_id = std::move (marker.str_id);
 
       return sal;
     }
 
       return sal;
     }
@@ -13937,35 +13407,28 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
   if (!sal.explicit_pc
       && sal.line != 0
       && sal.symtab != NULL
   if (!sal.explicit_pc
       && sal.line != 0
       && sal.symtab != NULL
-      && tp->static_trace_marker_id != NULL)
+      && !tp->static_trace_marker_id.empty ())
     {
     {
-      VEC(static_tracepoint_marker_p) *markers;
-
-      markers
-       = target_static_tracepoint_markers_by_strid (tp->static_trace_marker_id);
+      std::vector<static_tracepoint_marker> markers
+       = target_static_tracepoint_markers_by_strid
+           (tp->static_trace_marker_id.c_str ());
 
 
-      if (!VEC_empty(static_tracepoint_marker_p, markers))
+      if (!markers.empty ())
        {
        {
-         struct symtab_and_line sal2;
          struct symbol *sym;
          struct static_tracepoint_marker *tpmarker;
          struct ui_out *uiout = current_uiout;
          struct explicit_location explicit_loc;
 
          struct symbol *sym;
          struct static_tracepoint_marker *tpmarker;
          struct ui_out *uiout = current_uiout;
          struct explicit_location explicit_loc;
 
-         tpmarker = VEC_index (static_tracepoint_marker_p, markers, 0);
+         tpmarker = &markers[0];
 
 
-         xfree (tp->static_trace_marker_id);
-         tp->static_trace_marker_id = xstrdup (tpmarker->str_id);
+         tp->static_trace_marker_id = std::move (tpmarker->str_id);
 
          warning (_("marker for static tracepoint %d (%s) not "
                     "found at previous line number"),
 
          warning (_("marker for static tracepoint %d (%s) not "
                     "found at previous line number"),
-                  b->number, tp->static_trace_marker_id);
+                  b->number, tp->static_trace_marker_id.c_str ());
 
 
-         init_sal (&sal2);
-
-         sal2.pc = tpmarker->address;
-
-         sal2 = find_pc_line (tpmarker->address, 0);
+         symtab_and_line sal2 = find_pc_line (tpmarker->address, 0);
          sym = find_pc_sect_function (tpmarker->address, NULL);
          uiout->text ("Now in ");
          if (sym)
          sym = find_pc_sect_function (tpmarker->address, NULL);
          uiout->text ("Now in ");
          if (sym)
@@ -14000,8 +13463,6 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
 
          /* Might be nice to check if function changed, and warn if
             so.  */
 
          /* Might be nice to check if function changed, and warn if
             so.  */
-
-         release_static_tracepoint_marker (tpmarker);
        }
     }
   return sal;
        }
     }
   return sal;
@@ -14081,13 +13542,12 @@ hoist_existing_locations (struct breakpoint *b, struct program_space *pspace)
 void
 update_breakpoint_locations (struct breakpoint *b,
                             struct program_space *filter_pspace,
 void
 update_breakpoint_locations (struct breakpoint *b,
                             struct program_space *filter_pspace,
-                            struct symtabs_and_lines sals,
-                            struct symtabs_and_lines sals_end)
+                            gdb::array_view<const symtab_and_line> sals,
+                            gdb::array_view<const symtab_and_line> sals_end)
 {
 {
-  int i;
   struct bp_location *existing_locations;
 
   struct bp_location *existing_locations;
 
-  if (sals_end.nelts != 0 && (sals.nelts != 1 || sals_end.nelts != 1))
+  if (!sals_end.empty () && (sals.size () != 1 || sals_end.size () != 1))
     {
       /* Ranged breakpoints have only one start location and one end
         location.  */
     {
       /* Ranged breakpoints have only one start location and one end
         location.  */
@@ -14104,18 +13564,18 @@ update_breakpoint_locations (struct breakpoint *b,
      We'd like to retain the location, so that when the library is
      loaded again, we don't loose the enabled/disabled status of the
      individual locations.  */
      We'd like to retain the location, so that when the library is
      loaded again, we don't loose the enabled/disabled status of the
      individual locations.  */
-  if (all_locations_are_pending (b, filter_pspace) && sals.nelts == 0)
+  if (all_locations_are_pending (b, filter_pspace) && sals.empty ())
     return;
 
   existing_locations = hoist_existing_locations (b, filter_pspace);
 
     return;
 
   existing_locations = hoist_existing_locations (b, filter_pspace);
 
-  for (i = 0; i < sals.nelts; ++i)
+  for (const auto &sal : sals)
     {
       struct bp_location *new_loc;
 
     {
       struct bp_location *new_loc;
 
-      switch_to_program_space_and_thread (sals.sals[i].pspace);
+      switch_to_program_space_and_thread (sal.pspace);
 
 
-      new_loc = add_location_to_breakpoint (b, &(sals.sals[i]));
+      new_loc = add_location_to_breakpoint (b, &sal);
 
       /* Reparse conditions, they might contain references to the
         old symtab.  */
 
       /* Reparse conditions, they might contain references to the
         old symtab.  */
@@ -14126,8 +13586,8 @@ update_breakpoint_locations (struct breakpoint *b,
          s = b->cond_string;
          TRY
            {
          s = b->cond_string;
          TRY
            {
-             new_loc->cond = parse_exp_1 (&s, sals.sals[i].pc,
-                                          block_for_pc (sals.sals[i].pc), 
+             new_loc->cond = parse_exp_1 (&s, sal.pc,
+                                          block_for_pc (sal.pc),
                                           0);
            }
          CATCH (e, RETURN_MASK_ERROR)
                                           0);
            }
          CATCH (e, RETURN_MASK_ERROR)
@@ -14140,11 +13600,11 @@ update_breakpoint_locations (struct breakpoint *b,
          END_CATCH
        }
 
          END_CATCH
        }
 
-      if (sals_end.nelts)
+      if (!sals_end.empty ())
        {
        {
-         CORE_ADDR end = find_breakpoint_range_end (sals_end.sals[0]);
+         CORE_ADDR end = find_breakpoint_range_end (sals_end[0]);
 
 
-         new_loc->length = end - sals.sals[0].pc + 1;
+         new_loc->length = end - sals[0].pc + 1;
        }
     }
 
        }
     }
 
@@ -14188,24 +13648,25 @@ update_breakpoint_locations (struct breakpoint *b,
   }
 
   if (!locations_are_equal (existing_locations, b->loc))
   }
 
   if (!locations_are_equal (existing_locations, b->loc))
-    observer_notify_breakpoint_modified (b);
+    gdb::observers::breakpoint_modified.notify (b);
 }
 
 /* Find the SaL locations corresponding to the given LOCATION.
    On return, FOUND will be 1 if any SaL was found, zero otherwise.  */
 
 }
 
 /* Find the SaL locations corresponding to the given LOCATION.
    On return, FOUND will be 1 if any SaL was found, zero otherwise.  */
 
-static struct symtabs_and_lines
+static std::vector<symtab_and_line>
 location_to_sals (struct breakpoint *b, struct event_location *location,
                  struct program_space *search_pspace, int *found)
 {
 location_to_sals (struct breakpoint *b, struct event_location *location,
                  struct program_space *search_pspace, int *found)
 {
-  struct symtabs_and_lines sals = {0};
   struct gdb_exception exception = exception_none;
 
   gdb_assert (b->ops != NULL);
 
   struct gdb_exception exception = exception_none;
 
   gdb_assert (b->ops != NULL);
 
+  std::vector<symtab_and_line> sals;
+
   TRY
     {
   TRY
     {
-      b->ops->decode_location (b, location, search_pspace, &sals);
+      sals = b->ops->decode_location (b, location, search_pspace);
     }
   CATCH (e, RETURN_MASK_ERROR)
     {
     }
   CATCH (e, RETURN_MASK_ERROR)
     {
@@ -14246,16 +13707,14 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
 
   if (exception.reason == 0 || exception.error != NOT_FOUND_ERROR)
     {
 
   if (exception.reason == 0 || exception.error != NOT_FOUND_ERROR)
     {
-      int i;
-
-      for (i = 0; i < sals.nelts; ++i)
-       resolve_sal_pc (&sals.sals[i]);
+      for (auto &sal : sals)
+       resolve_sal_pc (&sal);
       if (b->condition_not_parsed && b->extra_string != NULL)
        {
          char *cond_string, *extra_string;
          int thread, task;
 
       if (b->condition_not_parsed && b->extra_string != NULL)
        {
          char *cond_string, *extra_string;
          int thread, task;
 
-         find_condition_and_thread (b->extra_string, sals.sals[0].pc,
+         find_condition_and_thread (b->extra_string, sals[0].pc,
                                     &cond_string, &thread, &task,
                                     &extra_string);
          gdb_assert (b->cond_string == NULL);
                                     &cond_string, &thread, &task,
                                     &extra_string);
          gdb_assert (b->cond_string == NULL);
@@ -14272,7 +13731,7 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
        }
 
       if (b->type == bp_static_tracepoint && !strace_marker_p (b))
        }
 
       if (b->type == bp_static_tracepoint && !strace_marker_p (b))
-       sals.sals[0] = update_static_tracepoint (b, sals.sals[0]);
+       sals[0] = update_static_tracepoint (b, sals[0]);
 
       *found = 1;
     }
 
       *found = 1;
     }
@@ -14289,28 +13748,22 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
 static void
 breakpoint_re_set_default (struct breakpoint *b)
 {
 static void
 breakpoint_re_set_default (struct breakpoint *b)
 {
-  int found;
-  struct symtabs_and_lines sals, sals_end;
-  struct symtabs_and_lines expanded = {0};
-  struct symtabs_and_lines expanded_end = {0};
   struct program_space *filter_pspace = current_program_space;
   struct program_space *filter_pspace = current_program_space;
+  std::vector<symtab_and_line> expanded, expanded_end;
 
 
-  sals = location_to_sals (b, b->location.get (), filter_pspace, &found);
+  int found;
+  std::vector<symtab_and_line> sals = location_to_sals (b, b->location.get (),
+                                                       filter_pspace, &found);
   if (found)
   if (found)
-    {
-      make_cleanup (xfree, sals.sals);
-      expanded = sals;
-    }
+    expanded = std::move (sals);
 
   if (b->location_range_end != NULL)
     {
 
   if (b->location_range_end != NULL)
     {
-      sals_end = location_to_sals (b, b->location_range_end.get (),
-                                  filter_pspace, &found);
+      std::vector<symtab_and_line> sals_end
+       = location_to_sals (b, b->location_range_end.get (),
+                           filter_pspace, &found);
       if (found)
       if (found)
-       {
-         make_cleanup (xfree, sals_end.sals);
-         expanded_end = sals_end;
-       }
+       expanded_end = std::move (sals_end);
     }
 
   update_breakpoint_locations (b, filter_pspace, expanded, expanded_end);
     }
 
   update_breakpoint_locations (b, filter_pspace, expanded, expanded_end);
@@ -14355,11 +13808,10 @@ create_breakpoints_sal_default (struct gdbarch *gdbarch,
 /* Decode the line represented by S by calling decode_line_full.  This is the
    default function for the `decode_location' method of breakpoint_ops.  */
 
 /* Decode the line represented by S by calling decode_line_full.  This is the
    default function for the `decode_location' method of breakpoint_ops.  */
 
-static void
+static std::vector<symtab_and_line>
 decode_location_default (struct breakpoint *b,
                         const struct event_location *location,
 decode_location_default (struct breakpoint *b,
                         const struct event_location *location,
-                        struct program_space *search_pspace,
-                        struct symtabs_and_lines *sals)
+                        struct program_space *search_pspace)
 {
   struct linespec_result canonical;
 
 {
   struct linespec_result canonical;
 
@@ -14369,46 +13821,25 @@ decode_location_default (struct breakpoint *b,
                    b->filter);
 
   /* We should get 0 or 1 resulting SALs.  */
                    b->filter);
 
   /* We should get 0 or 1 resulting SALs.  */
-  gdb_assert (VEC_length (linespec_sals, canonical.sals) < 2);
+  gdb_assert (canonical.lsals.size () < 2);
 
 
-  if (VEC_length (linespec_sals, canonical.sals) > 0)
+  if (!canonical.lsals.empty ())
     {
     {
-      struct linespec_sals *lsal;
-
-      lsal = VEC_index (linespec_sals, canonical.sals, 0);
-      *sals = lsal->sals;
-      /* Arrange it so the destructor does not free the
-        contents.  */
-      lsal->sals.sals = NULL;
+      const linespec_sals &lsal = canonical.lsals[0];
+      return std::move (lsal.sals);
     }
     }
+  return {};
 }
 
 }
 
-/* Prepare the global context for a re-set of breakpoint B.  */
+/* Reset a breakpoint.  */
 
 
-static struct cleanup *
-prepare_re_set_context (struct breakpoint *b)
+static void
+breakpoint_re_set_one (breakpoint *b)
 {
   input_radix = b->input_radix;
   set_language (b->language);
 
 {
   input_radix = b->input_radix;
   set_language (b->language);
 
-  return make_cleanup (null_cleanup, NULL);
-}
-
-/* Reset a breakpoint given it's struct breakpoint * BINT.
-   The value we return ends up being the return value from catch_errors.
-   Unused in this case.  */
-
-static int
-breakpoint_re_set_one (void *bint)
-{
-  /* Get past catch_errs.  */
-  struct breakpoint *b = (struct breakpoint *) bint;
-  struct cleanup *cleanups;
-
-  cleanups = prepare_re_set_context (b);
   b->ops->re_set (b);
   b->ops->re_set (b);
-  do_cleanups (cleanups);
-  return 0;
 }
 
 /* Re-set breakpoint locations for the current program space.
 }
 
 /* Re-set breakpoint locations for the current program space.
@@ -14418,15 +13849,25 @@ void
 breakpoint_re_set (void)
 {
   struct breakpoint *b, *b_tmp;
 breakpoint_re_set (void)
 {
   struct breakpoint *b, *b_tmp;
-  enum language save_language;
-  int save_input_radix;
-
-  save_language = current_language->la_language;
-  save_input_radix = input_radix;
 
   {
 
   {
+    scoped_restore_current_language save_language;
+    scoped_restore save_input_radix = make_scoped_restore (&input_radix);
     scoped_restore_current_pspace_and_thread restore_pspace_thread;
 
     scoped_restore_current_pspace_and_thread restore_pspace_thread;
 
+    /* breakpoint_re_set_one sets the current_language to the language
+       of the breakpoint it is resetting (see prepare_re_set_context)
+       before re-evaluating the breakpoint's location.  This change can
+       unfortunately get undone by accident if the language_mode is set
+       to auto, and we either switch frames, or more likely in this context,
+       we select the current frame.
+
+       We prevent this by temporarily turning the language_mode to
+       language_mode_manual.  We restore it once all breakpoints
+       have been reset.  */
+    scoped_restore save_language_mode = make_scoped_restore (&language_mode);
+    language_mode = language_mode_manual;
+
     /* Note: we must not try to insert locations until after all
        breakpoints have been re-set.  Otherwise, e.g., when re-setting
        breakpoint 1, we'd insert the locations of breakpoint 2, which
     /* Note: we must not try to insert locations until after all
        breakpoints have been re-set.  Otherwise, e.g., when re-setting
        breakpoint 1, we'd insert the locations of breakpoint 2, which
@@ -14434,15 +13875,18 @@ breakpoint_re_set (void)
 
     ALL_BREAKPOINTS_SAFE (b, b_tmp)
       {
 
     ALL_BREAKPOINTS_SAFE (b, b_tmp)
       {
-       /* Format possible error msg.  */
-       char *message = xstrprintf ("Error in re-setting breakpoint %d: ",
-                                   b->number);
-       struct cleanup *cleanups = make_cleanup (xfree, message);
-       catch_errors (breakpoint_re_set_one, b, message, RETURN_MASK_ALL);
-       do_cleanups (cleanups);
+       TRY
+         {
+           breakpoint_re_set_one (b);
+         }
+       CATCH (ex, RETURN_MASK_ALL)
+         {
+           exception_fprintf (gdb_stderr, ex,
+                              "Error in re-setting breakpoint %d: ",
+                              b->number);
+         }
+       END_CATCH
       }
       }
-    set_language (save_language);
-    input_radix = save_input_radix;
 
     jit_breakpoint_re_set ();
   }
 
     jit_breakpoint_re_set ();
   }
@@ -14465,8 +13909,7 @@ breakpoint_re_set_thread (struct breakpoint *b)
 {
   if (b->thread != -1)
     {
 {
   if (b->thread != -1)
     {
-      if (in_thread_list (inferior_ptid))
-       b->thread = ptid_to_global_thread_id (inferior_ptid);
+      b->thread = inferior_thread ()->global_num;
 
       /* We're being called after following a fork.  The new fork is
         selected as current, and unless this was a vfork will have a
 
       /* We're being called after following a fork.  The new fork is
         selected as current, and unless this was a vfork will have a
@@ -14514,7 +13957,7 @@ set_ignore_count (int bptnum, int count, int from_tty)
                               "crossings of breakpoint %d."),
                             count, bptnum);
        }
                               "crossings of breakpoint %d."),
                             count, bptnum);
        }
-      observer_notify_breakpoint_modified (b);
+      gdb::observers::breakpoint_modified.notify (b);
       return;
     }
 
       return;
     }
 
@@ -14524,9 +13967,9 @@ set_ignore_count (int bptnum, int count, int from_tty)
 /* Command to set ignore-count of breakpoint N to COUNT.  */
 
 static void
 /* Command to set ignore-count of breakpoint N to COUNT.  */
 
 static void
-ignore_command (char *args, int from_tty)
+ignore_command (const char *args, int from_tty)
 {
 {
-  char *p = args;
+  const char *p = args;
   int num;
 
   if (p == 0)
   int num;
 
   if (p == 0)
@@ -14545,64 +13988,66 @@ ignore_command (char *args, int from_tty)
     printf_filtered ("\n");
 }
 \f
     printf_filtered ("\n");
 }
 \f
-/* Call FUNCTION on each of the breakpoints
-   whose numbers are given in ARGS.  */
+
+/* Call FUNCTION on each of the breakpoints with numbers in the range
+   defined by BP_NUM_RANGE (an inclusive range).  */
 
 static void
 
 static void
-map_breakpoint_numbers (const char *args,
-                       void (*function) (struct breakpoint *,
-                                         void *),
-                       void *data)
+map_breakpoint_number_range (std::pair<int, int> bp_num_range,
+                            gdb::function_view<void (breakpoint *)> function)
 {
 {
-  int num;
-  struct breakpoint *b, *tmp;
-
-  if (args == 0 || *args == '\0')
-    error_no_arg (_("one or more breakpoint numbers"));
-
-  number_or_range_parser parser (args);
-
-  while (!parser.finished ())
+  if (bp_num_range.first == 0)
+    {
+      warning (_("bad breakpoint number at or near '%d'"),
+              bp_num_range.first);
+    }
+  else
     {
     {
-      const char *p = parser.cur_tok ();
-      bool match = false;
+      struct breakpoint *b, *tmp;
 
 
-      num = parser.get_number ();
-      if (num == 0)
-       {
-         warning (_("bad breakpoint number at or near '%s'"), p);
-       }
-      else
+      for (int i = bp_num_range.first; i <= bp_num_range.second; i++)
        {
        {
+         bool match = false;
+
          ALL_BREAKPOINTS_SAFE (b, tmp)
          ALL_BREAKPOINTS_SAFE (b, tmp)
-           if (b->number == num)
+           if (b->number == i)
              {
                match = true;
              {
                match = true;
-               function (b, data);
+               function (b);
                break;
              }
          if (!match)
                break;
              }
          if (!match)
-           printf_unfiltered (_("No breakpoint number %d.\n"), num);
+           printf_unfiltered (_("No breakpoint number %d.\n"), i);
        }
     }
 }
 
        }
     }
 }
 
-static struct bp_location *
-find_location_by_number (char *number)
+/* Call FUNCTION on each of the breakpoints whose numbers are given in
+   ARGS.  */
+
+static void
+map_breakpoint_numbers (const char *args,
+                       gdb::function_view<void (breakpoint *)> function)
 {
 {
-  char *dot = strchr (number, '.');
-  char *p1;
-  int bp_num;
-  int loc_num;
-  struct breakpoint *b;
-  struct bp_location *loc;  
+  if (args == NULL || *args == '\0')
+    error_no_arg (_("one or more breakpoint numbers"));
+
+  number_or_range_parser parser (args);
+
+  while (!parser.finished ())
+    {
+      int num = parser.get_number ();
+      map_breakpoint_number_range (std::make_pair (num, num), function);
+    }
+}
 
 
-  *dot = '\0';
+/* Return the breakpoint location structure corresponding to the
+   BP_NUM and LOC_NUM values.  */
 
 
-  p1 = number;
-  bp_num = get_number (&p1);
-  if (bp_num == 0)
-    error (_("Bad breakpoint number '%s'"), number);
+static struct bp_location *
+find_location_by_number (int bp_num, int loc_num)
+{
+  struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
     if (b->number == bp_num)
 
   ALL_BREAKPOINTS (b)
     if (b->number == bp_num)
@@ -14611,23 +14056,182 @@ find_location_by_number (char *number)
       }
 
   if (!b || b->number != bp_num)
       }
 
   if (!b || b->number != bp_num)
-    error (_("Bad breakpoint number '%s'"), number);
+    error (_("Bad breakpoint number '%d'"), bp_num);
   
   
-  p1 = dot+1;
-  loc_num = get_number (&p1);
   if (loc_num == 0)
   if (loc_num == 0)
-    error (_("Bad breakpoint location number '%s'"), number);
+    error (_("Bad breakpoint location number '%d'"), loc_num);
 
 
-  --loc_num;
-  loc = b->loc;
-  for (;loc_num && loc; --loc_num, loc = loc->next)
-    ;
-  if (!loc)
-    error (_("Bad breakpoint location number '%s'"), dot+1);
-    
-  return loc;  
+  int n = 0;
+  for (bp_location *loc = b->loc; loc != NULL; loc = loc->next)
+    if (++n == loc_num)
+      return loc;
+
+  error (_("Bad breakpoint location number '%d'"), loc_num);
+}
+
+/* Modes of operation for extract_bp_num.  */
+enum class extract_bp_kind
+{
+  /* Extracting a breakpoint number.  */
+  bp,
+
+  /* Extracting a location number.  */
+  loc,
+};
+
+/* Extract a breakpoint or location number (as determined by KIND)
+   from the string starting at START.  TRAILER is a character which
+   can be found after the number.  If you don't want a trailer, use
+   '\0'.  If END_OUT is not NULL, it is set to point after the parsed
+   string.  This always returns a positive integer.  */
+
+static int
+extract_bp_num (extract_bp_kind kind, const char *start,
+               int trailer, const char **end_out = NULL)
+{
+  const char *end = start;
+  int num = get_number_trailer (&end, trailer);
+  if (num < 0)
+    error (kind == extract_bp_kind::bp
+          ? _("Negative breakpoint number '%.*s'")
+          : _("Negative breakpoint location number '%.*s'"),
+          int (end - start), start);
+  if (num == 0)
+    error (kind == extract_bp_kind::bp
+          ? _("Bad breakpoint number '%.*s'")
+          : _("Bad breakpoint location number '%.*s'"),
+          int (end - start), start);
+
+  if (end_out != NULL)
+    *end_out = end;
+  return num;
+}
+
+/* Extract a breakpoint or location range (as determined by KIND) in
+   the form NUM1-NUM2 stored at &ARG[arg_offset].  Returns a std::pair
+   representing the (inclusive) range.  The returned pair's elements
+   are always positive integers.  */
+
+static std::pair<int, int>
+extract_bp_or_bp_range (extract_bp_kind kind,
+                       const std::string &arg,
+                       std::string::size_type arg_offset)
+{
+  std::pair<int, int> range;
+  const char *bp_loc = &arg[arg_offset];
+  std::string::size_type dash = arg.find ('-', arg_offset);
+  if (dash != std::string::npos)
+    {
+      /* bp_loc is a range (x-z).  */
+      if (arg.length () == dash + 1)
+       error (kind == extract_bp_kind::bp
+              ? _("Bad breakpoint number at or near: '%s'")
+              : _("Bad breakpoint location number at or near: '%s'"),
+              bp_loc);
+
+      const char *end;
+      const char *start_first = bp_loc;
+      const char *start_second = &arg[dash + 1];
+      range.first = extract_bp_num (kind, start_first, '-');
+      range.second = extract_bp_num (kind, start_second, '\0', &end);
+
+      if (range.first > range.second)
+       error (kind == extract_bp_kind::bp
+              ? _("Inverted breakpoint range at '%.*s'")
+              : _("Inverted breakpoint location range at '%.*s'"),
+              int (end - start_first), start_first);
+    }
+  else
+    {
+      /* bp_loc is a single value.  */
+      range.first = extract_bp_num (kind, bp_loc, '\0');
+      range.second = range.first;
+    }
+  return range;
+}
+
+/* Extract the breakpoint/location range specified by ARG.  Returns
+   the breakpoint range in BP_NUM_RANGE, and the location range in
+   BP_LOC_RANGE.
+
+   ARG may be in any of the following forms:
+
+   x     where 'x' is a breakpoint number.
+   x-y   where 'x' and 'y' specify a breakpoint numbers range.
+   x.y   where 'x' is a breakpoint number and 'y' a location number.
+   x.y-z where 'x' is a breakpoint number and 'y' and 'z' specify a
+        location number range.
+*/
+
+static void
+extract_bp_number_and_location (const std::string &arg,
+                               std::pair<int, int> &bp_num_range,
+                               std::pair<int, int> &bp_loc_range)
+{
+  std::string::size_type dot = arg.find ('.');
+
+  if (dot != std::string::npos)
+    {
+      /* Handle 'x.y' and 'x.y-z' cases.  */
+
+      if (arg.length () == dot + 1 || dot == 0)
+       error (_("Bad breakpoint number at or near: '%s'"), arg.c_str ());
+
+      bp_num_range.first
+       = extract_bp_num (extract_bp_kind::bp, arg.c_str (), '.');
+      bp_num_range.second = bp_num_range.first;
+
+      bp_loc_range = extract_bp_or_bp_range (extract_bp_kind::loc,
+                                            arg, dot + 1);
+    }
+  else
+    {
+      /* Handle x and x-y cases.  */
+
+      bp_num_range = extract_bp_or_bp_range (extract_bp_kind::bp, arg, 0);
+      bp_loc_range.first = 0;
+      bp_loc_range.second = 0;
+    }
 }
 
 }
 
+/* Enable or disable a breakpoint location BP_NUM.LOC_NUM.  ENABLE
+   specifies whether to enable or disable.  */
+
+static void
+enable_disable_bp_num_loc (int bp_num, int loc_num, bool enable)
+{
+  struct bp_location *loc = find_location_by_number (bp_num, loc_num);
+  if (loc != NULL)
+    {
+      if (loc->enabled != enable)
+       {
+         loc->enabled = enable;
+         mark_breakpoint_location_modified (loc);
+       }
+      if (target_supports_enable_disable_tracepoint ()
+         && current_trace_status ()->running && loc->owner
+         && is_tracepoint (loc->owner))
+       target_disable_tracepoint (loc);
+    }
+  update_global_location_list (UGLL_DONT_INSERT);
+
+  gdb::observers::breakpoint_modified.notify (loc->owner);
+}
+
+/* Enable or disable a range of breakpoint locations.  BP_NUM is the
+   number of the breakpoint, and BP_LOC_RANGE specifies the
+   (inclusive) range of location numbers of that breakpoint to
+   enable/disable.  ENABLE specifies whether to enable or disable the
+   location.  */
+
+static void
+enable_disable_breakpoint_location_range (int bp_num,
+                                         std::pair<int, int> &bp_loc_range,
+                                         bool enable)
+{
+  for (int i = bp_loc_range.first; i <= bp_loc_range.second; i++)
+    enable_disable_bp_num_loc (bp_num, i, enable);
+}
 
 /* Set ignore-count of breakpoint number BPTNUM to COUNT.
    If from_tty is nonzero, it prints a message to that effect,
 
 /* Set ignore-count of breakpoint number BPTNUM to COUNT.
    If from_tty is nonzero, it prints a message to that effect,
@@ -14658,28 +14262,16 @@ disable_breakpoint (struct breakpoint *bpt)
 
   update_global_location_list (UGLL_DONT_INSERT);
 
 
   update_global_location_list (UGLL_DONT_INSERT);
 
-  observer_notify_breakpoint_modified (bpt);
+  gdb::observers::breakpoint_modified.notify (bpt);
 }
 
 }
 
-/* A callback for iterate_over_related_breakpoints.  */
+/* Enable or disable the breakpoint(s) or breakpoint location(s)
+   specified in ARGS.  ARGS may be in any of the formats handled by
+   extract_bp_number_and_location.  ENABLE specifies whether to enable
+   or disable the breakpoints/locations.  */
 
 static void
 
 static void
-do_disable_breakpoint (struct breakpoint *b, void *ignore)
-{
-  disable_breakpoint (b);
-}
-
-/* A callback for map_breakpoint_numbers that calls
-   disable_breakpoint.  */
-
-static void
-do_map_disable_breakpoint (struct breakpoint *b, void *ignore)
-{
-  iterate_over_related_breakpoints (b, do_disable_breakpoint, NULL);
-}
-
-static void
-disable_command (char *args, int from_tty)
+enable_disable_command (const char *args, int from_tty, bool enable)
 {
   if (args == 0)
     {
 {
   if (args == 0)
     {
@@ -14687,39 +14279,55 @@ disable_command (char *args, int from_tty)
 
       ALL_BREAKPOINTS (bpt)
        if (user_breakpoint_p (bpt))
 
       ALL_BREAKPOINTS (bpt)
        if (user_breakpoint_p (bpt))
-         disable_breakpoint (bpt);
+         {
+           if (enable)
+             enable_breakpoint (bpt);
+           else
+             disable_breakpoint (bpt);
+         }
     }
   else
     {
     }
   else
     {
-      char *num = extract_arg (&args);
+      std::string num = extract_arg (&args);
 
 
-      while (num)
+      while (!num.empty ())
        {
        {
-         if (strchr (num, '.'))
-           {
-             struct bp_location *loc = find_location_by_number (num);
+         std::pair<int, int> bp_num_range, bp_loc_range;
 
 
-             if (loc)
-               {
-                 if (loc->enabled)
-                   {
-                     loc->enabled = 0;
-                     mark_breakpoint_location_modified (loc);
-                   }
-                 if (target_supports_enable_disable_tracepoint ()
-                     && current_trace_status ()->running && loc->owner
-                     && is_tracepoint (loc->owner))
-                   target_disable_tracepoint (loc);
-               }
-             update_global_location_list (UGLL_DONT_INSERT);
+         extract_bp_number_and_location (num, bp_num_range, bp_loc_range);
+
+         if (bp_loc_range.first == bp_loc_range.second
+             && bp_loc_range.first == 0)
+           {
+             /* Handle breakpoint ids with formats 'x' or 'x-z'.  */
+             map_breakpoint_number_range (bp_num_range,
+                                          enable
+                                          ? enable_breakpoint
+                                          : disable_breakpoint);
            }
          else
            }
          else
-           map_breakpoint_numbers (num, do_map_disable_breakpoint, NULL);
+           {
+             /* Handle breakpoint ids with formats 'x.y' or
+                'x.y-z'.  */
+             enable_disable_breakpoint_location_range
+               (bp_num_range.first, bp_loc_range, enable);
+           }
          num = extract_arg (&args);
        }
     }
 }
 
          num = extract_arg (&args);
        }
     }
 }
 
+/* The disable command disables the specified breakpoints/locations
+   (or all defined breakpoints) so they're no longer effective in
+   stopping the inferior.  ARGS may be in any of the forms defined in
+   extract_bp_number_and_location.  */
+
+static void
+disable_command (const char *args, int from_tty)
+{
+  enable_disable_command (args, from_tty, false);
+}
+
 static void
 enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
                        int count)
 static void
 enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
                        int count)
@@ -14780,7 +14388,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
   bpt->enable_count = count;
   update_global_location_list (UGLL_MAY_INSERT);
 
   bpt->enable_count = count;
   update_global_location_list (UGLL_MAY_INSERT);
 
-  observer_notify_breakpoint_modified (bpt);
+  gdb::observers::breakpoint_modified.notify (bpt);
 }
 
 
 }
 
 
@@ -14790,108 +14398,33 @@ enable_breakpoint (struct breakpoint *bpt)
   enable_breakpoint_disp (bpt, bpt->disposition, 0);
 }
 
   enable_breakpoint_disp (bpt, bpt->disposition, 0);
 }
 
-static void
-do_enable_breakpoint (struct breakpoint *bpt, void *arg)
-{
-  enable_breakpoint (bpt);
-}
-
-/* A callback for map_breakpoint_numbers that calls
-   enable_breakpoint.  */
+/* The enable command enables the specified breakpoints/locations (or
+   all defined breakpoints) so they once again become (or continue to
+   be) effective in stopping the inferior.  ARGS may be in any of the
+   forms defined in extract_bp_number_and_location.  */
 
 static void
 
 static void
-do_map_enable_breakpoint (struct breakpoint *b, void *ignore)
+enable_command (const char *args, int from_tty)
 {
 {
-  iterate_over_related_breakpoints (b, do_enable_breakpoint, NULL);
+  enable_disable_command (args, from_tty, true);
 }
 
 }
 
-/* The enable command enables the specified breakpoints (or all defined
-   breakpoints) so they once again become (or continue to be) effective
-   in stopping the inferior.  */
-
 static void
 static void
-enable_command (char *args, int from_tty)
+enable_once_command (const char *args, int from_tty)
 {
 {
-  if (args == 0)
-    {
-      struct breakpoint *bpt;
-
-      ALL_BREAKPOINTS (bpt)
-       if (user_breakpoint_p (bpt))
-         enable_breakpoint (bpt);
-    }
-  else
-    {
-      char *num = extract_arg (&args);
-
-      while (num)
-       {
-         if (strchr (num, '.'))
-           {
-             struct bp_location *loc = find_location_by_number (num);
-
-             if (loc)
-               {
-                 if (!loc->enabled)
-                   {
-                     loc->enabled = 1;
-                     mark_breakpoint_location_modified (loc);
-                   }
-                 if (target_supports_enable_disable_tracepoint ()
-                     && current_trace_status ()->running && loc->owner
-                     && is_tracepoint (loc->owner))
-                   target_enable_tracepoint (loc);
-               }
-             update_global_location_list (UGLL_MAY_INSERT);
-           }
-         else
-           map_breakpoint_numbers (num, do_map_enable_breakpoint, NULL);
-         num = extract_arg (&args);
-       }
-    }
-}
-
-/* This struct packages up disposition data for application to multiple
-   breakpoints.  */
-
-struct disp_data
-{
-  enum bpdisp disp;
-  int count;
-};
-
-static void
-do_enable_breakpoint_disp (struct breakpoint *bpt, void *arg)
-{
-  struct disp_data disp_data = *(struct disp_data *) arg;
-
-  enable_breakpoint_disp (bpt, disp_data.disp, disp_data.count);
-}
-
-static void
-do_map_enable_once_breakpoint (struct breakpoint *bpt, void *ignore)
-{
-  struct disp_data disp = { disp_disable, 1 };
-
-  iterate_over_related_breakpoints (bpt, do_enable_breakpoint_disp, &disp);
-}
-
-static void
-enable_once_command (char *args, int from_tty)
-{
-  map_breakpoint_numbers (args, do_map_enable_once_breakpoint, NULL);
-}
-
-static void
-do_map_enable_count_breakpoint (struct breakpoint *bpt, void *countptr)
-{
-  struct disp_data disp = { disp_disable, *(int *) countptr };
-
-  iterate_over_related_breakpoints (bpt, do_enable_breakpoint_disp, &disp);
+  map_breakpoint_numbers
+    (args, [&] (breakpoint *b)
+     {
+       iterate_over_related_breakpoints
+        (b, [&] (breakpoint *bpt)
+         {
+           enable_breakpoint_disp (bpt, disp_disable, 1);
+         });
+     });
 }
 
 static void
 }
 
 static void
-enable_count_command (char *args, int from_tty)
+enable_count_command (const char *args, int from_tty)
 {
   int count;
 
 {
   int count;
 
@@ -14900,30 +14433,38 @@ enable_count_command (char *args, int from_tty)
 
   count = get_number (&args);
 
 
   count = get_number (&args);
 
-  map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
-}
-
-static void
-do_map_enable_delete_breakpoint (struct breakpoint *bpt, void *ignore)
-{
-  struct disp_data disp = { disp_del, 1 };
-
-  iterate_over_related_breakpoints (bpt, do_enable_breakpoint_disp, &disp);
+  map_breakpoint_numbers
+    (args, [&] (breakpoint *b)
+     {
+       iterate_over_related_breakpoints
+        (b, [&] (breakpoint *bpt)
+         {
+           enable_breakpoint_disp (bpt, disp_disable, count);
+         });
+     });
 }
 
 static void
 }
 
 static void
-enable_delete_command (char *args, int from_tty)
+enable_delete_command (const char *args, int from_tty)
 {
 {
-  map_breakpoint_numbers (args, do_map_enable_delete_breakpoint, NULL);
+  map_breakpoint_numbers
+    (args, [&] (breakpoint *b)
+     {
+       iterate_over_related_breakpoints
+        (b, [&] (breakpoint *bpt)
+         {
+           enable_breakpoint_disp (bpt, disp_del, 1);
+         });
+     });
 }
 \f
 static void
 }
 \f
 static void
-set_breakpoint_cmd (char *args, int from_tty)
+set_breakpoint_cmd (const char *args, int from_tty)
 {
 }
 
 static void
 {
 }
 
 static void
-show_breakpoint_cmd (char *args, int from_tty)
+show_breakpoint_cmd (const char *args, int from_tty)
 {
 }
 
 {
 }
 
@@ -14944,7 +14485,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
       {
        struct watchpoint *wp = (struct watchpoint *) bp;
 
       {
        struct watchpoint *wp = (struct watchpoint *) bp;
 
-       if (wp->val_valid && wp->val)
+       if (wp->val_valid && wp->val != nullptr)
          {
            struct bp_location *loc;
 
          {
            struct bp_location *loc;
 
@@ -14953,7 +14494,6 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
                  && loc->address + loc->length > addr
                  && addr + len > loc->address)
                {
                  && loc->address + loc->length > addr
                  && addr + len > loc->address)
                {
-                 value_free (wp->val);
                  wp->val = NULL;
                  wp->val_valid = 0;
                }
                  wp->val = NULL;
                  wp->val_valid = 0;
                }
@@ -14965,7 +14505,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
 
 void
 insert_single_step_breakpoint (struct gdbarch *gdbarch,
 
 void
 insert_single_step_breakpoint (struct gdbarch *gdbarch,
-                              struct address_space *aspace, 
+                              const address_space *aspace,
                               CORE_ADDR next_pc)
 {
   struct thread_info *tp = inferior_thread ();
                               CORE_ADDR next_pc)
 {
   struct thread_info *tp = inferior_thread ();
@@ -15000,7 +14540,7 @@ insert_single_step_breakpoints (struct gdbarch *gdbarch)
   if (!next_pcs.empty ())
     {
       struct frame_info *frame = get_current_frame ();
   if (!next_pcs.empty ())
     {
       struct frame_info *frame = get_current_frame ();
-      struct address_space *aspace = get_frame_address_space (frame);
+      const address_space *aspace = get_frame_address_space (frame);
 
       for (CORE_ADDR pc : next_pcs)
        insert_single_step_breakpoint (gdbarch, aspace, pc);
 
       for (CORE_ADDR pc : next_pcs)
        insert_single_step_breakpoint (gdbarch, aspace, pc);
@@ -15015,7 +14555,7 @@ insert_single_step_breakpoints (struct gdbarch *gdbarch)
 
 int
 breakpoint_has_location_inserted_here (struct breakpoint *bp,
 
 int
 breakpoint_has_location_inserted_here (struct breakpoint *bp,
-                                      struct address_space *aspace,
+                                      const address_space *aspace,
                                       CORE_ADDR pc)
 {
   struct bp_location *loc;
                                       CORE_ADDR pc)
 {
   struct bp_location *loc;
@@ -15032,7 +14572,7 @@ breakpoint_has_location_inserted_here (struct breakpoint *bp,
    PC.  */
 
 int
    PC.  */
 
 int
-single_step_breakpoint_inserted_here_p (struct address_space *aspace,
+single_step_breakpoint_inserted_here_p (const address_space *aspace,
                                        CORE_ADDR pc)
 {
   struct breakpoint *bpt;
                                        CORE_ADDR pc)
 {
   struct breakpoint *bpt;
@@ -15057,7 +14597,7 @@ set_tracepoint_count (int num)
 }
 
 static void
 }
 
 static void
-trace_command (char *arg, int from_tty)
+trace_command (const char *arg, int from_tty)
 {
   struct breakpoint_ops *ops;
 
 {
   struct breakpoint_ops *ops;
 
@@ -15083,7 +14623,7 @@ trace_command (char *arg, int from_tty)
 }
 
 static void
 }
 
 static void
-ftrace_command (char *arg, int from_tty)
+ftrace_command (const char *arg, int from_tty)
 {
   event_location_up location = string_to_event_location (&arg,
                                                         current_language);
 {
   event_location_up location = string_to_event_location (&arg,
                                                         current_language);
@@ -15103,18 +14643,17 @@ ftrace_command (char *arg, int from_tty)
 /* strace command implementation.  Creates a static tracepoint.  */
 
 static void
 /* strace command implementation.  Creates a static tracepoint.  */
 
 static void
-strace_command (char *arg, int from_tty)
+strace_command (const char *arg, int from_tty)
 {
   struct breakpoint_ops *ops;
   event_location_up location;
 {
   struct breakpoint_ops *ops;
   event_location_up location;
-  struct cleanup *back_to;
 
   /* Decide if we are dealing with a static tracepoint marker (`-m'),
      or with a normal static tracepoint.  */
   if (arg && startswith (arg, "-m") && isspace (arg[2]))
     {
       ops = &strace_marker_breakpoint_ops;
 
   /* Decide if we are dealing with a static tracepoint marker (`-m'),
      or with a normal static tracepoint.  */
   if (arg && startswith (arg, "-m") && isspace (arg[2]))
     {
       ops = &strace_marker_breakpoint_ops;
-      location = new_linespec_location (&arg);
+      location = new_linespec_location (&arg, symbol_name_match_type::FULL);
     }
   else
     {
     }
   else
     {
@@ -15144,11 +14683,13 @@ static int next_cmd;
 static char *
 read_uploaded_action (void)
 {
 static char *
 read_uploaded_action (void)
 {
-  char *rslt;
-
-  VEC_iterate (char_ptr, this_utp->cmd_strings, next_cmd, rslt);
+  char *rslt = nullptr;
 
 
-  next_cmd++;
+  if (next_cmd < this_utp->cmd_strings.size ())
+    {
+      rslt = this_utp->cmd_strings[next_cmd];
+      next_cmd++;
+    }
 
   return rslt;
 }
 
   return rslt;
 }
@@ -15162,7 +14703,8 @@ read_uploaded_action (void)
 struct tracepoint *
 create_tracepoint_from_upload (struct uploaded_tp *utp)
 {
 struct tracepoint *
 create_tracepoint_from_upload (struct uploaded_tp *utp)
 {
-  char *addr_str, small_buf[100];
+  const char *addr_str;
+  char small_buf[100];
   struct tracepoint *tp;
 
   if (utp->at_string)
   struct tracepoint *tp;
 
   if (utp->at_string)
@@ -15219,19 +14761,19 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
      special-purpose "reader" function and call the usual command line
      reader, then pass the result to the breakpoint command-setting
      function.  */
      special-purpose "reader" function and call the usual command line
      reader, then pass the result to the breakpoint command-setting
      function.  */
-  if (!VEC_empty (char_ptr, utp->cmd_strings))
+  if (!utp->cmd_strings.empty ())
     {
     {
-      command_line_up cmd_list;
+      counted_command_line cmd_list;
 
       this_utp = utp;
       next_cmd = 0;
 
 
       this_utp = utp;
       next_cmd = 0;
 
-      cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL);
+      cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL);
 
       breakpoint_set_commands (tp, std::move (cmd_list));
     }
 
       breakpoint_set_commands (tp, std::move (cmd_list));
     }
-  else if (!VEC_empty (char_ptr, utp->actions)
-          || !VEC_empty (char_ptr, utp->step_actions))
+  else if (!utp->actions.empty ()
+          || !utp->step_actions.empty ())
     warning (_("Uploaded tracepoint %d actions "
               "have no source form, ignoring them"),
             utp->number);
     warning (_("Uploaded tracepoint %d actions "
               "have no source form, ignoring them"),
             utp->number);
@@ -15247,7 +14789,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
    omitted.  */
 
 static void
    omitted.  */
 
 static void
-tracepoints_info (char *args, int from_tty)
+info_tracepoints_command (const char *args, int from_tty)
 {
   struct ui_out *uiout = current_uiout;
   int num_printed;
 {
   struct ui_out *uiout = current_uiout;
   int num_printed;
@@ -15268,7 +14810,7 @@ tracepoints_info (char *args, int from_tty)
 /* The 'enable trace' command enables tracepoints.
    Not supported by all targets.  */
 static void
 /* The 'enable trace' command enables tracepoints.
    Not supported by all targets.  */
 static void
-enable_trace_command (char *args, int from_tty)
+enable_trace_command (const char *args, int from_tty)
 {
   enable_command (args, from_tty);
 }
 {
   enable_command (args, from_tty);
 }
@@ -15276,14 +14818,14 @@ enable_trace_command (char *args, int from_tty)
 /* The 'disable trace' command disables tracepoints.
    Not supported by all targets.  */
 static void
 /* The 'disable trace' command disables tracepoints.
    Not supported by all targets.  */
 static void
-disable_trace_command (char *args, int from_tty)
+disable_trace_command (const char *args, int from_tty)
 {
   disable_command (args, from_tty);
 }
 
 /* Remove a tracepoint (or all if no argument).  */
 static void
 {
   disable_command (args, from_tty);
 }
 
 /* Remove a tracepoint (or all if no argument).  */
 static void
-delete_trace_command (char *arg, int from_tty)
+delete_trace_command (const char *arg, int from_tty)
 {
   struct breakpoint *b, *b_tmp;
 
 {
   struct breakpoint *b, *b_tmp;
 
@@ -15314,7 +14856,11 @@ delete_trace_command (char *arg, int from_tty)
        }
     }
   else
        }
     }
   else
-    map_breakpoint_numbers (arg, do_map_delete_breakpoint, NULL);
+    map_breakpoint_numbers
+      (arg, [&] (breakpoint *br)
+       {
+        iterate_over_related_breakpoints (br, delete_breakpoint);
+       });
 }
 
 /* Helper function for trace_pass_command.  */
 }
 
 /* Helper function for trace_pass_command.  */
@@ -15323,7 +14869,7 @@ static void
 trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
 {
   tp->pass_count = count;
 trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
 {
   tp->pass_count = count;
-  observer_notify_breakpoint_modified (tp);
+  gdb::observers::breakpoint_modified.notify (tp);
   if (from_tty)
     printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
                     tp->number, count);
   if (from_tty)
     printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
                     tp->number, count);
@@ -15336,16 +14882,16 @@ trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
    Also accepts special argument "all".  */
 
 static void
    Also accepts special argument "all".  */
 
 static void
-trace_pass_command (char *args, int from_tty)
+trace_pass_command (const char *args, int from_tty)
 {
   struct tracepoint *t1;
 {
   struct tracepoint *t1;
-  unsigned int count;
+  ULONGEST count;
 
   if (args == 0 || *args == 0)
     error (_("passcount command requires an "
             "argument (count + optional TP num)"));
 
 
   if (args == 0 || *args == 0)
     error (_("passcount command requires an "
             "argument (count + optional TP num)"));
 
-  count = strtoul (args, &args, 10);   /* Count comes first, then TP num.  */
+  count = strtoulst (args, &args, 10); /* Count comes first, then TP num.  */
 
   args = skip_spaces (args);
   if (*args && strncasecmp (args, "all", 3) == 0)
 
   args = skip_spaces (args);
   if (*args && strncasecmp (args, "all", 3) == 0)
@@ -15418,12 +14964,12 @@ get_tracepoint_by_number_on_target (int num)
    (tracepoint_count) is returned.  */
 
 struct tracepoint *
    (tracepoint_count) is returned.  */
 
 struct tracepoint *
-get_tracepoint_by_number (char **arg,
+get_tracepoint_by_number (const char **arg,
                          number_or_range_parser *parser)
 {
   struct breakpoint *t;
   int tpnum;
                          number_or_range_parser *parser)
 {
   struct breakpoint *t;
   int tpnum;
-  char *instring = arg == NULL ? NULL : *arg;
+  const char *instring = arg == NULL ? NULL : *arg;
 
   if (parser != NULL)
     {
 
   if (parser != NULL)
     {
@@ -15473,12 +15019,11 @@ print_recreate_thread (struct breakpoint *b, struct ui_file *fp)
    non-zero.  */
 
 static void
    non-zero.  */
 
 static void
-save_breakpoints (char *filename, int from_tty,
+save_breakpoints (const char *filename, int from_tty,
                  int (*filter) (const struct breakpoint *))
 {
   struct breakpoint *tp;
   int any = 0;
                  int (*filter) (const struct breakpoint *))
 {
   struct breakpoint *tp;
   int any = 0;
-  struct cleanup *cleanup;
   int extra_trace_bits = 0;
 
   if (filename == 0 || *filename == 0)
   int extra_trace_bits = 0;
 
   if (filename == 0 || *filename == 0)
@@ -15512,14 +15057,13 @@ save_breakpoints (char *filename, int from_tty,
       return;
     }
 
       return;
     }
 
-  filename = tilde_expand (filename);
-  cleanup = make_cleanup (xfree, filename);
+  gdb::unique_xmalloc_ptr<char> expanded_filename (tilde_expand (filename));
 
   stdio_file fp;
 
 
   stdio_file fp;
 
-  if (!fp.open (filename, "w"))
+  if (!fp.open (expanded_filename.get (), "w"))
     error (_("Unable to open file '%s' for saving (%s)"),
     error (_("Unable to open file '%s' for saving (%s)"),
-          filename, safe_strerror (errno));
+          expanded_filename.get (), safe_strerror (errno));
 
   if (extra_trace_bits)
     save_trace_state_variables (&fp);
 
   if (extra_trace_bits)
     save_trace_state_variables (&fp);
@@ -15553,7 +15097,7 @@ save_breakpoints (char *filename, int from_tty,
        current_uiout->redirect (&fp);
        TRY
          {
        current_uiout->redirect (&fp);
        TRY
          {
-           print_command_lines (current_uiout, tp->commands->commands, 2);
+           print_command_lines (current_uiout, tp->commands.get (), 2);
          }
        CATCH (ex, RETURN_MASK_ALL)
          {
          }
        CATCH (ex, RETURN_MASK_ALL)
          {
@@ -15587,14 +15131,13 @@ save_breakpoints (char *filename, int from_tty,
     fp.printf ("set default-collect %s\n", default_collect);
 
   if (from_tty)
     fp.printf ("set default-collect %s\n", default_collect);
 
   if (from_tty)
-    printf_filtered (_("Saved to file '%s'.\n"), filename);
-  do_cleanups (cleanup);
+    printf_filtered (_("Saved to file '%s'.\n"), expanded_filename.get ());
 }
 
 /* The `save breakpoints' command.  */
 
 static void
 }
 
 /* The `save breakpoints' command.  */
 
 static void
-save_breakpoints_command (char *args, int from_tty)
+save_breakpoints_command (const char *args, int from_tty)
 {
   save_breakpoints (args, from_tty, NULL);
 }
 {
   save_breakpoints (args, from_tty, NULL);
 }
@@ -15602,22 +15145,22 @@ save_breakpoints_command (char *args, int from_tty)
 /* The `save tracepoints' command.  */
 
 static void
 /* The `save tracepoints' command.  */
 
 static void
-save_tracepoints_command (char *args, int from_tty)
+save_tracepoints_command (const char *args, int from_tty)
 {
   save_breakpoints (args, from_tty, is_tracepoint);
 }
 
 /* Create a vector of all tracepoints.  */
 
 {
   save_breakpoints (args, from_tty, is_tracepoint);
 }
 
 /* Create a vector of all tracepoints.  */
 
-VEC(breakpoint_p) *
+std::vector<breakpoint *>
 all_tracepoints (void)
 {
 all_tracepoints (void)
 {
-  VEC(breakpoint_p) *tp_vec = 0;
+  std::vector<breakpoint *> tp_vec;
   struct breakpoint *tp;
 
   ALL_TRACEPOINTS (tp)
   {
   struct breakpoint *tp;
 
   ALL_TRACEPOINTS (tp)
   {
-    VEC_safe_push (breakpoint_p, tp_vec, tp);
+    tp_vec.push_back (tp);
   }
 
   return tp_vec;
   }
 
   return tp_vec;
@@ -15642,7 +15185,14 @@ Explicit locations are similar to linespecs but use an option/argument\n\
 syntax to specify location parameters.\n\
 Example: To specify the start of the label named \"the_top\" in the\n\
 function \"fact\" in the file \"factorial.c\", use \"-source factorial.c\n\
 syntax to specify location parameters.\n\
 Example: To specify the start of the label named \"the_top\" in the\n\
 function \"fact\" in the file \"factorial.c\", use \"-source factorial.c\n\
--function fact -label the_top\".\n"
+-function fact -label the_top\".\n\
+\n\
+By default, a specified function is matched against the program's\n\
+functions in all scopes.  For C++, this means in all namespaces and\n\
+classes.  For Ada, this means in all packages.  E.g., in C++,\n\
+\"func()\" matches \"A::func()\", \"A::B::func()\", etc.  The\n\
+\"-qualified\" flag overrides this behavior, making GDB interpret the\n\
+specified name as a complete fully-qualified name instead.\n"
 
 /* This help string is used for the break, hbreak, tbreak and thbreak
    commands.  It is defined as a macro to prevent duplication.
 
 /* This help string is used for the break, hbreak, tbreak and thbreak
    commands.  It is defined as a macro to prevent duplication.
@@ -15677,20 +15227,20 @@ static struct cmd_list_element *tcatch_cmdlist;
 
 void
 add_catch_command (const char *name, const char *docstring,
 
 void
 add_catch_command (const char *name, const char *docstring,
-                  cmd_sfunc_ftype *sfunc,
+                  cmd_const_sfunc_ftype *sfunc,
                   completer_ftype *completer,
                   void *user_data_catch,
                   void *user_data_tcatch)
 {
   struct cmd_list_element *command;
 
                   completer_ftype *completer,
                   void *user_data_catch,
                   void *user_data_tcatch)
 {
   struct cmd_list_element *command;
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
                     &catch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_catch);
   set_cmd_completer (command, completer);
 
                     &catch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_catch);
   set_cmd_completer (command, completer);
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
                     &tcatch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_tcatch);
                     &tcatch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_tcatch);
@@ -15698,7 +15248,7 @@ add_catch_command (const char *name, const char *docstring,
 }
 
 static void
 }
 
 static void
-save_command (char *arg, int from_tty)
+save_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"save\" must be followed by "
                       "the name of a save subcommand.\n"));
 {
   printf_unfiltered (_("\"save\" must be followed by "
                       "the name of a save subcommand.\n"));
@@ -15738,7 +15288,7 @@ is_non_inline_function (struct breakpoint *b)
    have been inlined.  */
 
 int
    have been inlined.  */
 
 int
-pc_at_non_inline_function (struct address_space *aspace, CORE_ADDR pc,
+pc_at_non_inline_function (const address_space *aspace, CORE_ADDR pc,
                           const struct target_waitstatus *ws)
 {
   struct breakpoint *b;
                           const struct target_waitstatus *ws)
 {
   struct breakpoint *b;
@@ -15952,6 +15502,10 @@ initialize_breakpoint_ops (void)
 
 static struct cmd_list_element *enablebreaklist = NULL;
 
 
 static struct cmd_list_element *enablebreaklist = NULL;
 
+/* See breakpoint.h.  */
+
+cmd_list_element *commands_cmd_element = nullptr;
+
 void
 _initialize_breakpoint (void)
 {
 void
 _initialize_breakpoint (void)
 {
@@ -15959,12 +15513,12 @@ _initialize_breakpoint (void)
 
   initialize_breakpoint_ops ();
 
 
   initialize_breakpoint_ops ();
 
-  observer_attach_solib_unloaded (disable_breakpoints_in_unloaded_shlib);
-  observer_attach_free_objfile (disable_breakpoints_in_freed_objfile);
-  observer_attach_memory_changed (invalidate_bp_value_on_memory_change);
+  gdb::observers::solib_unloaded.attach (disable_breakpoints_in_unloaded_shlib);
+  gdb::observers::free_objfile.attach (disable_breakpoints_in_freed_objfile);
+  gdb::observers::memory_changed.attach (invalidate_bp_value_on_memory_change);
 
   breakpoint_objfile_key
 
   breakpoint_objfile_key
-    = register_objfile_data_with_cleanup (NULL, free_breakpoint_probes);
+    = register_objfile_data_with_cleanup (NULL, free_breakpoint_objfile_data);
 
   breakpoint_chain = 0;
   /* Don't bother to call set_breakpoint_count.  $bpnum isn't useful
 
   breakpoint_chain = 0;
   /* Don't bother to call set_breakpoint_count.  $bpnum isn't useful
@@ -15977,7 +15531,8 @@ _initialize_breakpoint (void)
 Set ignore-count of breakpoint number N to COUNT.\n\
 Usage is `ignore N COUNT'."));
 
 Set ignore-count of breakpoint number N to COUNT.\n\
 Usage is `ignore N COUNT'."));
 
-  add_com ("commands", class_breakpoint, commands_command, _("\
+  commands_cmd_element = add_com ("commands", class_breakpoint,
+                                 commands_command, _("\
 Set commands to be executed when the given breakpoints are hit.\n\
 Give a space-separated breakpoint list as argument after \"commands\".\n\
 A list element can be a breakpoint number (e.g. `5') or a range of numbers\n\
 Set commands to be executed when the given breakpoints are hit.\n\
 Give a space-separated breakpoint list as argument after \"commands\".\n\
 A list element can be a breakpoint number (e.g. `5') or a range of numbers\n\
@@ -16132,7 +15687,7 @@ Break in function/address or break at a line in the current file."),
               _("Break in function or address."), &stoplist);
       add_cmd ("at", class_breakpoint, stopat_command,
               _("Break at a line in the current file."), &stoplist);
               _("Break in function or address."), &stoplist);
       add_cmd ("at", class_breakpoint, stopat_command,
               _("Break at a line in the current file."), &stoplist);
-      add_com ("status", class_info, breakpoints_info, _("\
+      add_com ("status", class_info, info_breakpoints_command, _("\
 Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
 The \"Type\" column indicates one of:\n\
 \tbreakpoint     - normal breakpoint\n\
 Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
 The \"Type\" column indicates one of:\n\
 \tbreakpoint     - normal breakpoint\n\
@@ -16149,7 +15704,7 @@ Convenience variable \"$bpnum\" contains the number of the last\n\
 breakpoint set."));
     }
 
 breakpoint set."));
     }
 
-  add_info ("breakpoints", breakpoints_info, _("\
+  add_info ("breakpoints", info_breakpoints_command, _("\
 Status of specified breakpoints (all user-settable breakpoints if no argument).\n\
 The \"Type\" column indicates one of:\n\
 \tbreakpoint     - normal breakpoint\n\
 Status of specified breakpoints (all user-settable breakpoints if no argument).\n\
 The \"Type\" column indicates one of:\n\
 \tbreakpoint     - normal breakpoint\n\
@@ -16255,7 +15810,7 @@ If -l or -location is given, this evaluates EXPRESSION and watches\n\
 the memory to which it refers."));
   set_cmd_completer (c, expression_completer);
 
 the memory to which it refers."));
   set_cmd_completer (c, expression_completer);
 
-  add_info ("watchpoints", watchpoints_info, _("\
+  add_info ("watchpoints", info_watchpoints_command, _("\
 Status of specified watchpoints (all watchpoints if no argument)."));
 
   /* XXX: cagney/2005-02-23: This should be a boolean, and should
 Status of specified watchpoints (all watchpoints if no argument)."));
 
   /* XXX: cagney/2005-02-23: This should be a boolean, and should
@@ -16317,7 +15872,7 @@ Do \"help breakpoints\" for info on other commands dealing with breakpoints.\n\
 Do \"help tracepoints\" for info on other tracepoint commands."));
   set_cmd_completer (c, location_completer);
 
 Do \"help tracepoints\" for info on other tracepoint commands."));
   set_cmd_completer (c, location_completer);
 
-  add_info ("tracepoints", tracepoints_info, _("\
+  add_info ("tracepoints", info_tracepoints_command, _("\
 Status of specified tracepoints (all tracepoints if no argument).\n\
 Convenience variable \"$tpnum\" contains the number of the\n\
 last tracepoint set."));
 Status of specified tracepoints (all tracepoints if no argument).\n\
 Convenience variable \"$tpnum\" contains the number of the\n\
 last tracepoint set."));
@@ -16512,6 +16067,6 @@ agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\
 
   automatic_hardware_breakpoints = 1;
 
 
   automatic_hardware_breakpoints = 1;
 
-  observer_attach_about_to_proceed (breakpoint_about_to_proceed);
-  observer_attach_thread_exit (remove_threaded_breakpoints);
+  gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed);
+  gdb::observers::thread_exit.attach (remove_threaded_breakpoints);
 }
 }
This page took 0.117231 seconds and 4 git commands to generate.