+2017-09-27 Tom Tromey <tom@tromey.com>
+
+ * tracepoint.c (info_scope_command): Constify.
+ * python/python.c (gdbpy_decode_line): Constify.
+ * python/py-breakpoint.c (bppy_init): Constify.
+ * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify.
+ * location.h: (new_linespec_location)
+ (string_to_event_location_basic, string_to_event_location):
+ Constify.
+ * location.c (new_linespec_location)
+ (string_to_event_location_basic, string_to_event_location):
+ Constify.
+ * linespec.h (decode_line_with_current_source)
+ (decode_line_with_last_displayed, linespec_lex_to_end): Constify.
+ * linespec.c (linespec_lex_to_end)
+ (decode_line_with_current_source)
+ (decode_line_with_last_displayed): Constify.
+ * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x):
+ Constify.
+ * cli/cli-cmds.c (edit_command, list_command): Constify.
+ * breakpoint.h (until_break_command, watch_command_wrapper)
+ (awatch_command_wrapper, rwatch_command_wrapper)
+ (init_ada_exception_breakpoint): Constify.
+ * breakpoint.c (break_command_1, dprintf_command)
+ (break_range_command, watch_command_wrapper)
+ (rwatch_command_wrapper, awatch_command_wrapper)
+ (until_break_command, init_ada_exception_breakpoint)
+ (strace_marker_create_sals_from_location, trace_command)
+ (ftrace_command, strace_command, struct tracepoint): Constify.
+ * ax-gdb.c (agent_command_1): Constify.
+ * ada-lang.c (ada_exception_sal): Constify.
+
2017-09-27 Tom Tromey <tom@tromey.com>
* record.c (cmd_record_delete, cmd_record_stop, cmd_record_save)
static struct symtab_and_line
ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
- char **addr_string, const struct breakpoint_ops **ops)
+ const char **addr_string, const struct breakpoint_ops **ops)
{
const char *sym_name;
struct symbol *sym;
int disabled,
int from_tty)
{
- char *addr_string = NULL;
+ const char *addr_string = NULL;
const struct breakpoint_ops *ops = NULL;
struct symtab_and_line sal
= ada_exception_sal (ex_kind, excep_string, &addr_string, &ops);
}
static void
-agent_command_1 (char *exp, int eval)
+agent_command_1 (const char *exp, int eval)
{
/* We don't deal with overlay debugging at the moment. We need to
think more carefully about this. If you copy this code into
static int can_use_hardware_watchpoint (struct value *);
-static void break_command_1 (char *, int, int);
-
static void mention (struct breakpoint *);
static struct breakpoint *set_raw_breakpoint_without_location (struct gdbarch *,
and BP_TEMPFLAG. */
static void
-break_command_1 (char *arg, int flag, int from_tty)
+break_command_1 (const char *arg, int flag, int from_tty)
{
int tempflag = flag & BP_TEMPFLAG;
enum bptype type_wanted = (flag & BP_HARDWAREFLAG
line. */
static void
-dprintf_command (char *arg, int from_tty)
+dprintf_command (char *arg_in, 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;
/* Implement the "break-range" CLI command. */
static void
-break_range_command (char *arg, int from_tty)
+break_range_command (char *arg_in, int from_tty)
{
- char *arg_start, *addr_string_start;
+ const char *arg = arg_in;
+ const char *arg_start;
+ char *addr_string_start;
struct linespec_result canonical_start, canonical_end;
int bp_count, can_use_bp, length;
CORE_ADDR end;
}
void
-watch_command_wrapper (char *arg, int from_tty, int internal)
+watch_command_wrapper (const char *arg, int from_tty, int internal)
{
watch_command_1 (arg, hw_write, from_tty, 0, internal);
}
}
void
-rwatch_command_wrapper (char *arg, int from_tty, int internal)
+rwatch_command_wrapper (const char *arg, int from_tty, int internal)
{
watch_command_1 (arg, hw_read, from_tty, 0, internal);
}
}
void
-awatch_command_wrapper (char *arg, int from_tty, int internal)
+awatch_command_wrapper (const char *arg, int from_tty, int internal)
{
watch_command_1 (arg, hw_access, from_tty, 0, internal);
}
}
void
-until_break_command (char *arg, int from_tty, int anywhere)
+until_break_command (const char *arg, int from_tty, int anywhere)
{
struct frame_info *frame;
struct gdbarch *frame_gdbarch;
init_ada_exception_breakpoint (struct breakpoint *b,
struct gdbarch *gdbarch,
struct symtab_and_line sal,
- char *addr_string,
+ const char *addr_string,
const struct breakpoint_ops *ops,
int tempflag,
int enabled,
{
struct linespec_sals lsal;
const char *arg_start, *arg;
- char *str;
- struct cleanup *cleanup;
arg = arg_start = get_linespec_location (location);
lsal.sals = decode_static_tracepoint_spec (&arg);
- str = savestring (arg_start, arg - arg_start);
- cleanup = make_cleanup (xfree, str);
- canonical->location = new_linespec_location (&str);
- do_cleanups (cleanup);
+ std::string str (arg_start, arg - arg_start);
+ const char *ptr = str.c_str ();
+ canonical->location = new_linespec_location (&ptr);
lsal.canonical
= xstrdup (event_location_to_string (canonical->location.get ()));
}
static void
-trace_command (char *arg, int from_tty)
+trace_command (char *arg_in, int from_tty)
{
+ const char *arg = arg_in;
struct breakpoint_ops *ops;
event_location_up location = string_to_event_location (&arg,
}
static void
-ftrace_command (char *arg, int from_tty)
+ftrace_command (char *arg_in, int from_tty)
{
+ const char *arg = arg_in;
event_location_up location = string_to_event_location (&arg,
current_language);
create_breakpoint (get_current_arch (),
/* strace command implementation. Creates a static tracepoint. */
static void
-strace_command (char *arg, int from_tty)
+strace_command (char *arg_in, int from_tty)
{
+ const char *arg = arg_in;
struct breakpoint_ops *ops;
event_location_up location;
struct cleanup *back_to;
struct tracepoint *
create_tracepoint_from_upload (struct uploaded_tp *utp)
{
- char *addr_str, small_buf[100];
+ const char *addr_str;
+ char small_buf[100];
struct tracepoint *tp;
if (utp->at_string)
struct address_space *aspace2,
CORE_ADDR addr2);
-extern void until_break_command (char *, int, int);
+extern void until_break_command (const char *, int, int);
/* Initialize a struct bp_location. */
extern void hbreak_command_wrapper (char *, int);
extern void thbreak_command_wrapper (char *, int);
extern void rbreak_command_wrapper (char *, int);
-extern void watch_command_wrapper (char *, int, int);
-extern void awatch_command_wrapper (char *, int, int);
-extern void rwatch_command_wrapper (char *, int, int);
+extern void watch_command_wrapper (const char *, int, int);
+extern void awatch_command_wrapper (const char *, int, int);
+extern void rwatch_command_wrapper (const char *, int, int);
extern void tbreak_command (char *, int);
extern struct breakpoint_ops base_breakpoint_ops;
init_ada_exception_breakpoint (struct breakpoint *b,
struct gdbarch *gdbarch,
struct symtab_and_line sal,
- char *addr_string,
+ const char *addr_string,
const struct breakpoint_ops *ops,
int tempflag,
int enabled,
}
else
{
- char *arg1;
+ const char *arg1;
/* Now should only be one argument -- decode it in SAL. */
arg1 = arg;
list_command (char *arg, int from_tty)
{
struct symbol *sym;
- char *arg1;
+ const char *arg1;
int no_end = 1;
int dummy_end = 0;
int dummy_beg = 0;
breakpoint_smob *bp_smob
= bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct gdb_exception except = exception_none;
- char *location, *copy;
+ const char *location, *copy;
/* We only support registering breakpoints created with make-breakpoint. */
if (!bp_smob->is_scheme_bkpt)
/* See description in linespec.h. */
void
-linespec_lex_to_end (char **stringp)
+linespec_lex_to_end (const char **stringp)
{
linespec_parser parser;
struct cleanup *cleanup;
/* See linespec.h. */
std::vector<symtab_and_line>
-decode_line_with_current_source (char *string, int flags)
+decode_line_with_current_source (const char *string, int flags)
{
if (string == 0)
error (_("Empty line specification."));
/* See linespec.h. */
std::vector<symtab_and_line>
-decode_line_with_last_displayed (char *string, int flags)
+decode_line_with_last_displayed (const char *string, int flags)
{
if (string == 0)
error (_("Empty line specification."));
if (self->canonical)
{
- char *str;
+ std::string holder;
+ const char *str;
self->canonical->pre_expanded = 1;
if (ls->explicit_loc.source_filename)
{
- str = xstrprintf ("%s:%s",
- ls->explicit_loc.source_filename, saved_arg);
+ holder = string_printf ("%s:%s",
+ ls->explicit_loc.source_filename,
+ saved_arg);
+ str = holder.c_str ();
}
else
- str = xstrdup (saved_arg);
+ str = saved_arg;
- make_cleanup (xfree, str);
self->canonical->location = new_linespec_location (&str);
}
}
source symtab and line as defaults.
This is for commands like "list" and "breakpoint". */
-extern std::vector<symtab_and_line> decode_line_with_current_source (char *, int);
+extern std::vector<symtab_and_line> decode_line_with_current_source
+ (const char *, int);
/* Given a string, return the line specified by it, using the last displayed
codepoint's values as defaults, or nothing if they aren't valid. */
-extern std::vector<symtab_and_line> decode_line_with_last_displayed (char *, int);
+extern std::vector<symtab_and_line> decode_line_with_last_displayed
+ (const char *, int);
/* Does P represent one of the keywords? If so, return
the keyword. If not, return NULL. */
/* Find the end of the (first) linespec pointed to by *STRINGP.
STRINGP will be advanced to this point. */
-extern void linespec_lex_to_end (char **stringp);
+extern void linespec_lex_to_end (const char **stringp);
extern const char * const linespec_keywords[];
/* See description in location.h. */
event_location_up
-new_linespec_location (char **linespec)
+new_linespec_location (const char **linespec)
{
struct event_location *location;
EL_TYPE (location) = LINESPEC_LOCATION;
if (*linespec != NULL)
{
- char *p;
- char *orig = *linespec;
+ const char *p;
+ const char *orig = *linespec;
linespec_lex_to_end (linespec);
p = remove_trailing_whitespace (orig, *linespec);
/* See description in location.h. */
event_location_up
-string_to_event_location_basic (char **stringp,
+string_to_event_location_basic (const char **stringp,
const struct language_defn *language)
{
event_location_up location;
/* See description in location.h. */
event_location_up
-string_to_event_location (char **stringp,
+string_to_event_location (const char **stringp,
const struct language_defn *language)
{
const char *arg, *orig;
/* Create a new linespec location. */
-extern event_location_up new_linespec_location (char **linespec);
+extern event_location_up new_linespec_location (const char **linespec);
/* Return the linespec location (a string) of the given event_location
(which must be of type LINESPEC_LOCATION). */
legacy specifications of probe, address, and linespec locations. */
extern event_location_up
- string_to_event_location (char **argp,
+ string_to_event_location (const char **argp,
const struct language_defn *langauge);
/* Like string_to_event_location, but does not attempt to parse explicit
locations. */
extern event_location_up
- string_to_event_location_basic (char **argp,
+ string_to_event_location_basic (const char **argp,
const struct language_defn *language);
/* Structure filled in by string_to_explicit_location to aid the
static void
mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
{
- char *address = NULL;
+ const char *address = NULL;
int hardware = 0;
int temp_p = 0;
int thread = -1;
{
gdb::unique_xmalloc_ptr<char>
copy_holder (xstrdup (skip_spaces (spec)));
- char *copy = copy_holder.get ();
+ const char *copy = copy_holder.get ();
switch (type)
{
static PyObject *
gdbpy_decode_line (PyObject *self, PyObject *args)
{
- char *arg = NULL;
+ const char *arg = NULL;
gdbpy_ref<> result;
gdbpy_ref<> unparsed;
event_location_up location;
/* info scope command: list the locals for a scope. */
static void
-info_scope_command (char *args, int from_tty)
+info_scope_command (char *args_in, int from_tty)
{
struct symbol *sym;
struct bound_minimal_symbol msym;
const struct block *block;
const char *symname;
- char *save_args = args;
+ const char *save_args = args_in;
struct block_iterator iter;
int j, count = 0;
struct gdbarch *gdbarch;
int regno;
+ const char *args = args_in;
if (args == 0 || *args == 0)
error (_("requires an argument (function, "