Introduce command_line_up
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index a3a81f71c67e3a62740985ffe40575300cbf82e5..3a3cd805f22ff787bcb461d4d3441d508a6ee912 100644 (file)
@@ -1,6 +1,6 @@
 /* Everything about breakpoints, for GDB.
 
-   Copyright (C) 1986-2016 Free Software Foundation, Inc.
+   Copyright (C) 1986-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -345,7 +345,7 @@ static const char *dprintf_style = dprintf_style_gdb;
    copied into the command, so it can be anything that GDB can
    evaluate to a callable address, not necessarily a function name.  */
 
-static char *dprintf_function = "";
+static char *dprintf_function;
 
 /* The channel to use for dynamic printf if the preferred style is to
    call into the inferior; if a nonempty string, it will be passed to
@@ -355,7 +355,7 @@ static char *dprintf_function = "";
    "stderr", this could be an app-specific expression like
    "mystreams[curlogger]".  */
 
-static char *dprintf_channel = "";
+static char *dprintf_channel;
 
 /* True if dprintf commands should continue to operate even if GDB
    has disconnected.  */
@@ -1271,12 +1271,12 @@ static_tracepoints_here (CORE_ADDR addr)
 
 void
 breakpoint_set_commands (struct breakpoint *b, 
-                        struct command_line *commands)
+                        command_line_up &&commands)
 {
-  validate_commands_for_breakpoint (b, commands);
+  validate_commands_for_breakpoint (b, commands.get ());
 
   decref_counted_command_line (&b->commands);
-  b->commands = alloc_counted_command_line (commands);
+  b->commands = alloc_counted_command_line (commands.release ());
   observer_notify_breakpoint_modified (b);
 }
 
@@ -1358,7 +1358,7 @@ do_map_commands_command (struct breakpoint *b, void *data)
 
   if (info->cmd == NULL)
     {
-      struct command_line *l;
+      command_line_up l;
 
       if (info->control != NULL)
        l = copy_command_lines (info->control->body_list[0]);
@@ -1382,7 +1382,7 @@ do_map_commands_command (struct breakpoint *b, void *data)
          do_cleanups (old_chain);
        }
 
-      info->cmd = alloc_counted_command_line (l);
+      info->cmd = alloc_counted_command_line (l.release ());
     }
 
   /* If a breakpoint was on the list more than once, we don't need to
@@ -2268,7 +2268,7 @@ parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
      that may show up.  */
   TRY
     {
-      aexpr = gdb::move (gen_eval_for_expr (scope, cond));
+      aexpr = gen_eval_for_expr (scope, cond);
     }
 
   CATCH (ex, RETURN_MASK_ERROR)
@@ -2452,9 +2452,9 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
      that may show up.  */
   TRY
     {
-      aexpr = gdb::move (gen_printf (scope, gdbarch, 0, 0,
-                                    format_start, format_end - format_start,
-                                    fpieces, nargs, argvec));
+      aexpr = gen_printf (scope, gdbarch, 0, 0,
+                         format_start, format_end - format_start,
+                         fpieces, nargs, argvec);
     }
   CATCH (ex, RETURN_MASK_ERROR)
     {
@@ -3061,14 +3061,13 @@ update_inserted_breakpoint_locations (void)
   int hw_breakpoint_error = 0;
   int hw_bp_details_reported = 0;
 
-  struct ui_file *tmp_error_stream = mem_fileopen ();
-  struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_error_stream);
+  string_file tmp_error_stream;
 
   /* Explicitly mark the warning -- this will only be printed if
      there was an error.  */
-  fprintf_unfiltered (tmp_error_stream, "Warning:\n");
+  tmp_error_stream.puts ("Warning:\n");
 
-  save_current_space_and_thread ();
+  struct cleanup *cleanups = save_current_space_and_thread ();
 
   ALL_BP_LOCATIONS (bl, blp_tmp)
     {
@@ -3093,7 +3092,7 @@ update_inserted_breakpoint_locations (void)
          && ptid_equal (inferior_ptid, null_ptid))
        continue;
 
-      val = insert_bp_location (bl, tmp_error_stream, &disabled_breaks,
+      val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
                                    &hw_breakpoint_error, &hw_bp_details_reported);
       if (val)
        error_flag = val;
@@ -3121,14 +3120,13 @@ insert_breakpoint_locations (void)
   int hw_breakpoint_error = 0;
   int hw_bp_error_explained_already = 0;
 
-  struct ui_file *tmp_error_stream = mem_fileopen ();
-  struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_error_stream);
-  
+  string_file tmp_error_stream;
+
   /* Explicitly mark the warning -- this will only be printed if
      there was an error.  */
-  fprintf_unfiltered (tmp_error_stream, "Warning:\n");
+  tmp_error_stream.puts ("Warning:\n");
 
-  save_current_space_and_thread ();
+  struct cleanup *cleanups = save_current_space_and_thread ();
 
   ALL_BP_LOCATIONS (bl, blp_tmp)
     {
@@ -3152,7 +3150,7 @@ insert_breakpoint_locations (void)
          && ptid_equal (inferior_ptid, null_ptid))
        continue;
 
-      val = insert_bp_location (bl, tmp_error_stream, &disabled_breaks,
+      val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
                                    &hw_breakpoint_error, &hw_bp_error_explained_already);
       if (val)
        error_flag = val;
@@ -3187,9 +3185,9 @@ insert_breakpoint_locations (void)
              remove_breakpoint (loc);
 
          hw_breakpoint_error = 1;
-         fprintf_unfiltered (tmp_error_stream,
-                             "Could not insert hardware watchpoint %d.\n", 
-                             bpt->number);
+         tmp_error_stream.printf ("Could not insert "
+                                  "hardware watchpoint %d.\n",
+                                  bpt->number);
          error_flag = -1;
        }
     }
@@ -3200,8 +3198,7 @@ insert_breakpoint_locations (void)
          message about possibly exhausted resources.  */
       if (hw_breakpoint_error && !hw_bp_error_explained_already)
        {
-         fprintf_unfiltered (tmp_error_stream, 
-                             "Could not insert hardware breakpoints:\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 ();
@@ -3283,7 +3280,6 @@ reattach_breakpoints (int pid)
   struct cleanup *old_chain;
   struct bp_location *bl, **blp_tmp;
   int val;
-  struct ui_file *tmp_error_stream;
   int dummy1 = 0, dummy2 = 0, dummy3 = 0;
   struct inferior *inf;
   struct thread_info *tp;
@@ -3297,8 +3293,7 @@ reattach_breakpoints (int pid)
 
   inferior_ptid = tp->ptid;
 
-  tmp_error_stream = mem_fileopen ();
-  make_cleanup_ui_file_delete (tmp_error_stream);
+  string_file tmp_error_stream;
 
   ALL_BP_LOCATIONS (bl, blp_tmp)
   {
@@ -3308,7 +3303,7 @@ reattach_breakpoints (int pid)
     if (bl->inserted)
       {
        bl->inserted = 0;
-       val = insert_bp_location (bl, tmp_error_stream, &dummy1, &dummy2, &dummy3);
+       val = insert_bp_location (bl, &tmp_error_stream, &dummy1, &dummy2, &dummy3);
        if (val != 0)
          {
            do_cleanups (old_chain);
@@ -3477,7 +3472,7 @@ create_overlay_event_breakpoint (void)
                                      &internal_breakpoint_ops);
       initialize_explicit_location (&explicit_loc);
       explicit_loc.function_name = ASTRDUP (func_name);
-      b->location = new_explicit_location (&explicit_loc);
+      b->location = new_explicit_location (&explicit_loc).release ();
 
       if (overlay_debugging == ovly_auto)
         {
@@ -3558,7 +3553,7 @@ create_longjmp_master_breakpoint (void)
                                              bp_longjmp_master,
                                              &internal_breakpoint_ops);
              b->location
-               = new_probe_location ("-probe-stap libc:longjmp");
+               = new_probe_location ("-probe-stap libc:longjmp").release ();
              b->enable_state = bp_disabled;
            }
 
@@ -3598,7 +3593,7 @@ create_longjmp_master_breakpoint (void)
                                          &internal_breakpoint_ops);
          initialize_explicit_location (&explicit_loc);
          explicit_loc.function_name = ASTRDUP (func_name);
-         b->location = new_explicit_location (&explicit_loc);
+         b->location = new_explicit_location (&explicit_loc).release ();
          b->enable_state = bp_disabled;
        }
     }
@@ -3656,7 +3651,7 @@ create_std_terminate_master_breakpoint (void)
                                      &internal_breakpoint_ops);
       initialize_explicit_location (&explicit_loc);
       explicit_loc.function_name = ASTRDUP (func_name);
-      b->location = new_explicit_location (&explicit_loc);
+      b->location = new_explicit_location (&explicit_loc).release ();
       b->enable_state = bp_disabled;
     }
   }
@@ -3726,7 +3721,7 @@ create_exception_master_breakpoint (void)
                                              bp_exception_master,
                                              &internal_breakpoint_ops);
              b->location
-               = new_probe_location ("-probe-stap libgcc:unwind");
+               = new_probe_location ("-probe-stap libgcc:unwind").release ();
              b->enable_state = bp_disabled;
            }
 
@@ -3761,7 +3756,7 @@ create_exception_master_breakpoint (void)
                                      &internal_breakpoint_ops);
       initialize_explicit_location (&explicit_loc);
       explicit_loc.function_name = ASTRDUP (func_name);
-      b->location = new_explicit_location (&explicit_loc);
+      b->location = new_explicit_location (&explicit_loc).release ();
       b->enable_state = bp_disabled;
     }
 }
@@ -4685,7 +4680,7 @@ bpstat_do_actions_1 (bpstat *bsp)
   executing_breakpoint_commands = 1;
   old_chain = make_cleanup (cleanup_executing_breakpoints, 0);
 
-  prevent_dont_repeat ();
+  scoped_restore preventer = prevent_dont_repeat ();
 
   /* This pointer will iterate over the list of bpstat's.  */
   bs = *bsp;
@@ -4800,28 +4795,28 @@ watchpoint_value_print (struct value *val, struct ui_file *stream)
 void
 maybe_print_thread_hit_breakpoint (struct ui_out *uiout)
 {
-  if (ui_out_is_mi_like_p (uiout))
+  if (uiout->is_mi_like_p ())
     return;
 
-  ui_out_text (uiout, "\n");
+  uiout->text ("\n");
 
   if (show_thread_that_caused_stop ())
     {
       const char *name;
       struct thread_info *thr = inferior_thread ();
 
-      ui_out_text (uiout, "Thread ");
-      ui_out_field_fmt (uiout, "thread-id", "%s", print_thread_id (thr));
+      uiout->text ("Thread ");
+      uiout->field_fmt ("thread-id", "%s", print_thread_id (thr));
 
       name = thr->name != NULL ? thr->name : target_thread_name (thr);
       if (name != NULL)
        {
-         ui_out_text (uiout, " \"");
-         ui_out_field_fmt (uiout, "name", "%s", name);
-         ui_out_text (uiout, "\"");
+         uiout->text (" \"");
+         uiout->field_fmt ("name", "%s", name);
+         uiout->text ("\"");
        }
 
-      ui_out_text (uiout, " hit ");
+      uiout->text (" hit ");
     }
 }
 
@@ -4881,17 +4876,15 @@ print_solib_event (int is_catchpoint)
   if (!is_catchpoint)
     {
       if (any_added || any_deleted)
-       ui_out_text (current_uiout,
-                    _("Stopped due to shared library event:\n"));
+       current_uiout->text (_("Stopped due to shared library event:\n"));
       else
-       ui_out_text (current_uiout,
-                    _("Stopped due to shared library event (no "
-                      "libraries added or removed)\n"));
+       current_uiout->text (_("Stopped due to shared library event (no "
+                              "libraries added or removed)\n"));
     }
 
-  if (ui_out_is_mi_like_p (current_uiout))
-    ui_out_field_string (current_uiout, "reason",
-                        async_reason_lookup (EXEC_ASYNC_SOLIB_EVENT));
+  if (current_uiout->is_mi_like_p ())
+    current_uiout->field_string ("reason",
+                                async_reason_lookup (EXEC_ASYNC_SOLIB_EVENT));
 
   if (any_deleted)
     {
@@ -4899,7 +4892,7 @@ print_solib_event (int is_catchpoint)
       char *name;
       int ix;
 
-      ui_out_text (current_uiout, _("  Inferior unloaded "));
+      current_uiout->text (_("  Inferior unloaded "));
       cleanup = make_cleanup_ui_out_list_begin_end (current_uiout,
                                                    "removed");
       for (ix = 0;
@@ -4908,9 +4901,9 @@ print_solib_event (int is_catchpoint)
           ++ix)
        {
          if (ix > 0)
-           ui_out_text (current_uiout, "    ");
-         ui_out_field_string (current_uiout, "library", name);
-         ui_out_text (current_uiout, "\n");
+           current_uiout->text ("    ");
+         current_uiout->field_string ("library", name);
+         current_uiout->text ("\n");
        }
 
       do_cleanups (cleanup);
@@ -4922,7 +4915,7 @@ print_solib_event (int is_catchpoint)
       int ix;
       struct cleanup *cleanup;
 
-      ui_out_text (current_uiout, _("  Inferior loaded "));
+      current_uiout->text (_("  Inferior loaded "));
       cleanup = make_cleanup_ui_out_list_begin_end (current_uiout,
                                                    "added");
       for (ix = 0;
@@ -4931,9 +4924,9 @@ print_solib_event (int is_catchpoint)
           ++ix)
        {
          if (ix > 0)
-           ui_out_text (current_uiout, "    ");
-         ui_out_field_string (current_uiout, "library", iter->so_name);
-         ui_out_text (current_uiout, "\n");
+           current_uiout->text ("    ");
+         current_uiout->field_string ("library", iter->so_name);
+         current_uiout->text ("\n");
        }
 
       do_cleanups (cleanup);
@@ -5257,13 +5250,12 @@ watchpoint_check (void *p)
         {
          struct ui_out *uiout = current_uiout;
 
-         if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_string
-             (uiout, "reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
-         ui_out_text (uiout, "\nWatchpoint ");
-         ui_out_field_int (uiout, "wpnum", b->base.number);
-         ui_out_text (uiout,
-                      " deleted because the program has left the block in\n"
+         if (uiout->is_mi_like_p ())
+           uiout->field_string
+             ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
+         uiout->text ("\nWatchpoint ");
+         uiout->field_int ("wpnum", b->base.number);
+         uiout->text (" deleted because the program has left the block in\n"
                       "which its expression is valid.\n");
        }
 
@@ -6062,10 +6054,10 @@ wrap_indent_at_field (struct ui_out *uiout, const char *col_name)
 {
   static char wrap_indent[80];
   int i, total_width, width, align;
-  char *text;
+  const char *text;
 
   total_width = 0;
-  for (i = 1; ui_out_query_field (uiout, i, &width, &align, &text); i++)
+  for (i = 1; uiout->query_table_field (i, &width, &align, &text); i++)
     {
       if (strcmp (text, col_name) == 0)
        {
@@ -6158,56 +6150,49 @@ print_breakpoint_location (struct breakpoint *b,
     set_current_program_space (loc->pspace);
 
   if (b->display_canonical)
-    ui_out_field_string (uiout, "what",
-                        event_location_to_string (b->location));
+    uiout->field_string ("what", event_location_to_string (b->location));
   else if (loc && loc->symtab)
     {
       struct symbol *sym 
        = find_pc_sect_function (loc->address, loc->section);
       if (sym)
        {
-         ui_out_text (uiout, "in ");
-         ui_out_field_string (uiout, "func",
-                              SYMBOL_PRINT_NAME (sym));
-         ui_out_text (uiout, " ");
-         ui_out_wrap_hint (uiout, wrap_indent_at_field (uiout, "what"));
-         ui_out_text (uiout, "at ");
+         uiout->text ("in ");
+         uiout->field_string ("func", SYMBOL_PRINT_NAME (sym));
+         uiout->text (" ");
+         uiout->wrap_hint (wrap_indent_at_field (uiout, "what"));
+         uiout->text ("at ");
        }
-      ui_out_field_string (uiout, "file",
+      uiout->field_string ("file",
                           symtab_to_filename_for_display (loc->symtab));
-      ui_out_text (uiout, ":");
+      uiout->text (":");
 
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string (uiout, "fullname",
-                            symtab_to_fullname (loc->symtab));
+      if (uiout->is_mi_like_p ())
+       uiout->field_string ("fullname", symtab_to_fullname (loc->symtab));
       
-      ui_out_field_int (uiout, "line", loc->line_number);
+      uiout->field_int ("line", loc->line_number);
     }
   else if (loc)
     {
-      struct ui_file *stb = mem_fileopen ();
-      struct cleanup *stb_chain = make_cleanup_ui_file_delete (stb);
+      string_file stb;
 
-      print_address_symbolic (loc->gdbarch, loc->address, stb,
+      print_address_symbolic (loc->gdbarch, loc->address, &stb,
                              demangle, "");
-      ui_out_field_stream (uiout, "at", stb);
-
-      do_cleanups (stb_chain);
+      uiout->field_stream ("at", stb);
     }
   else
     {
-      ui_out_field_string (uiout, "pending",
-                          event_location_to_string (b->location));
+      uiout->field_string ("pending", event_location_to_string (b->location));
       /* If extra_string is available, it could be holding a condition
         or dprintf arguments.  In either case, make sure it is printed,
         too, but only for non-MI streams.  */
-      if (!ui_out_is_mi_like_p (uiout) && b->extra_string != NULL)
+      if (!uiout->is_mi_like_p () && b->extra_string != NULL)
        {
          if (b->type == bp_dprintf)
-           ui_out_text (uiout, ",");
+           uiout->text (",");
          else
-           ui_out_text (uiout, " ");
-         ui_out_text (uiout, b->extra_string);
+           uiout->text (" ");
+         uiout->text (b->extra_string);
        }
     }
 
@@ -6215,10 +6200,10 @@ print_breakpoint_location (struct breakpoint *b,
       && breakpoint_condition_evaluation_mode () == condition_evaluation_target
       && bp_condition_evaluator (b) == condition_evaluation_both)
     {
-      ui_out_text (uiout, " (");
-      ui_out_field_string (uiout, "evaluated-by",
+      uiout->text (" (");
+      uiout->field_string ("evaluated-by",
                           bp_location_condition_evaluator (loc));
-      ui_out_text (uiout, ")");
+      uiout->text (")");
     }
 
   do_cleanups (old_chain);
@@ -6230,7 +6215,7 @@ bptype_string (enum bptype type)
   struct ep_type_description
     {
       enum bptype type;
-      char *description;
+      const char *description;
     };
   static struct ep_type_description bptypes[] =
   {
@@ -6289,7 +6274,7 @@ output_thread_groups (struct ui_out *uiout,
                      int mi_only)
 {
   struct cleanup *back_to;
-  int is_mi = ui_out_is_mi_like_p (uiout);
+  int is_mi = uiout->is_mi_like_p ();
   int inf;
   int i;
 
@@ -6307,16 +6292,16 @@ output_thread_groups (struct ui_out *uiout,
          char mi_group[10];
 
          xsnprintf (mi_group, sizeof (mi_group), "i%d", inf);
-         ui_out_field_string (uiout, NULL, mi_group);
+         uiout->field_string (NULL, mi_group);
        }
       else
        {
          if (i == 0)
-           ui_out_text (uiout, " inf ");
+           uiout->text (" inf ");
          else
-           ui_out_text (uiout, ", ");
+           uiout->text (", ");
        
-         ui_out_text (uiout, plongest (inf));
+         uiout->text (plongest (inf));
        }
     }
 
@@ -6360,37 +6345,36 @@ print_one_breakpoint_location (struct breakpoint *b,
     {
       char *formatted;
       formatted = xstrprintf ("%d.%d", b->number, loc_number);
-      ui_out_field_string (uiout, "number", formatted);
+      uiout->field_string ("number", formatted);
       xfree (formatted);
     }
   else
     {
-      ui_out_field_int (uiout, "number", b->number);
+      uiout->field_int ("number", b->number);
     }
 
   /* 2 */
   annotate_field (1);
   if (part_of_multiple)
-    ui_out_field_skip (uiout, "type");
+    uiout->field_skip ("type");
   else
-    ui_out_field_string (uiout, "type", bptype_string (b->type));
+    uiout->field_string ("type", bptype_string (b->type));
 
   /* 3 */
   annotate_field (2);
   if (part_of_multiple)
-    ui_out_field_skip (uiout, "disp");
+    uiout->field_skip ("disp");
   else
-    ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+    uiout->field_string ("disp", bpdisp_text (b->disposition));
 
 
   /* 4 */
   annotate_field (3);
   if (part_of_multiple)
-    ui_out_field_string (uiout, "enabled", loc->enabled ? "y" : "n");
+    uiout->field_string ("enabled", loc->enabled ? "y" : "n");
   else
-    ui_out_field_fmt (uiout, "enabled", "%c", 
-                     bpenables[(int) b->enable_state]);
-  ui_out_spaces (uiout, 2);
+    uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]);
+  uiout->spaces (2);
 
   
   /* 5 and 6 */
@@ -6421,9 +6405,9 @@ print_one_breakpoint_location (struct breakpoint *b,
             not line up too nicely with the headers, but the effect
             is relatively readable).  */
          if (opts.addressprint)
-           ui_out_field_skip (uiout, "addr");
+           uiout->field_skip ("addr");
          annotate_field (5);
-         ui_out_field_string (uiout, "what", w->exp_string);
+         uiout->field_string ("what", w->exp_string);
        }
        break;
 
@@ -6459,11 +6443,11 @@ print_one_breakpoint_location (struct breakpoint *b,
          {
            annotate_field (4);
            if (header_of_multiple)
-             ui_out_field_string (uiout, "addr", "<MULTIPLE>");
+             uiout->field_string ("addr", "<MULTIPLE>");
            else if (b->loc == NULL || loc->shlib_disabled)
-             ui_out_field_string (uiout, "addr", "<PENDING>");
+             uiout->field_string ("addr", "<PENDING>");
            else
-             ui_out_field_core_addr (uiout, "addr",
+             uiout->field_core_addr ("addr",
                                      loc->gdbarch, loc->address);
          }
        annotate_field (5);
@@ -6507,17 +6491,17 @@ print_one_breakpoint_location (struct breakpoint *b,
        {
          /* FIXME: This seems to be redundant and lost here; see the
             "stop only in" line a little further down.  */
-         ui_out_text (uiout, " thread ");
-         ui_out_field_int (uiout, "thread", b->thread);
+         uiout->text (" thread ");
+         uiout->field_int ("thread", b->thread);
        }
       else if (b->task != 0)
        {
-         ui_out_text (uiout, " task ");
-         ui_out_field_int (uiout, "task", b->task);
+         uiout->text (" task ");
+         uiout->field_int ("task", b->task);
        }
     }
 
-  ui_out_text (uiout, "\n");
+  uiout->text ("\n");
 
   if (!part_of_multiple)
     b->ops->print_one_detail (b, uiout);
@@ -6525,22 +6509,22 @@ print_one_breakpoint_location (struct breakpoint *b,
   if (part_of_multiple && frame_id_p (b->frame_id))
     {
       annotate_field (6);
-      ui_out_text (uiout, "\tstop only in stack frame at ");
+      uiout->text ("\tstop only in stack frame at ");
       /* FIXME: cagney/2002-12-01: Shouldn't be poking around inside
          the frame ID.  */
-      ui_out_field_core_addr (uiout, "frame",
+      uiout->field_core_addr ("frame",
                              b->gdbarch, b->frame_id.stack_addr);
-      ui_out_text (uiout, "\n");
+      uiout->text ("\n");
     }
   
   if (!part_of_multiple && b->cond_string)
     {
       annotate_field (7);
       if (is_tracepoint (b))
-       ui_out_text (uiout, "\ttrace only if ");
+       uiout->text ("\ttrace only if ");
       else
-       ui_out_text (uiout, "\tstop only if ");
-      ui_out_field_string (uiout, "cond", b->cond_string);
+       uiout->text ("\tstop only if ");
+      uiout->field_string ("cond", b->cond_string);
 
       /* Print whether the target is doing the breakpoint's condition
         evaluation.  If GDB is doing the evaluation, don't print anything.  */
@@ -6548,27 +6532,27 @@ print_one_breakpoint_location (struct breakpoint *b,
          && breakpoint_condition_evaluation_mode ()
          == condition_evaluation_target)
        {
-         ui_out_text (uiout, " (");
-         ui_out_field_string (uiout, "evaluated-by",
+         uiout->text (" (");
+         uiout->field_string ("evaluated-by",
                               bp_condition_evaluator (b));
-         ui_out_text (uiout, " evals)");
+         uiout->text (" evals)");
        }
-      ui_out_text (uiout, "\n");
+      uiout->text ("\n");
     }
 
   if (!part_of_multiple && b->thread != -1)
     {
       /* FIXME should make an annotation for this.  */
-      ui_out_text (uiout, "\tstop only in thread ");
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_int (uiout, "thread", b->thread);
+      uiout->text ("\tstop only in thread ");
+      if (uiout->is_mi_like_p ())
+       uiout->field_int ("thread", b->thread);
       else
        {
          struct thread_info *thr = find_thread_global_id (b->thread);
 
-         ui_out_field_string (uiout, "thread", print_thread_id (thr));
+         uiout->field_string ("thread", print_thread_id (thr));
        }
-      ui_out_text (uiout, "\n");
+      uiout->text ("\n");
     }
   
   if (!part_of_multiple)
@@ -6577,32 +6561,32 @@ print_one_breakpoint_location (struct breakpoint *b,
        {
          /* FIXME should make an annotation for this.  */
          if (is_catchpoint (b))
-           ui_out_text (uiout, "\tcatchpoint");
+           uiout->text ("\tcatchpoint");
          else if (is_tracepoint (b))
-           ui_out_text (uiout, "\ttracepoint");
+           uiout->text ("\ttracepoint");
          else
-           ui_out_text (uiout, "\tbreakpoint");
-         ui_out_text (uiout, " already hit ");
-         ui_out_field_int (uiout, "times", b->hit_count);
+           uiout->text ("\tbreakpoint");
+         uiout->text (" already hit ");
+         uiout->field_int ("times", b->hit_count);
          if (b->hit_count == 1)
-           ui_out_text (uiout, " time\n");
+           uiout->text (" time\n");
          else
-           ui_out_text (uiout, " times\n");
+           uiout->text (" times\n");
        }
       else
        {
          /* Output the count also if it is zero, but only if this is mi.  */
-         if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_int (uiout, "times", b->hit_count);
+         if (uiout->is_mi_like_p ())
+           uiout->field_int ("times", b->hit_count);
        }
     }
 
   if (!part_of_multiple && b->ignore_count)
     {
       annotate_field (8);
-      ui_out_text (uiout, "\tignore next ");
-      ui_out_field_int (uiout, "ignore", b->ignore_count);
-      ui_out_text (uiout, " hits\n");
+      uiout->text ("\tignore next ");
+      uiout->field_int ("ignore", b->ignore_count);
+      uiout->text (" hits\n");
     }
 
   /* Note that an enable count of 1 corresponds to "enable once"
@@ -6611,15 +6595,15 @@ print_one_breakpoint_location (struct breakpoint *b,
   if (!part_of_multiple && b->enable_count > 1)
     {
       annotate_field (8);
-      ui_out_text (uiout, "\tdisable after ");
+      uiout->text ("\tdisable after ");
       /* Tweak the wording to clarify that ignore and enable counts
         are distinct, and have additive effect.  */
       if (b->ignore_count)
-       ui_out_text (uiout, "additional ");
+       uiout->text ("additional ");
       else
-       ui_out_text (uiout, "next ");
-      ui_out_field_int (uiout, "enable", b->enable_count);
-      ui_out_text (uiout, " hits\n");
+       uiout->text ("next ");
+      uiout->field_int ("enable", b->enable_count);
+      uiout->text (" hits\n");
     }
 
   if (!part_of_multiple && is_tracepoint (b))
@@ -6628,9 +6612,9 @@ print_one_breakpoint_location (struct breakpoint *b,
 
       if (tp->traceframe_usage)
        {
-         ui_out_text (uiout, "\ttrace buffer usage ");
-         ui_out_field_int (uiout, "traceframe-usage", tp->traceframe_usage);
-         ui_out_text (uiout, " bytes\n");
+         uiout->text ("\ttrace buffer usage ");
+         uiout->field_int ("traceframe-usage", tp->traceframe_usage);
+         uiout->text (" bytes\n");
        }
     }
 
@@ -6652,9 +6636,9 @@ print_one_breakpoint_location (struct breakpoint *b,
       if (!part_of_multiple && t->pass_count)
        {
          annotate_field (10);
-         ui_out_text (uiout, "\tpass count ");
-         ui_out_field_int (uiout, "pass", t->pass_count);
-         ui_out_text (uiout, " \n");
+         uiout->text ("\tpass count ");
+         uiout->field_int ("pass", t->pass_count);
+         uiout->text (" \n");
        }
 
       /* Don't display it when tracepoint or tracepoint location is
@@ -6663,31 +6647,31 @@ print_one_breakpoint_location (struct breakpoint *b,
        {
          annotate_field (11);
 
-         if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_string (uiout, "installed",
+         if (uiout->is_mi_like_p ())
+           uiout->field_string ("installed",
                                 loc->inserted ? "y" : "n");
          else
            {
              if (loc->inserted)
-               ui_out_text (uiout, "\t");
+               uiout->text ("\t");
              else
-               ui_out_text (uiout, "\tnot ");
-             ui_out_text (uiout, "installed on target\n");
+               uiout->text ("\tnot ");
+             uiout->text ("installed on target\n");
            }
        }
     }
 
-  if (ui_out_is_mi_like_p (uiout) && !part_of_multiple)
+  if (uiout->is_mi_like_p () && !part_of_multiple)
     {
       if (is_watchpoint (b))
        {
          struct watchpoint *w = (struct watchpoint *) b;
 
-         ui_out_field_string (uiout, "original-location", w->exp_string);
+         uiout->field_string ("original-location", w->exp_string);
        }
       else if (b->location != NULL
               && event_location_to_string (b->location) != NULL)
-       ui_out_field_string (uiout, "original-location",
+       uiout->field_string ("original-location",
                             event_location_to_string (b->location));
     }
 }
@@ -6887,32 +6871,29 @@ breakpoint_1 (char *args, int allflag,
     annotate_breakpoints_headers ();
   if (nr_printable_breakpoints > 0)
     annotate_field (0);
-  ui_out_table_header (uiout, 7, ui_left, "number", "Num");    /* 1 */
+  uiout->table_header (7, ui_left, "number", "Num"); /* 1 */
   if (nr_printable_breakpoints > 0)
     annotate_field (1);
-  ui_out_table_header (uiout, print_type_col_width, ui_left,
-                      "type", "Type");                         /* 2 */
+  uiout->table_header (print_type_col_width, ui_left, "type", "Type"); /* 2 */
   if (nr_printable_breakpoints > 0)
     annotate_field (2);
-  ui_out_table_header (uiout, 4, ui_left, "disp", "Disp");     /* 3 */
+  uiout->table_header (4, ui_left, "disp", "Disp"); /* 3 */
   if (nr_printable_breakpoints > 0)
     annotate_field (3);
-  ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb");   /* 4 */
+  uiout->table_header (3, ui_left, "enabled", "Enb"); /* 4 */
   if (opts.addressprint)
     {
       if (nr_printable_breakpoints > 0)
        annotate_field (4);
       if (print_address_bits <= 32)
-       ui_out_table_header (uiout, 10, ui_left, 
-                            "addr", "Address");                /* 5 */
+       uiout->table_header (10, ui_left, "addr", "Address"); /* 5 */
       else
-       ui_out_table_header (uiout, 18, ui_left, 
-                            "addr", "Address");                /* 5 */
+       uiout->table_header (18, ui_left, "addr", "Address"); /* 5 */
     }
   if (nr_printable_breakpoints > 0)
     annotate_field (5);
-  ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); /* 6 */
-  ui_out_table_body (uiout);
+  uiout->table_header (40, ui_noalign, "what", "What"); /* 6 */
+  uiout->table_body ();
   if (nr_printable_breakpoints > 0)
     annotate_breakpoints_table ();
 
@@ -6954,10 +6935,9 @@ breakpoint_1 (char *args, int allflag,
       if (!filter)
        {
          if (args == NULL || *args == '\0')
-           ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n");
+           uiout->message ("No breakpoints or watchpoints.\n");
          else
-           ui_out_message (uiout, 0, 
-                           "No breakpoint or watchpoint matching '%s'.\n",
+           uiout->message ("No breakpoint or watchpoint matching '%s'.\n",
                            args);
        }
     }
@@ -6990,9 +6970,9 @@ default_collect_info (void)
 
   /* The following phrase lines up nicely with per-tracepoint collect
      actions.  */
-  ui_out_text (uiout, "default collect ");
-  ui_out_field_string (uiout, "default-collect", default_collect);
-  ui_out_text (uiout, " \n");
+  uiout->text ("default collect ");
+  uiout->field_string ("default-collect", default_collect);
+  uiout->text (" \n");
 }
   
 static void
@@ -7012,9 +6992,9 @@ watchpoints_info (char *args, int from_tty)
   if (num_printed == 0)
     {
       if (args == NULL || *args == '\0')
-       ui_out_message (uiout, 0, "No watchpoints.\n");
+       uiout->message ("No watchpoints.\n");
       else
-       ui_out_message (uiout, 0, "No watchpoint matching '%s'.\n", args);
+       uiout->message ("No watchpoint matching '%s'.\n", args);
     }
 }
 
@@ -7816,7 +7796,7 @@ create_thread_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address)
 
   b->enable_state = bp_enabled;
   /* location has to be used or breakpoint_re_set will delete me.  */
-  b->location = new_address_location (b->loc->address, NULL, 0);
+  b->location = new_address_location (b->loc->address, NULL, 0).release ();
 
   update_global_location_list_nothrow (UGLL_MAY_INSERT);
 
@@ -7957,14 +7937,6 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
   struct bp_location *loc, **locp_tmp;
   int disabled_shlib_breaks = 0;
 
-  /* SunOS a.out shared libraries are always mapped, so do not
-     disable breakpoints; they will only be reported as unloaded
-     through clear_solib when GDB discards its shared library
-     list.  See clear_solib for more information.  */
-  if (exec_bfd != NULL
-      && bfd_get_flavour (exec_bfd) == bfd_target_aout_flavour)
-    return;
-
   ALL_BP_LOCATIONS (loc, locp_tmp)
   {
     /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL.  */
@@ -8141,19 +8113,18 @@ print_it_catch_fork (bpstat bs)
   annotate_catchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
   if (b->disposition == disp_del)
-    ui_out_text (uiout, "Temporary catchpoint ");
+    uiout->text ("Temporary catchpoint ");
   else
-    ui_out_text (uiout, "Catchpoint ");
-  if (ui_out_is_mi_like_p (uiout))
+    uiout->text ("Catchpoint ");
+  if (uiout->is_mi_like_p ())
     {
-      ui_out_field_string (uiout, "reason",
-                          async_reason_lookup (EXEC_ASYNC_FORK));
-      ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+      uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_FORK));
+      uiout->field_string ("disp", bpdisp_text (b->disposition));
     }
-  ui_out_field_int (uiout, "bkptno", b->number);
-  ui_out_text (uiout, " (forked process ");
-  ui_out_field_int (uiout, "newpid", ptid_get_pid (c->forked_inferior_pid));
-  ui_out_text (uiout, "), ");
+  uiout->field_int ("bkptno", b->number);
+  uiout->text (" (forked process ");
+  uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+  uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
 
@@ -8173,19 +8144,18 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
      line up too nicely with the headers, but the effect is relatively
      readable).  */
   if (opts.addressprint)
-    ui_out_field_skip (uiout, "addr");
+    uiout->field_skip ("addr");
   annotate_field (5);
-  ui_out_text (uiout, "fork");
+  uiout->text ("fork");
   if (!ptid_equal (c->forked_inferior_pid, null_ptid))
     {
-      ui_out_text (uiout, ", process ");
-      ui_out_field_int (uiout, "what",
-                        ptid_get_pid (c->forked_inferior_pid));
-      ui_out_spaces (uiout, 1);
+      uiout->text (", process ");
+      uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+      uiout->spaces (1);
     }
 
-  if (ui_out_is_mi_like_p (uiout))
-    ui_out_field_string (uiout, "catch-type", "fork");
+  if (uiout->is_mi_like_p ())
+    uiout->field_string ("catch-type", "fork");
 }
 
 /* Implement the "print_mention" breakpoint_ops method for fork
@@ -8259,19 +8229,18 @@ print_it_catch_vfork (bpstat bs)
   annotate_catchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
   if (b->disposition == disp_del)
-    ui_out_text (uiout, "Temporary catchpoint ");
+    uiout->text ("Temporary catchpoint ");
   else
-    ui_out_text (uiout, "Catchpoint ");
-  if (ui_out_is_mi_like_p (uiout))
+    uiout->text ("Catchpoint ");
+  if (uiout->is_mi_like_p ())
     {
-      ui_out_field_string (uiout, "reason",
-                          async_reason_lookup (EXEC_ASYNC_VFORK));
-      ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+      uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_VFORK));
+      uiout->field_string ("disp", bpdisp_text (b->disposition));
     }
-  ui_out_field_int (uiout, "bkptno", b->number);
-  ui_out_text (uiout, " (vforked process ");
-  ui_out_field_int (uiout, "newpid", ptid_get_pid (c->forked_inferior_pid));
-  ui_out_text (uiout, "), ");
+  uiout->field_int ("bkptno", b->number);
+  uiout->text (" (vforked process ");
+  uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+  uiout->text ("), ");
   return PRINT_SRC_AND_LOC;
 }
 
@@ -8290,19 +8259,18 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc)
      line up too nicely with the headers, but the effect is relatively
      readable).  */
   if (opts.addressprint)
-    ui_out_field_skip (uiout, "addr");
+    uiout->field_skip ("addr");
   annotate_field (5);
-  ui_out_text (uiout, "vfork");
+  uiout->text ("vfork");
   if (!ptid_equal (c->forked_inferior_pid, null_ptid))
     {
-      ui_out_text (uiout, ", process ");
-      ui_out_field_int (uiout, "what",
-                        ptid_get_pid (c->forked_inferior_pid));
-      ui_out_spaces (uiout, 1);
+      uiout->text (", process ");
+      uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+      uiout->spaces (1);
     }
 
-  if (ui_out_is_mi_like_p (uiout))
-    ui_out_field_string (uiout, "catch-type", "vfork");
+  if (uiout->is_mi_like_p ())
+    uiout->field_string ("catch-type", "vfork");
 }
 
 /* Implement the "print_mention" breakpoint_ops method for vfork
@@ -8456,13 +8424,13 @@ print_it_catch_solib (bpstat bs)
   annotate_catchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
   if (b->disposition == disp_del)
-    ui_out_text (uiout, "Temporary catchpoint ");
+    uiout->text ("Temporary catchpoint ");
   else
-    ui_out_text (uiout, "Catchpoint ");
-  ui_out_field_int (uiout, "bkptno", b->number);
-  ui_out_text (uiout, "\n");
-  if (ui_out_is_mi_like_p (uiout))
-    ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+    uiout->text ("Catchpoint ");
+  uiout->field_int ("bkptno", b->number);
+  uiout->text ("\n");
+  if (uiout->is_mi_like_p ())
+    uiout->field_string ("disp", bpdisp_text (b->disposition));
   print_solib_event (1);
   return PRINT_SRC_AND_LOC;
 }
@@ -8482,7 +8450,7 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
   if (opts.addressprint)
     {
       annotate_field (4);
-      ui_out_field_skip (uiout, "addr");
+      uiout->field_skip ("addr");
     }
 
   annotate_field (5);
@@ -8500,12 +8468,11 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
       else
        msg = xstrdup (_("unload of library"));
     }
-  ui_out_field_string (uiout, "what", msg);
+  uiout->field_string ("what", msg);
   xfree (msg);
 
-  if (ui_out_is_mi_like_p (uiout))
-    ui_out_field_string (uiout, "catch-type",
-                        self->is_load ? "load" : "unload");
+  if (uiout->is_mi_like_p ())
+    uiout->field_string ("catch-type", self->is_load ? "load" : "unload");
 }
 
 static void
@@ -8540,7 +8507,7 @@ static struct breakpoint_ops catch_solib_breakpoint_ops;
    created in an enabled state.  */
 
 void
-add_solib_catchpoint (char *arg, int is_load, int is_temp, int enabled)
+add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
 {
   struct solib_catchpoint *c;
   struct gdbarch *gdbarch = get_current_arch ();
@@ -8548,7 +8515,7 @@ add_solib_catchpoint (char *arg, int is_load, int is_temp, int enabled)
 
   if (!arg)
     arg = "";
-  arg = skip_spaces (arg);
+  arg = skip_spaces_const (arg);
 
   c = new solib_catchpoint ();
   cleanup = make_cleanup (xfree, c);
@@ -8615,7 +8582,7 @@ catch_unload_command_1 (char *arg, int from_tty,
 void
 init_catchpoint (struct breakpoint *b,
                 struct gdbarch *gdbarch, int tempflag,
-                char *cond_string,
+                const char *cond_string,
                 const struct breakpoint_ops *ops)
 {
   struct symtab_and_line sal;
@@ -8646,7 +8613,7 @@ install_breakpoint (int internal, struct breakpoint *b, int update_gll)
 
 static void
 create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
-                                   int tempflag, char *cond_string,
+                                   int tempflag, const char *cond_string,
                                     const struct breakpoint_ops *ops)
 {
   struct fork_catchpoint *c = new fork_catchpoint ();
@@ -8726,19 +8693,18 @@ print_it_catch_exec (bpstat bs)
   annotate_catchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
   if (b->disposition == disp_del)
-    ui_out_text (uiout, "Temporary catchpoint ");
+    uiout->text ("Temporary catchpoint ");
   else
-    ui_out_text (uiout, "Catchpoint ");
-  if (ui_out_is_mi_like_p (uiout))
+    uiout->text ("Catchpoint ");
+  if (uiout->is_mi_like_p ())
     {
-      ui_out_field_string (uiout, "reason",
-                          async_reason_lookup (EXEC_ASYNC_EXEC));
-      ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+      uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_EXEC));
+      uiout->field_string ("disp", bpdisp_text (b->disposition));
     }
-  ui_out_field_int (uiout, "bkptno", b->number);
-  ui_out_text (uiout, " (exec'd ");
-  ui_out_field_string (uiout, "new-exec", c->exec_pathname);
-  ui_out_text (uiout, "), ");
+  uiout->field_int ("bkptno", b->number);
+  uiout->text (" (exec'd ");
+  uiout->field_string ("new-exec", c->exec_pathname);
+  uiout->text ("), ");
 
   return PRINT_SRC_AND_LOC;
 }
@@ -8756,18 +8722,18 @@ print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc)
      not line up too nicely with the headers, but the effect
      is relatively readable).  */
   if (opts.addressprint)
-    ui_out_field_skip (uiout, "addr");
+    uiout->field_skip ("addr");
   annotate_field (5);
-  ui_out_text (uiout, "exec");
+  uiout->text ("exec");
   if (c->exec_pathname != NULL)
     {
-      ui_out_text (uiout, ", program \"");
-      ui_out_field_string (uiout, "what", c->exec_pathname);
-      ui_out_text (uiout, "\" ");
+      uiout->text (", program \"");
+      uiout->field_string ("what", c->exec_pathname);
+      uiout->text ("\" ");
     }
 
-  if (ui_out_is_mi_like_p (uiout))
-    ui_out_field_string (uiout, "catch-type", "exec");
+  if (uiout->is_mi_like_p ())
+    uiout->field_string ("catch-type", "exec");
 }
 
 static void
@@ -9027,7 +8993,7 @@ static void
 mention (struct breakpoint *b)
 {
   b->ops->print_mention (b);
-  if (ui_out_is_mi_like_p (current_uiout))
+  if (current_uiout->is_mi_like_p ())
     return;
   printf_filtered ("\n");
 }
@@ -9225,7 +9191,7 @@ update_dprintf_command_list (struct breakpoint *b)
     printf_cmd_line->next = NULL;
     printf_cmd_line->line = printf_line;
 
-    breakpoint_set_commands (b, printf_cmd_line);
+    breakpoint_set_commands (b, command_line_up (printf_cmd_line));
   }
 }
 
@@ -9253,7 +9219,7 @@ update_dprintf_commands (char *args, int from_tty,
 static void
 init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
                     struct symtabs_and_lines sals,
-                    struct event_location *location,
+                    event_location_up &&location,
                     char *filter, char *cond_string,
                     char *extra_string,
                     enum bptype type, enum bpdisp disposition,
@@ -9382,27 +9348,16 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
 
   b->display_canonical = display_canonical;
   if (location != NULL)
-    b->location = location;
+    b->location = location.release ();
   else
-    {
-      const char *addr_string = NULL;
-      int addr_string_len = 0;
-
-      if (location != NULL)
-       addr_string = event_location_to_string (location);
-      if (addr_string != NULL)
-       addr_string_len = strlen (addr_string);
-
-      b->location = new_address_location (b->loc->address,
-                                         addr_string, addr_string_len);
-    }
+    b->location = new_address_location (b->loc->address, NULL, 0).release ();
   b->filter = filter;
 }
 
 static void
 create_breakpoint_sal (struct gdbarch *gdbarch,
                       struct symtabs_and_lines sals,
-                      struct event_location *location,
+                      event_location_up &&location,
                       char *filter, char *cond_string,
                       char *extra_string,
                       enum bptype type, enum bpdisp disposition,
@@ -9427,7 +9382,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
   old_chain = make_cleanup (xfree, b);
 
   init_breakpoint_sal (b, gdbarch,
-                      sals, location,
+                      sals, std::move (location),
                       filter, cond_string, extra_string,
                       type, disposition,
                       thread, task, ignore_count,
@@ -9473,22 +9428,20 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
     {
       /* Note that 'location' can be NULL in the case of a plain
         'break', without arguments.  */
-      struct event_location *location
+      event_location_up location
        = (canonical->location != NULL
           ? copy_event_location (canonical->location) : NULL);
       char *filter_string = lsal->canonical ? xstrdup (lsal->canonical) : NULL;
-      struct cleanup *inner = make_cleanup_delete_event_location (location);
 
       make_cleanup (xfree, filter_string);
       create_breakpoint_sal (gdbarch, lsal->sals,
-                            location,
+                            std::move (location),
                             filter_string,
                             cond_string, extra_string,
                             type, disposition,
                             thread, task, ignore_count, ops,
                             from_tty, enabled, internal, flags,
                             canonical->special_display);
-      discard_cleanups (inner);
     }
 }
 
@@ -9926,7 +9879,7 @@ create_breakpoint (struct gdbarch *gdbarch,
        b = new breakpoint ();
 
       init_raw_breakpoint_without_location (b, gdbarch, type_wanted, ops);
-      b->location = copy_event_location (location);
+      b->location = copy_event_location (location).release ();
 
       if (parse_extra)
        b->cond_string = NULL;
@@ -9994,21 +9947,18 @@ break_command_1 (char *arg, int flag, int from_tty)
                             ? bp_hardware_breakpoint
                             : bp_breakpoint);
   struct breakpoint_ops *ops;
-  struct event_location *location;
-  struct cleanup *cleanup;
 
-  location = string_to_event_location (&arg, current_language);
-  cleanup = make_cleanup_delete_event_location (location);
+  event_location_up location = string_to_event_location (&arg, current_language);
 
   /* Matching breakpoints on probes.  */
   if (location != NULL
-      && event_location_type (location) == PROBE_LOCATION)
+      && event_location_type (location.get ()) == PROBE_LOCATION)
     ops = &bkpt_probe_breakpoint_ops;
   else
     ops = &bkpt_breakpoint_ops;
 
   create_breakpoint (get_current_arch (),
-                    location,
+                    location.get (),
                     NULL, 0, arg, 1 /* parse arg */,
                     tempflag, type_wanted,
                     0 /* Ignore count */,
@@ -10018,7 +9968,6 @@ break_command_1 (char *arg, int flag, int from_tty)
                     1 /* enabled */,
                     0 /* internal */,
                     0);
-  do_cleanups (cleanup);
 }
 
 /* Helper function for break_command_1 and disassemble_command.  */
@@ -10185,11 +10134,7 @@ stopat_command (char *arg, int from_tty)
 static void
 dprintf_command (char *arg, int from_tty)
 {
-  struct event_location *location;
-  struct cleanup *cleanup;
-
-  location = string_to_event_location (&arg, current_language);
-  cleanup = make_cleanup_delete_event_location (location);
+  event_location_up location = string_to_event_location (&arg, current_language);
 
   /* If non-NULL, ARG should have been advanced past the location;
      the next character must be ','.  */
@@ -10205,7 +10150,7 @@ dprintf_command (char *arg, int from_tty)
     }
 
   create_breakpoint (get_current_arch (),
-                    location,
+                    location.get (),
                     NULL, 0, arg, 1 /* parse arg */,
                     0, bp_dprintf,
                     0 /* Ignore count */,
@@ -10215,7 +10160,6 @@ dprintf_command (char *arg, int from_tty)
                     1 /* enabled */,
                     0 /* internal */,
                     0);
-  do_cleanups (cleanup);
 }
 
 static void
@@ -10270,17 +10214,17 @@ print_it_ranged_breakpoint (bpstat bs)
   maybe_print_thread_hit_breakpoint (uiout);
 
   if (b->disposition == disp_del)
-    ui_out_text (uiout, "Temporary ranged breakpoint ");
+    uiout->text ("Temporary ranged breakpoint ");
   else
-    ui_out_text (uiout, "Ranged breakpoint ");
-  if (ui_out_is_mi_like_p (uiout))
+    uiout->text ("Ranged breakpoint ");
+  if (uiout->is_mi_like_p ())
     {
-      ui_out_field_string (uiout, "reason",
+      uiout->field_string ("reason",
                      async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
-      ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+      uiout->field_string ("disp", bpdisp_text (b->disposition));
     }
-  ui_out_field_int (uiout, "bkptno", b->number);
-  ui_out_text (uiout, ", ");
+  uiout->field_int ("bkptno", b->number);
+  uiout->text (", ");
 
   return PRINT_SRC_AND_LOC;
 }
@@ -10304,7 +10248,7 @@ print_one_ranged_breakpoint (struct breakpoint *b,
   if (opts.addressprint)
     /* We don't print the address range here, it will be printed later
        by print_one_detail_ranged_breakpoint.  */
-    ui_out_field_skip (uiout, "addr");
+    uiout->field_skip ("addr");
   annotate_field (5);
   print_breakpoint_location (b, bl);
   *last_loc = bl;
@@ -10319,22 +10263,19 @@ print_one_detail_ranged_breakpoint (const struct breakpoint *b,
 {
   CORE_ADDR address_start, address_end;
   struct bp_location *bl = b->loc;
-  struct ui_file *stb = mem_fileopen ();
-  struct cleanup *cleanup = make_cleanup_ui_file_delete (stb);
+  string_file stb;
 
   gdb_assert (bl);
 
   address_start = bl->address;
   address_end = address_start + bl->length - 1;
 
-  ui_out_text (uiout, "\taddress range: ");
-  fprintf_unfiltered (stb, "[%s, %s]",
-                     print_core_address (bl->gdbarch, address_start),
-                     print_core_address (bl->gdbarch, address_end));
-  ui_out_field_stream (uiout, "addr", stb);
-  ui_out_text (uiout, "\n");
-
-  do_cleanups (cleanup);
+  uiout->text ("\taddress range: ");
+  stb.printf ("[%s, %s]",
+             print_core_address (bl->gdbarch, address_start),
+             print_core_address (bl->gdbarch, address_end));
+  uiout->field_stream ("addr", stb);
+  uiout->text ("\n");
 }
 
 /* Implement the "print_mention" breakpoint_ops method for
@@ -10349,7 +10290,7 @@ print_mention_ranged_breakpoint (struct breakpoint *b)
   gdb_assert (bl);
   gdb_assert (b->type == bp_hardware_breakpoint);
 
-  if (ui_out_is_mi_like_p (uiout))
+  if (uiout->is_mi_like_p ())
     return;
 
   printf_filtered (_("Hardware assisted ranged breakpoint %d from %s to %s."),
@@ -10416,7 +10357,6 @@ break_range_command (char *arg, int from_tty)
   struct symtab_and_line sal_start, sal_end;
   struct cleanup *cleanup_bkpt;
   struct linespec_sals *lsal_start, *lsal_end;
-  struct event_location *start_location, *end_location;
 
   /* We don't support software ranged breakpoints.  */
   if (target_ranged_break_num_registers () < 0)
@@ -10436,10 +10376,10 @@ break_range_command (char *arg, int from_tty)
   init_linespec_result (&canonical_start);
 
   arg_start = arg;
-  start_location = string_to_event_location (&arg, current_language);
-  cleanup_bkpt = make_cleanup_delete_event_location (start_location);
-  parse_breakpoint_sals (start_location, &canonical_start);
-  make_cleanup_destroy_linespec_result (&canonical_start);
+  event_location_up start_location = string_to_event_location (&arg,
+                                                              current_language);
+  parse_breakpoint_sals (start_location.get (), &canonical_start);
+  cleanup_bkpt = make_cleanup_destroy_linespec_result (&canonical_start);
 
   if (arg[0] != ',')
     error (_("Too few arguments."));
@@ -10469,9 +10409,9 @@ break_range_command (char *arg, int from_tty)
      symtab and line as the default symtab and line for the end of the
      range.  This makes it possible to have ranges like "foo.c:27, +14",
      where +14 means 14 lines from the start location.  */
-  end_location = string_to_event_location (&arg, current_language);
-  make_cleanup_delete_event_location (end_location);
-  decode_line_full (end_location, DECODE_LINE_FUNFIRSTLINE, NULL,
+  event_location_up end_location = string_to_event_location (&arg,
+                                                            current_language);
+  decode_line_full (end_location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
                    sal_start.symtab, sal_start.line,
                    &canonical_end, NULL, NULL);
 
@@ -10512,8 +10452,8 @@ break_range_command (char *arg, int from_tty)
   set_breakpoint_count (breakpoint_count + 1);
   b->number = breakpoint_count;
   b->disposition = disp_donttouch;
-  b->location = copy_event_location (start_location);
-  b->location_range_end = copy_event_location (end_location);
+  b->location = start_location.release ();
+  b->location_range_end = end_location.release ();
   b->loc->length = length;
 
   do_cleanups (cleanup_bkpt);
@@ -10766,7 +10706,6 @@ print_it_watchpoint (bpstat bs)
 {
   struct cleanup *old_chain;
   struct breakpoint *b;
-  struct ui_file *stb;
   enum print_stop_action result;
   struct watchpoint *w;
   struct ui_out *uiout = current_uiout;
@@ -10776,74 +10715,73 @@ print_it_watchpoint (bpstat bs)
   b = bs->breakpoint_at;
   w = (struct watchpoint *) b;
 
-  stb = mem_fileopen ();
-  old_chain = make_cleanup_ui_file_delete (stb);
+  old_chain = make_cleanup (null_cleanup, NULL);
 
   annotate_watchpoint (b->number);
   maybe_print_thread_hit_breakpoint (uiout);
 
+  string_file stb;
+
   switch (b->type)
     {
     case bp_watchpoint:
     case bp_hardware_watchpoint:
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string
-         (uiout, "reason",
-          async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+      if (uiout->is_mi_like_p ())
+       uiout->field_string
+         ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
       mention (b);
       make_cleanup_ui_out_tuple_begin_end (uiout, "value");
-      ui_out_text (uiout, "\nOld value = ");
-      watchpoint_value_print (bs->old_val, stb);
-      ui_out_field_stream (uiout, "old", stb);
-      ui_out_text (uiout, "\nNew value = ");
-      watchpoint_value_print (w->val, stb);
-      ui_out_field_stream (uiout, "new", stb);
-      ui_out_text (uiout, "\n");
+      uiout->text ("\nOld value = ");
+      watchpoint_value_print (bs->old_val, &stb);
+      uiout->field_stream ("old", stb);
+      uiout->text ("\nNew value = ");
+      watchpoint_value_print (w->val, &stb);
+      uiout->field_stream ("new", stb);
+      uiout->text ("\n");
       /* More than one watchpoint may have been triggered.  */
       result = PRINT_UNKNOWN;
       break;
 
     case bp_read_watchpoint:
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string
-         (uiout, "reason",
-          async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
+      if (uiout->is_mi_like_p ())
+       uiout->field_string
+         ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
       mention (b);
       make_cleanup_ui_out_tuple_begin_end (uiout, "value");
-      ui_out_text (uiout, "\nValue = ");
-      watchpoint_value_print (w->val, stb);
-      ui_out_field_stream (uiout, "value", stb);
-      ui_out_text (uiout, "\n");
+      uiout->text ("\nValue = ");
+      watchpoint_value_print (w->val, &stb);
+      uiout->field_stream ("value", stb);
+      uiout->text ("\n");
       result = PRINT_UNKNOWN;
       break;
 
     case bp_access_watchpoint:
       if (bs->old_val != NULL)
        {
-         if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_string
-             (uiout, "reason",
+         if (uiout->is_mi_like_p ())
+           uiout->field_string
+             ("reason",
               async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
          mention (b);
          make_cleanup_ui_out_tuple_begin_end (uiout, "value");
-         ui_out_text (uiout, "\nOld value = ");
-         watchpoint_value_print (bs->old_val, stb);
-         ui_out_field_stream (uiout, "old", stb);
-         ui_out_text (uiout, "\nNew value = ");
+         uiout->text ("\nOld value = ");
+         watchpoint_value_print (bs->old_val, &stb);
+         uiout->field_stream ("old", stb);
+         uiout->text ("\nNew value = ");
        }
       else
        {
          mention (b);
-         if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_string
-             (uiout, "reason",
+         if (uiout->is_mi_like_p ())
+           uiout->field_string
+             ("reason",
               async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
          make_cleanup_ui_out_tuple_begin_end (uiout, "value");
-         ui_out_text (uiout, "\nValue = ");
+         uiout->text ("\nValue = ");
        }
-      watchpoint_value_print (w->val, stb);
-      ui_out_field_stream (uiout, "new", stb);
-      ui_out_text (uiout, "\n");
+      watchpoint_value_print (w->val, &stb);
+      uiout->field_stream ("new", stb);
+      uiout->text ("\n");
       result = PRINT_UNKNOWN;
       break;
     default:
@@ -10867,19 +10805,19 @@ print_mention_watchpoint (struct breakpoint *b)
   switch (b->type)
     {
     case bp_watchpoint:
-      ui_out_text (uiout, "Watchpoint ");
+      uiout->text ("Watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       break;
     case bp_hardware_watchpoint:
-      ui_out_text (uiout, "Hardware watchpoint ");
+      uiout->text ("Hardware watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       break;
     case bp_read_watchpoint:
-      ui_out_text (uiout, "Hardware read watchpoint ");
+      uiout->text ("Hardware read watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt");
       break;
     case bp_access_watchpoint:
-      ui_out_text (uiout, "Hardware access (read/write) watchpoint ");
+      uiout->text ("Hardware access (read/write) watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt");
       break;
     default:
@@ -10887,9 +10825,9 @@ print_mention_watchpoint (struct breakpoint *b)
                      _("Invalid hardware watchpoint type."));
     }
 
-  ui_out_field_int (uiout, "number", b->number);
-  ui_out_text (uiout, ": ");
-  ui_out_field_string (uiout, "exp", w->exp_string);
+  uiout->field_int ("number", b->number);
+  uiout->text (": ");
+  uiout->field_string ("exp", w->exp_string);
   do_cleanups (ui_out_chain);
 }
 
@@ -11002,23 +10940,21 @@ print_it_masked_watchpoint (bpstat bs)
   switch (b->type)
     {
     case bp_hardware_watchpoint:
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string
-         (uiout, "reason",
-          async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+      if (uiout->is_mi_like_p ())
+       uiout->field_string
+         ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
       break;
 
     case bp_read_watchpoint:
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string
-         (uiout, "reason",
-          async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
+      if (uiout->is_mi_like_p ())
+       uiout->field_string
+         ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
       break;
 
     case bp_access_watchpoint:
-      if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string
-         (uiout, "reason",
+      if (uiout->is_mi_like_p ())
+       uiout->field_string
+         ("reason",
           async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
       break;
     default:
@@ -11027,10 +10963,10 @@ print_it_masked_watchpoint (bpstat bs)
     }
 
   mention (b);
-  ui_out_text (uiout, _("\n\
+  uiout->text (_("\n\
 Check the underlying instruction at PC for the memory\n\
 address and value which triggered this watchpoint.\n"));
-  ui_out_text (uiout, "\n");
+  uiout->text ("\n");
 
   /* More than one watchpoint may have been triggered.  */
   return PRINT_UNKNOWN;
@@ -11048,9 +10984,9 @@ print_one_detail_masked_watchpoint (const struct breakpoint *b,
   /* Masked watchpoints have only one location.  */
   gdb_assert (b->loc && b->loc->next == NULL);
 
-  ui_out_text (uiout, "\tmask ");
-  ui_out_field_core_addr (uiout, "mask", b->loc->gdbarch, w->hw_wp_mask);
-  ui_out_text (uiout, "\n");
+  uiout->text ("\tmask ");
+  uiout->field_core_addr ("mask", b->loc->gdbarch, w->hw_wp_mask);
+  uiout->text ("\n");
 }
 
 /* Implement the "print_mention" breakpoint_ops method for
@@ -11066,15 +11002,15 @@ print_mention_masked_watchpoint (struct breakpoint *b)
   switch (b->type)
     {
     case bp_hardware_watchpoint:
-      ui_out_text (uiout, "Masked hardware watchpoint ");
+      uiout->text ("Masked hardware watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       break;
     case bp_read_watchpoint:
-      ui_out_text (uiout, "Masked hardware read watchpoint ");
+      uiout->text ("Masked hardware read watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt");
       break;
     case bp_access_watchpoint:
-      ui_out_text (uiout, "Masked hardware access (read/write) watchpoint ");
+      uiout->text ("Masked hardware access (read/write) watchpoint ");
       ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt");
       break;
     default:
@@ -11082,9 +11018,9 @@ print_mention_masked_watchpoint (struct breakpoint *b)
                      _("Invalid hardware watchpoint type."));
     }
 
-  ui_out_field_int (uiout, "number", b->number);
-  ui_out_text (uiout, ": ");
-  ui_out_field_string (uiout, "exp", w->exp_string);
+  uiout->field_int ("number", b->number);
+  uiout->text (": ");
+  uiout->field_string ("exp", w->exp_string);
   do_cleanups (ui_out_chain);
 }
 
@@ -11378,7 +11314,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   b->thread = thread;
   b->disposition = disp_donttouch;
   b->pspace = current_program_space;
-  w->exp = gdb::move (exp);
+  w->exp = std::move (exp);
   w->exp_valid_block = exp_valid_block;
   w->cond_exp_valid_block = cond_exp_valid_block;
   if (just_location)
@@ -11717,10 +11653,9 @@ until_break_command (char *arg, int from_tty, int anywhere)
   struct frame_id caller_frame_id;
   struct breakpoint *location_breakpoint;
   struct breakpoint *caller_breakpoint = NULL;
-  struct cleanup *old_chain, *cleanup;
+  struct cleanup *old_chain;
   int thread;
   struct thread_info *tp;
-  struct event_location *location;
   struct until_break_fsm *sm;
 
   clear_proceed_status (0);
@@ -11728,15 +11663,14 @@ until_break_command (char *arg, int from_tty, int anywhere)
   /* Set a breakpoint where the user wants it and at return from
      this function.  */
 
-  location = string_to_event_location (&arg, current_language);
-  cleanup = make_cleanup_delete_event_location (location);
+  event_location_up location = string_to_event_location (&arg, current_language);
 
   if (last_displayed_sal_is_valid ())
-    sals = decode_line_1 (location, DECODE_LINE_FUNFIRSTLINE, NULL,
+    sals = decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
                          get_last_displayed_symtab (),
                          get_last_displayed_line ());
   else
-    sals = decode_line_1 (location, DECODE_LINE_FUNFIRSTLINE,
+    sals = decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE,
                          NULL, (struct symtab *) NULL, 0);
 
   if (sals.nelts != 1)
@@ -11808,8 +11742,6 @@ until_break_command (char *arg, int from_tty, int anywhere)
   discard_cleanups (old_chain);
 
   proceed (-1, GDB_SIGNAL_DEFAULT);
-
-  do_cleanups (cleanup);
 }
 
 /* This function attempts to parse an optional "if <cond>" clause
@@ -11820,10 +11752,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
    it updates arg to point to the first character following the parsed
    if clause in the arg string.  */
 
-char *
-ep_parse_optional_if_clause (char **arg)
+const char *
+ep_parse_optional_if_clause (const char **arg)
 {
-  char *cond_string;
+  const char *cond_string;
 
   if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((*arg)[2]))
     return NULL;
@@ -11833,7 +11765,7 @@ ep_parse_optional_if_clause (char **arg)
 
   /* Skip any extra leading whitespace, and record the start of the
      condition string.  */
-  *arg = skip_spaces (*arg);
+  *arg = skip_spaces_const (*arg);
   cond_string = *arg;
 
   /* Assume that the condition occupies the remainder of the arg
@@ -11854,11 +11786,12 @@ typedef enum
 catch_fork_kind;
 
 static void
-catch_fork_command_1 (char *arg, int from_tty, 
+catch_fork_command_1 (char *arg_entry, int from_tty,
                      struct cmd_list_element *command)
 {
+  const char *arg = arg_entry;
   struct gdbarch *gdbarch = get_current_arch ();
-  char *cond_string = NULL;
+  const char *cond_string = NULL;
   catch_fork_kind fork_kind;
   int tempflag;
 
@@ -11868,7 +11801,7 @@ catch_fork_command_1 (char *arg, int from_tty,
 
   if (!arg)
     arg = "";
-  arg = skip_spaces (arg);
+  arg = skip_spaces_const (arg);
 
   /* The allowed syntax is:
      catch [v]fork
@@ -11901,19 +11834,20 @@ catch_fork_command_1 (char *arg, int from_tty,
 }
 
 static void
-catch_exec_command_1 (char *arg, int from_tty, 
+catch_exec_command_1 (char *arg_entry, int from_tty,
                      struct cmd_list_element *command)
 {
+  const char *arg = arg_entry;
   struct exec_catchpoint *c;
   struct gdbarch *gdbarch = get_current_arch ();
   int tempflag;
-  char *cond_string = NULL;
+  const char *cond_string = NULL;
 
   tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
 
   if (!arg)
     arg = "";
-  arg = skip_spaces (arg);
+  arg = skip_spaces_const (arg);
 
   /* The allowed syntax is:
      catch exec
@@ -11965,8 +11899,9 @@ init_ada_exception_breakpoint (struct breakpoint *b,
 
   b->enable_state = enabled ? bp_enabled : bp_disabled;
   b->disposition = tempflag ? disp_del : disp_donttouch;
-  b->location = string_to_event_location (&addr_string,
-                                         language_def (language_ada));
+  b->location
+    = string_to_event_location (&addr_string,
+                               language_def (language_ada)).release ();
   b->language = language_ada;
 }
 
@@ -13181,17 +13116,17 @@ bkpt_print_it (bpstat bs)
   maybe_print_thread_hit_breakpoint (uiout);
 
   if (bp_temp)
-    ui_out_text (uiout, "Temporary breakpoint ");
+    uiout->text ("Temporary breakpoint ");
   else
-    ui_out_text (uiout, "Breakpoint ");
-  if (ui_out_is_mi_like_p (uiout))
+    uiout->text ("Breakpoint ");
+  if (uiout->is_mi_like_p ())
     {
-      ui_out_field_string (uiout, "reason",
+      uiout->field_string ("reason",
                           async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
-      ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+      uiout->field_string ("disp", bpdisp_text (b->disposition));
     }
-  ui_out_field_int (uiout, "bkptno", b->number);
-  ui_out_text (uiout, ", ");
+  uiout->field_int ("bkptno", b->number);
+  uiout->text (", ");
 
   return PRINT_SRC_AND_LOC;
 }
@@ -13199,7 +13134,7 @@ bkpt_print_it (bpstat bs)
 static void
 bkpt_print_mention (struct breakpoint *b)
 {
-  if (ui_out_is_mi_like_p (current_uiout))
+  if (current_uiout->is_mi_like_p ())
     return;
 
   switch (b->type)
@@ -13515,17 +13450,17 @@ tracepoint_print_one_detail (const struct breakpoint *self,
     {
       gdb_assert (self->type == bp_static_tracepoint);
 
-      ui_out_text (uiout, "\tmarker id is ");
-      ui_out_field_string (uiout, "static-tracepoint-marker-string-id",
+      uiout->text ("\tmarker id is ");
+      uiout->field_string ("static-tracepoint-marker-string-id",
                           tp->static_trace_marker_id);
-      ui_out_text (uiout, "\n");
+      uiout->text ("\n");
     }
 }
 
 static void
 tracepoint_print_mention (struct breakpoint *b)
 {
-  if (ui_out_is_mi_like_p (current_uiout))
+  if (current_uiout->is_mi_like_p ())
     return;
 
   switch (b->type)
@@ -13729,7 +13664,7 @@ strace_marker_create_sals_from_location (const struct event_location *location,
 
   str = savestring (arg_start, arg - arg_start);
   cleanup = make_cleanup (xfree, str);
-  canonical->location = new_linespec_location (&str);
+  canonical->location = new_linespec_location (&str).release ();
   do_cleanups (cleanup);
 
   lsal.canonical = xstrdup (event_location_to_string (canonical->location));
@@ -13764,18 +13699,16 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
     {
       struct symtabs_and_lines expanded;
       struct tracepoint *tp;
-      struct cleanup *old_chain;
-      struct event_location *location;
+      event_location_up location;
 
       expanded.nelts = 1;
       expanded.sals = &lsal->sals.sals[i];
 
       location = copy_event_location (canonical->location);
-      old_chain = make_cleanup_delete_event_location (location);
 
       tp = new tracepoint ();
       init_breakpoint_sal (&tp->base, gdbarch, expanded,
-                          location, NULL,
+                          std::move (location), NULL,
                           cond_string, extra_string,
                           type_wanted, disposition,
                           thread, task, ignore_count, ops,
@@ -13790,8 +13723,6 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
       tp->static_trace_marker_id_idx = i;
 
       install_breakpoint (internal, &tp->base, 0);
-
-      discard_cleanups (old_chain);
     }
 }
 
@@ -14165,26 +14096,25 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
 
          sal2 = find_pc_line (tpmarker->address, 0);
          sym = find_pc_sect_function (tpmarker->address, NULL);
-         ui_out_text (uiout, "Now in ");
+         uiout->text ("Now in ");
          if (sym)
            {
-             ui_out_field_string (uiout, "func",
-                                  SYMBOL_PRINT_NAME (sym));
-             ui_out_text (uiout, " at ");
+             uiout->field_string ("func", SYMBOL_PRINT_NAME (sym));
+             uiout->text (" at ");
            }
-         ui_out_field_string (uiout, "file",
+         uiout->field_string ("file",
                               symtab_to_filename_for_display (sal2.symtab));
-         ui_out_text (uiout, ":");
+         uiout->text (":");
 
-         if (ui_out_is_mi_like_p (uiout))
+         if (uiout->is_mi_like_p ())
            {
              const char *fullname = symtab_to_fullname (sal2.symtab);
 
-             ui_out_field_string (uiout, "fullname", fullname);
+             uiout->field_string ("fullname", fullname);
            }
 
-         ui_out_field_int (uiout, "line", sal2.line);
-         ui_out_text (uiout, "\n");
+         uiout->field_int ("line", sal2.line);
+         uiout->text ("\n");
 
          b->loc->line_number = sal2.line;
          b->loc->symtab = sym != NULL ? sal2.symtab : NULL;
@@ -14195,7 +14125,7 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
            = ASTRDUP (symtab_to_filename_for_display (sal2.symtab));
          explicit_loc.line_offset.offset = b->loc->line_number;
          explicit_loc.line_offset.sign = LINE_OFFSET_NONE;
-         b->location = new_explicit_location (&explicit_loc);
+         b->location = new_explicit_location (&explicit_loc).release ();
 
          /* Might be nice to check if function changed, and warn if
             so.  */
@@ -15193,15 +15123,16 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch,
 int
 insert_single_step_breakpoints (struct gdbarch *gdbarch)
 {
-  struct frame_info *frame = get_current_frame ();
+  struct regcache *regcache = get_current_regcache ();
   VEC (CORE_ADDR) * next_pcs;
 
-  next_pcs = gdbarch_software_single_step (gdbarch, frame);
+  next_pcs = gdbarch_software_single_step (gdbarch, regcache);
 
   if (next_pcs != NULL)
     {
       int i;
       CORE_ADDR pc;
+      struct frame_info *frame = get_current_frame ();
       struct address_space *aspace = get_frame_address_space (frame);
 
       for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); i++)
@@ -15264,19 +15195,17 @@ static void
 trace_command (char *arg, int from_tty)
 {
   struct breakpoint_ops *ops;
-  struct event_location *location;
-  struct cleanup *back_to;
 
-  location = string_to_event_location (&arg, current_language);
-  back_to = make_cleanup_delete_event_location (location);
+  event_location_up location = string_to_event_location (&arg,
+                                                        current_language);
   if (location != NULL
-      && event_location_type (location) == PROBE_LOCATION)
+      && event_location_type (location.get ()) == PROBE_LOCATION)
     ops = &tracepoint_probe_breakpoint_ops;
   else
     ops = &tracepoint_breakpoint_ops;
 
   create_breakpoint (get_current_arch (),
-                    location,
+                    location.get (),
                     NULL, 0, arg, 1 /* parse arg */,
                     0 /* tempflag */,
                     bp_tracepoint /* type_wanted */,
@@ -15286,19 +15215,15 @@ trace_command (char *arg, int from_tty)
                     from_tty,
                     1 /* enabled */,
                     0 /* internal */, 0);
-  do_cleanups (back_to);
 }
 
 static void
 ftrace_command (char *arg, int from_tty)
 {
-  struct event_location *location;
-  struct cleanup *back_to;
-
-  location = string_to_event_location (&arg, current_language);
-  back_to = make_cleanup_delete_event_location (location);
+  event_location_up location = string_to_event_location (&arg,
+                                                        current_language);
   create_breakpoint (get_current_arch (),
-                    location,
+                    location.get (),
                     NULL, 0, arg, 1 /* parse arg */,
                     0 /* tempflag */,
                     bp_fast_tracepoint /* type_wanted */,
@@ -15308,7 +15233,6 @@ ftrace_command (char *arg, int from_tty)
                     from_tty,
                     1 /* enabled */,
                     0 /* internal */, 0);
-  do_cleanups (back_to);
 }
 
 /* strace command implementation.  Creates a static tracepoint.  */
@@ -15317,7 +15241,7 @@ static void
 strace_command (char *arg, int from_tty)
 {
   struct breakpoint_ops *ops;
-  struct event_location *location;
+  event_location_up location;
   struct cleanup *back_to;
 
   /* Decide if we are dealing with a static tracepoint marker (`-m'),
@@ -15333,9 +15257,8 @@ strace_command (char *arg, int from_tty)
       location = string_to_event_location (&arg, current_language);
     }
 
-  back_to = make_cleanup_delete_event_location (location);
   create_breakpoint (get_current_arch (),
-                    location,
+                    location.get (),
                     NULL, 0, arg, 1 /* parse arg */,
                     0 /* tempflag */,
                     bp_static_tracepoint /* type_wanted */,
@@ -15345,7 +15268,6 @@ strace_command (char *arg, int from_tty)
                     from_tty,
                     1 /* enabled */,
                     0 /* internal */, 0);
-  do_cleanups (back_to);
 }
 
 /* Set up a fake reader function that gets command lines from a linked
@@ -15377,8 +15299,6 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
 {
   char *addr_str, small_buf[100];
   struct tracepoint *tp;
-  struct event_location *location;
-  struct cleanup *cleanup;
 
   if (utp->at_string)
     addr_str = utp->at_string;
@@ -15401,10 +15321,10 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
               "has no source form, ignoring it"),
             utp->number);
 
-  location = string_to_event_location (&addr_str, current_language);
-  cleanup = make_cleanup_delete_event_location (location);
+  event_location_up location = string_to_event_location (&addr_str,
+                                                        current_language);
   if (!create_breakpoint (get_current_arch (),
-                         location,
+                         location.get (),
                          utp->cond_string, -1, addr_str,
                          0 /* parse cond/thread */,
                          0 /* tempflag */,
@@ -15416,12 +15336,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
                          utp->enabled /* enabled */,
                          0 /* internal */,
                          CREATE_BREAKPOINT_FLAGS_INSERTED))
-    {
-      do_cleanups (cleanup);
-      return NULL;
-    }
-
-  do_cleanups (cleanup);
+    return NULL;
 
   /* Get the tracepoint we just created.  */
   tp = get_tracepoint (tracepoint_count);
@@ -15441,14 +15356,14 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
      function.  */
   if (!VEC_empty (char_ptr, utp->cmd_strings))
     {
-      struct command_line *cmd_list;
+      command_line_up cmd_list;
 
       this_utp = utp;
       next_cmd = 0;
 
       cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL);
 
-      breakpoint_set_commands (&tp->base, cmd_list);
+      breakpoint_set_commands (&tp->base, std::move (cmd_list));
     }
   else if (!VEC_empty (char_ptr, utp->actions)
           || !VEC_empty (char_ptr, utp->step_actions))
@@ -15477,9 +15392,9 @@ tracepoints_info (char *args, int from_tty)
   if (num_printed == 0)
     {
       if (args == NULL || *args == '\0')
-       ui_out_message (uiout, 0, "No tracepoints.\n");
+       uiout->message ("No tracepoints.\n");
       else
-       ui_out_message (uiout, 0, "No tracepoint matching '%s'.\n", args);
+       uiout->message ("No tracepoint matching '%s'.\n", args);
     }
 
   default_collect_info ();
@@ -15699,7 +15614,6 @@ save_breakpoints (char *filename, int from_tty,
   struct breakpoint *tp;
   int any = 0;
   struct cleanup *cleanup;
-  struct ui_file *fp;
   int extra_trace_bits = 0;
 
   if (filename == 0 || *filename == 0)
@@ -15735,14 +15649,15 @@ save_breakpoints (char *filename, int from_tty,
 
   filename = tilde_expand (filename);
   cleanup = make_cleanup (xfree, filename);
-  fp = gdb_fopen (filename, "w");
-  if (!fp)
+
+  stdio_file fp;
+
+  if (!fp.open (filename, "w"))
     error (_("Unable to open file '%s' for saving (%s)"),
           filename, safe_strerror (errno));
-  make_cleanup_ui_file_delete (fp);
 
   if (extra_trace_bits)
-    save_trace_state_variables (fp);
+    save_trace_state_variables (&fp);
 
   ALL_BREAKPOINTS (tp)
   {
@@ -15754,40 +15669,40 @@ save_breakpoints (char *filename, int from_tty,
     if (filter && !filter (tp))
       continue;
 
-    tp->ops->print_recreate (tp, fp);
+    tp->ops->print_recreate (tp, &fp);
 
     /* Note, we can't rely on tp->number for anything, as we can't
        assume the recreated breakpoint numbers will match.  Use $bpnum
        instead.  */
 
     if (tp->cond_string)
-      fprintf_unfiltered (fp, "  condition $bpnum %s\n", tp->cond_string);
+      fp.printf ("  condition $bpnum %s\n", tp->cond_string);
 
     if (tp->ignore_count)
-      fprintf_unfiltered (fp, "  ignore $bpnum %d\n", tp->ignore_count);
+      fp.printf ("  ignore $bpnum %d\n", tp->ignore_count);
 
     if (tp->type != bp_dprintf && tp->commands)
       {
-       fprintf_unfiltered (fp, "  commands\n");
+       fp.puts ("  commands\n");
        
-       ui_out_redirect (current_uiout, fp);
+       current_uiout->redirect (&fp);
        TRY
          {
            print_command_lines (current_uiout, tp->commands->commands, 2);
          }
        CATCH (ex, RETURN_MASK_ALL)
          {
-           ui_out_redirect (current_uiout, NULL);
+         current_uiout->redirect (NULL);
            throw_exception (ex);
          }
        END_CATCH
 
-       ui_out_redirect (current_uiout, NULL);
-       fprintf_unfiltered (fp, "  end\n");
+       current_uiout->redirect (NULL);
+       fp.puts ("  end\n");
       }
 
     if (tp->enable_state == bp_disabled)
-      fprintf_unfiltered (fp, "disable $bpnum\n");
+      fp.puts ("disable $bpnum\n");
 
     /* If this is a multi-location breakpoint, check if the locations
        should be individually disabled.  Watchpoint locations are
@@ -15799,12 +15714,12 @@ save_breakpoints (char *filename, int from_tty,
 
        for (loc = tp->loc; loc != NULL; loc = loc->next, n++)
          if (!loc->enabled)
-           fprintf_unfiltered (fp, "disable $bpnum.%d\n", n);
+           fp.printf ("disable $bpnum.%d\n", n);
       }
   }
 
   if (extra_trace_bits && *default_collect)
-    fprintf_unfiltered (fp, "set default-collect %s\n", default_collect);
+    fp.printf ("set default-collect %s\n", default_collect);
 
   if (from_tty)
     printf_filtered (_("Saved to file '%s'.\n"), filename);
@@ -15896,7 +15811,7 @@ static struct cmd_list_element *catch_cmdlist;
 static struct cmd_list_element *tcatch_cmdlist;
 
 void
-add_catch_command (char *name, char *docstring,
+add_catch_command (const char *name, const char *docstring,
                   cmd_sfunc_ftype *sfunc,
                   completer_ftype *completer,
                   void *user_data_catch,
@@ -16206,8 +16121,10 @@ Set ignore-count of breakpoint number N to COUNT.\n\
 Usage is `ignore N COUNT'."));
 
   add_com ("commands", class_breakpoint, commands_command, _("\
-Set commands to be executed when a breakpoint is hit.\n\
-Give breakpoint number as argument after \"commands\".\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\
+(e.g. `5-7').\n\
 With no argument, the targeted breakpoint is the last one set.\n\
 The commands themselves follow starting on the next line.\n\
 Type a line containing \"end\" to indicate the end of them.\n\
This page took 0.104118 seconds and 4 git commands to generate.