aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-11 15:43:01 -0600
committerTom Tromey <tom@tromey.com>2017-11-07 13:59:09 -0700
commit0b39b52e6e92cf6d465d48499c657fcb17a63c7f (patch)
tree9e248ba48653079de9704df276ef78c4d1f5036f /gdb/breakpoint.c
parent85c4be7c83b80acf647e6ffcaed0f0cdbcb8c3eb (diff)
downloadgdb-0b39b52e6e92cf6d465d48499c657fcb17a63c7f.zip
gdb-0b39b52e6e92cf6d465d48499c657fcb17a63c7f.tar.gz
gdb-0b39b52e6e92cf6d465d48499c657fcb17a63c7f.tar.bz2
Constify add_com
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c81
1 files changed, 35 insertions, 46 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 97f704a..4272378 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -96,8 +96,6 @@ enum exception_event_kind
static void map_breakpoint_numbers (const char *,
gdb::function_view<void (breakpoint *)>);
-static void ignore_command (char *, int);
-
static void breakpoint_re_set_default (struct breakpoint *);
static void
@@ -119,8 +117,6 @@ static std::vector<symtab_and_line> decode_location_default
(struct breakpoint *b, const struct event_location *location,
struct program_space *search_pspace);
-static void clear_command (char *, int);
-
static int can_use_hardware_watchpoint (struct value *);
static void mention (struct breakpoint *);
@@ -165,14 +161,8 @@ static int breakpoint_location_address_range_overlap (struct bp_location *,
const address_space *,
CORE_ADDR, int);
-static void info_breakpoints_command (char *, int);
-
static void info_watchpoints_command (char *, int);
-static void commands_command (char *, int);
-
-static void condition_command (char *, int);
-
static int remove_breakpoint (struct bp_location *);
static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason);
@@ -186,10 +176,6 @@ static int hw_watchpoint_used_count_others (struct breakpoint *except,
enum bptype type,
int *other_type_used);
-static void hbreak_command (char *, int);
-
-static void thbreak_command (char *, int);
-
static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
int count);
@@ -248,7 +234,7 @@ static void enable_trace_command (char *, int);
static void disable_trace_command (char *, int);
-static void trace_pass_command (char *, int);
+static void trace_pass_command (const char *, int);
static void set_tracepoint_count (int num);
@@ -980,10 +966,10 @@ condition_completer (struct cmd_list_element *cmd,
/* condition N EXP -- set break condition of breakpoint N to EXP. */
static void
-condition_command (char *arg, int from_tty)
+condition_command (const char *arg, int from_tty)
{
struct breakpoint *b;
- char *p;
+ const char *p;
int bnum;
if (arg == 0)
@@ -1301,7 +1287,7 @@ commands_command_1 (const char *arg, int from_tty,
}
static void
-commands_command (char *arg, int from_tty)
+commands_command (const char *arg, int from_tty)
{
commands_command_1 (arg, from_tty, NULL);
}
@@ -6712,13 +6698,21 @@ default_collect_info (void)
}
static void
-info_breakpoints_command (char *args, int from_tty)
+info_breakpoints_command (const char *args, int from_tty)
{
breakpoint_1 (args, 0, NULL);
default_collect_info ();
}
+/* Temporary non-const overload. */
+
+static void
+info_breakpoints_command (char *args, int from_tty)
+{
+ info_breakpoints_command ((const char *) args, from_tty);
+}
+
static void
info_watchpoints_command (char *args, int from_tty)
{
@@ -9632,25 +9626,25 @@ resolve_sal_pc (struct symtab_and_line *sal)
}
void
-break_command (char *arg, int from_tty)
+break_command (const char *arg, int from_tty)
{
break_command_1 (arg, 0, from_tty);
}
void
-tbreak_command (char *arg, int from_tty)
+tbreak_command (const char *arg, int from_tty)
{
break_command_1 (arg, BP_TEMPFLAG, from_tty);
}
static void
-hbreak_command (char *arg, int from_tty)
+hbreak_command (const char *arg, int from_tty)
{
break_command_1 (arg, BP_HARDWAREFLAG, from_tty);
}
static void
-thbreak_command (char *arg, int from_tty)
+thbreak_command (const char *arg, int from_tty)
{
break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty);
}
@@ -9734,9 +9728,8 @@ stopat_command (const char *arg, int from_tty)
line. */
static void
-dprintf_command (char *arg_in, int from_tty)
+dprintf_command (const char *arg, int from_tty)
{
- const char *arg = arg_in;
event_location_up location = string_to_event_location (&arg, current_language);
/* If non-NULL, ARG should have been advanced past the location;
@@ -9766,7 +9759,7 @@ dprintf_command (char *arg_in, int from_tty)
}
static void
-agent_printf_command (char *arg, int from_tty)
+agent_printf_command (const char *arg, int from_tty)
{
error (_("May only run agent-printf on the target"));
}
@@ -9950,9 +9943,8 @@ find_breakpoint_range_end (struct symtab_and_line sal)
/* Implement the "break-range" CLI command. */
static void
-break_range_command (char *arg_in, int from_tty)
+break_range_command (const char *arg, int from_tty)
{
- const char *arg = arg_in;
const char *arg_start;
struct linespec_result canonical_start, canonical_end;
int bp_count, can_use_bp, length;
@@ -11056,7 +11048,7 @@ watch_command_wrapper (const char *arg, int from_tty, int internal)
calls watch_command_1. */
static void
-watch_maybe_just_location (char *arg, int accessflag, int from_tty)
+watch_maybe_just_location (const char *arg, int accessflag, int from_tty)
{
int just_location = 0;
@@ -11072,7 +11064,7 @@ watch_maybe_just_location (char *arg, int accessflag, int from_tty)
}
static void
-watch_command (char *arg, int from_tty)
+watch_command (const char *arg, int from_tty)
{
watch_maybe_just_location (arg, hw_write, from_tty);
}
@@ -11084,7 +11076,7 @@ rwatch_command_wrapper (const char *arg, int from_tty, int internal)
}
static void
-rwatch_command (char *arg, int from_tty)
+rwatch_command (const char *arg, int from_tty)
{
watch_maybe_just_location (arg, hw_read, from_tty);
}
@@ -11096,7 +11088,7 @@ awatch_command_wrapper (const char *arg, int from_tty, int internal)
}
static void
-awatch_command (char *arg, int from_tty)
+awatch_command (const char *arg, int from_tty)
{
watch_maybe_just_location (arg, hw_access, from_tty);
}
@@ -11503,7 +11495,7 @@ compare_breakpoints (const breakpoint *a, const breakpoint *b)
/* Delete breakpoints by address or line. */
static void
-clear_command (char *arg, int from_tty)
+clear_command (const char *arg, int from_tty)
{
struct breakpoint *b;
int default_match;
@@ -14108,9 +14100,9 @@ set_ignore_count (int bptnum, int count, int from_tty)
/* Command to set ignore-count of breakpoint N to COUNT. */
static void
-ignore_command (char *args, int from_tty)
+ignore_command (const char *args, int from_tty)
{
- char *p = args;
+ const char *p = args;
int num;
if (p == 0)
@@ -14737,9 +14729,8 @@ set_tracepoint_count (int num)
}
static void
-trace_command (char *arg_in, int from_tty)
+trace_command (const char *arg, int from_tty)
{
- const char *arg = arg_in;
struct breakpoint_ops *ops;
event_location_up location = string_to_event_location (&arg,
@@ -14764,9 +14755,8 @@ trace_command (char *arg_in, int from_tty)
}
static void
-ftrace_command (char *arg_in, int from_tty)
+ftrace_command (const char *arg, int from_tty)
{
- const char *arg = arg_in;
event_location_up location = string_to_event_location (&arg,
current_language);
create_breakpoint (get_current_arch (),
@@ -14785,9 +14775,8 @@ ftrace_command (char *arg_in, int from_tty)
/* strace command implementation. Creates a static tracepoint. */
static void
-strace_command (char *arg_in, int from_tty)
+strace_command (const char *arg, int from_tty)
{
- const char *arg = arg_in;
struct breakpoint_ops *ops;
event_location_up location;
@@ -15023,16 +15012,16 @@ trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
Also accepts special argument "all". */
static void
-trace_pass_command (char *args, int from_tty)
+trace_pass_command (const char *args, int from_tty)
{
struct tracepoint *t1;
- unsigned int count;
+ ULONGEST count;
if (args == 0 || *args == 0)
error (_("passcount command requires an "
"argument (count + optional TP num)"));
- count = strtoul (args, &args, 10); /* Count comes first, then TP num. */
+ count = strtoulst (args, &args, 10); /* Count comes first, then TP num. */
args = skip_spaces (args);
if (*args && strncasecmp (args, "all", 3) == 0)
@@ -15105,12 +15094,12 @@ get_tracepoint_by_number_on_target (int num)
(tracepoint_count) is returned. */
struct tracepoint *
-get_tracepoint_by_number (char **arg,
+get_tracepoint_by_number (const char **arg,
number_or_range_parser *parser)
{
struct breakpoint *t;
int tpnum;
- char *instring = arg == NULL ? NULL : *arg;
+ const char *instring = arg == NULL ? NULL : *arg;
if (parser != NULL)
{