if (error_flag)
{
- target_terminal_ours_for_output ();
+ target_terminal::ours_for_output ();
error_stream (tmp_error_stream);
}
}
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);
}
}
/* 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. */
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);
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);
/* 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,
}
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)
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);
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;
}
}
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)
{
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);
}
}
}
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)
{
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);
}
}