aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog32
-rw-r--r--gdb/ada-lang.c4
-rw-r--r--gdb/ax-gdb.c2
-rw-r--r--gdb/breakpoint.c44
-rw-r--r--gdb/breakpoint.h10
-rw-r--r--gdb/cli/cli-cmds.c4
-rw-r--r--gdb/guile/scm-breakpoint.c2
-rw-r--r--gdb/linespec.c18
-rw-r--r--gdb/linespec.h8
-rw-r--r--gdb/location.c10
-rw-r--r--gdb/location.h6
-rw-r--r--gdb/mi/mi-cmd-break.c2
-rw-r--r--gdb/python/py-breakpoint.c2
-rw-r--r--gdb/python/python.c2
-rw-r--r--gdb/tracepoint.c5
15 files changed, 95 insertions, 56 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8ed3b52..08705c0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,37 @@
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)
(cmd_record_goto_begin, cmd_record_goto_end, get_insn_number)
(get_context_size, no_chunk, get_insn_history_modifiers)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 64f1a33..ea051c3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12925,7 +12925,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string)
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;
@@ -12984,7 +12984,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
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);
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 227590b..c4bf2a6 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2622,7 +2622,7 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
}
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
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5549fe7..1073418 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -138,8 +138,6 @@ static void catch_command (char *, int);
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 *,
@@ -9679,7 +9677,7 @@ create_breakpoint (struct gdbarch *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
@@ -9867,8 +9865,9 @@ stopat_command (char *arg, int from_tty)
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;
@@ -10082,9 +10081,11 @@ find_breakpoint_range_end (struct symtab_and_line sal)
/* 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;
@@ -11189,7 +11190,7 @@ can_use_hardware_watchpoint (struct value *v)
}
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);
}
@@ -11220,7 +11221,7 @@ watch_command (char *arg, int from_tty)
}
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);
}
@@ -11232,7 +11233,7 @@ rwatch_command (char *arg, int from_tty)
}
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);
}
@@ -11353,7 +11354,7 @@ until_break_fsm_async_reply_reason (struct thread_fsm *self)
}
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;
@@ -11577,7 +11578,7 @@ void
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,
@@ -13337,16 +13338,13 @@ strace_marker_create_sals_from_location (const struct event_location *location,
{
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 ()));
@@ -14786,8 +14784,9 @@ set_tracepoint_count (int num)
}
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,
@@ -14812,8 +14811,9 @@ trace_command (char *arg, int from_tty)
}
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 (),
@@ -14832,8 +14832,9 @@ ftrace_command (char *arg, int from_tty)
/* 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;
@@ -14891,7 +14892,8 @@ read_uploaded_action (void)
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)
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 6afe4cc..154ff3a 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1206,7 +1206,7 @@ extern int breakpoint_address_match (struct address_space *aspace1,
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. */
@@ -1255,9 +1255,9 @@ extern void break_command (char *, int);
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;
@@ -1288,7 +1288,7 @@ extern void
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,
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index c522df9..c009941 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -814,7 +814,7 @@ edit_command (char *arg, int from_tty)
}
else
{
- char *arg1;
+ const char *arg1;
/* Now should only be one argument -- decode it in SAL. */
arg1 = arg;
@@ -892,7 +892,7 @@ static void
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;
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 9165684..b6b6810 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -412,7 +412,7 @@ gdbscm_register_breakpoint_x (SCM self)
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)
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 6e472e2..19db83e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2793,7 +2793,7 @@ linespec_parser_delete (void *arg)
/* 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;
@@ -3338,7 +3338,7 @@ decode_line_1 (const struct event_location *location, int flags,
/* 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."));
@@ -3361,7 +3361,7 @@ decode_line_with_current_source (char *string, int flags)
/* 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."));
@@ -3472,19 +3472,21 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg)
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);
}
}
diff --git a/gdb/linespec.h b/gdb/linespec.h
index 6c9b0b3..b955728 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -136,12 +136,14 @@ extern void decode_line_full (const struct event_location *location, int flags,
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. */
@@ -171,7 +173,7 @@ extern const char *find_toplevel_char (const char *s, char c);
/* 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[];
diff --git a/gdb/location.c b/gdb/location.c
index cda26e8..c78778e 100644
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -83,7 +83,7 @@ initialize_explicit_location (struct explicit_location *explicit_loc)
/* See description in location.h. */
event_location_up
-new_linespec_location (char **linespec)
+new_linespec_location (const char **linespec)
{
struct event_location *location;
@@ -91,8 +91,8 @@ new_linespec_location (char **linespec)
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);
@@ -836,7 +836,7 @@ string_to_explicit_location (const char **argp,
/* 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;
@@ -875,7 +875,7 @@ string_to_event_location_basic (char **stringp,
/* 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;
diff --git a/gdb/location.h b/gdb/location.h
index 58536e0..d954eac 100644
--- a/gdb/location.h
+++ b/gdb/location.h
@@ -127,7 +127,7 @@ typedef std::unique_ptr<event_location, event_location_deleter>
/* 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). */
@@ -208,14 +208,14 @@ extern event_location_up
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
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index bae8711..188e4e2 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -165,7 +165,7 @@ mi_argv_to_format (char **argv, int argc)
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;
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index d57c2fa..86719d1 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -674,7 +674,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
gdb::unique_xmalloc_ptr<char>
copy_holder (xstrdup (skip_spaces (spec)));
- char *copy = copy_holder.get ();
+ const char *copy = copy_holder.get ();
switch (type)
{
diff --git a/gdb/python/python.c b/gdb/python/python.c
index ff757fd..b04057e 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -647,7 +647,7 @@ gdbpy_solib_name (PyObject *self, PyObject *args)
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;
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 12cc2fb..52a449a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2550,17 +2550,18 @@ tfind_outside_command (char *args, int from_tty)
/* 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, "