Remove make_cleanup_restore_target_terminal
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index b642bc6bfee368584a04a85d66bfff762d1d8619..cdebdc75cf42ed7f10a696d78f0900c3d0d0cbf3 100644 (file)
@@ -3126,7 +3126,7 @@ update_inserted_breakpoint_locations (void)
 
   if (error_flag)
     {
-      target_terminal_ours_for_output ();
+      target_terminal::ours_for_output ();
       error_stream (tmp_error_stream);
     }
 }
@@ -3225,7 +3225,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");
        }
-      target_terminal_ours_for_output ();
+      target_terminal::ours_for_output ();
       error_stream (tmp_error_stream);
     }
 }
@@ -5792,14 +5792,14 @@ handle_jit_event (void)
 
   /* 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);
 
-  target_terminal_inferior ();
+  target_terminal::inferior ();
 }
 
 /* Prepare WHAT final decision for infrun.  */
@@ -7925,7 +7925,7 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
 
        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);
@@ -8994,8 +8994,6 @@ program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
   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);
@@ -9009,15 +9007,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.  */
-  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)
-    retval = 1;
-
-  do_cleanups (cleanup);
+    return 1;
 
-  return retval;
+  return 0;
 }
 
 /* Return 1 if LOC is pointing to a permanent breakpoint,
@@ -14489,20 +14486,17 @@ map_breakpoint_numbers (const char *args,
 }
 
 static struct bp_location *
-find_location_by_number (char *number)
+find_location_by_number (const char *number)
 {
-  char *dot = strchr (number, '.');
-  char *p1;
+  const char *p1;
   int bp_num;
   int loc_num;
   struct breakpoint *b;
   struct bp_location *loc;  
 
-  *dot = '\0';
-
   p1 = number;
-  bp_num = get_number (&p1);
-  if (bp_num == 0)
+  bp_num = get_number_trailer (&p1, '.');
+  if (bp_num == 0 || p1[0] != '.')
     error (_("Bad breakpoint number '%s'"), number);
 
   ALL_BREAKPOINTS (b)
@@ -14514,7 +14508,9 @@ find_location_by_number (char *number)
   if (!b || b->number != bp_num)
     error (_("Bad breakpoint number '%s'"), number);
   
-  p1 = dot+1;
+  /* Skip the dot.  */
+  ++p1;
+  const char *save = p1;
   loc_num = get_number (&p1);
   if (loc_num == 0)
     error (_("Bad breakpoint location number '%s'"), number);
@@ -14524,7 +14520,7 @@ find_location_by_number (char *number)
   for (;loc_num && loc; --loc_num, loc = loc->next)
     ;
   if (!loc)
-    error (_("Bad breakpoint location number '%s'"), dot+1);
+    error (_("Bad breakpoint location number '%s'"), save);
     
   return loc;  
 }
@@ -14592,13 +14588,13 @@ disable_command (char *args, int from_tty)
     }
   else
     {
-      char *num = extract_arg (&args);
+      std::string num = extract_arg (&args);
 
-      while (num)
+      while (!num.empty ())
        {
-         if (strchr (num, '.'))
+         if (num.find ('.') != std::string::npos)
            {
-             struct bp_location *loc = find_location_by_number (num);
+             struct bp_location *loc = find_location_by_number (num.c_str ());
 
              if (loc)
                {
@@ -14615,7 +14611,8 @@ disable_command (char *args, int from_tty)
              update_global_location_list (UGLL_DONT_INSERT);
            }
          else
-           map_breakpoint_numbers (num, do_map_disable_breakpoint, NULL);
+           map_breakpoint_numbers (num.c_str (), do_map_disable_breakpoint,
+                                   NULL);
          num = extract_arg (&args);
        }
     }
@@ -14723,13 +14720,13 @@ enable_command (char *args, int from_tty)
     }
   else
     {
-      char *num = extract_arg (&args);
+      std::string num = extract_arg (&args);
 
-      while (num)
+      while (!num.empty ())
        {
-         if (strchr (num, '.'))
+         if (num.find ('.') != std::string::npos)
            {
-             struct bp_location *loc = find_location_by_number (num);
+             struct bp_location *loc = find_location_by_number (num.c_str ());
 
              if (loc)
                {
@@ -14746,7 +14743,8 @@ enable_command (char *args, int from_tty)
              update_global_location_list (UGLL_MAY_INSERT);
            }
          else
-           map_breakpoint_numbers (num, do_map_enable_breakpoint, NULL);
+           map_breakpoint_numbers (num.c_str (), do_map_enable_breakpoint,
+                                   NULL);
          num = extract_arg (&args);
        }
     }
This page took 0.032261 seconds and 4 git commands to generate.