aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-12 18:37:46 -0600
committerTom Tromey <tom@tromey.com>2017-09-27 08:44:47 -0600
commit2983f7cbdb245e516799f1a5b8ddc0450bce98c9 (patch)
tree93e86873436d6ef3352aaa9970ec40001f45e12e
parent4fd41b2486e0c3407d39a6a4c0bbeedd057eb20e (diff)
downloadgdb-2983f7cbdb245e516799f1a5b8ddc0450bce98c9.zip
gdb-2983f7cbdb245e516799f1a5b8ddc0450bce98c9.tar.gz
gdb-2983f7cbdb245e516799f1a5b8ddc0450bce98c9.tar.bz2
Constify some commands in tracepoint.c
In addition to the constification, this fixes a command-repeat bug. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * tracepoint.c (delete_trace_variable_command) (tfind_end_command, tfind_start_command, tfind_pc_command) (tfind_tracepoint_command, tfind_line_command) (tfind_range_command, tfind_outside_command): Constify.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/tracepoint.c42
2 files changed, 23 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cd6e3e4..28ca146 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2017-09-27 Tom Tromey <tom@tromey.com>
+ * tracepoint.c (delete_trace_variable_command)
+ (tfind_end_command, tfind_start_command, tfind_pc_command)
+ (tfind_tracepoint_command, tfind_line_command)
+ (tfind_range_command, tfind_outside_command): Constify.
+
+2017-09-27 Tom Tromey <tom@tromey.com>
+
* ax-gdb.c (maint_agent_printf_command, agent_command)
(agent_eval_command): Constify.
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 52a449a..30e3a3a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -165,18 +165,6 @@ char *trace_notes = NULL;
char *trace_stop_notes = NULL;
-/* ======= Important command functions: ======= */
-static void actions_command (char *, int);
-static void tstart_command (char *, int);
-static void tstop_command (char *, int);
-static void tstatus_command (char *, int);
-static void tfind_pc_command (char *, int);
-static void tfind_tracepoint_command (char *, int);
-static void tfind_line_command (char *, int);
-static void tfind_range_command (char *, int);
-static void tfind_outside_command (char *, int);
-static void tdump_command (char *, int);
-
/* support routines */
struct collection_list;
@@ -442,7 +430,7 @@ trace_variable_command (char *args, int from_tty)
}
static void
-delete_trace_variable_command (char *args, int from_tty)
+delete_trace_variable_command (const char *args, int from_tty)
{
if (args == NULL)
{
@@ -2362,21 +2350,21 @@ tfind_command (char *args, int from_tty)
/* tfind end */
static void
-tfind_end_command (char *args, int from_tty)
+tfind_end_command (const char *args, int from_tty)
{
tfind_command_1 ("-1", from_tty);
}
/* tfind start */
static void
-tfind_start_command (char *args, int from_tty)
+tfind_start_command (const char *args, int from_tty)
{
tfind_command_1 ("0", from_tty);
}
/* tfind pc command */
static void
-tfind_pc_command (char *args, int from_tty)
+tfind_pc_command (const char *args, int from_tty)
{
CORE_ADDR pc;
@@ -2392,7 +2380,7 @@ tfind_pc_command (char *args, int from_tty)
/* tfind tracepoint command */
static void
-tfind_tracepoint_command (char *args, int from_tty)
+tfind_tracepoint_command (const char *args, int from_tty)
{
int tdp;
struct tracepoint *tp;
@@ -2428,7 +2416,7 @@ tfind_tracepoint_command (char *args, int from_tty)
corresponding to a source line OTHER THAN THE CURRENT ONE. */
static void
-tfind_line_command (char *args, int from_tty)
+tfind_line_command (const char *args, int from_tty)
{
check_trace_running (current_trace_status ());
@@ -2486,10 +2474,10 @@ tfind_line_command (char *args, int from_tty)
/* tfind range command */
static void
-tfind_range_command (char *args, int from_tty)
+tfind_range_command (const char *args, int from_tty)
{
static CORE_ADDR start, stop;
- char *tmp;
+ const char *tmp;
check_trace_running (current_trace_status ());
@@ -2501,9 +2489,10 @@ tfind_range_command (char *args, int from_tty)
if (0 != (tmp = strchr (args, ',')))
{
- *tmp++ = '\0'; /* Terminate start address. */
+ std::string start_addr (args, tmp);
+ ++tmp;
tmp = skip_spaces (tmp);
- start = parse_and_eval_address (args);
+ start = parse_and_eval_address (start_addr.c_str ());
stop = parse_and_eval_address (tmp);
}
else
@@ -2517,10 +2506,10 @@ tfind_range_command (char *args, int from_tty)
/* tfind outside command */
static void
-tfind_outside_command (char *args, int from_tty)
+tfind_outside_command (const char *args, int from_tty)
{
CORE_ADDR start, stop;
- char *tmp;
+ const char *tmp;
if (current_trace_status ()->running
&& current_trace_status ()->filename == NULL)
@@ -2534,9 +2523,10 @@ tfind_outside_command (char *args, int from_tty)
if (0 != (tmp = strchr (args, ',')))
{
- *tmp++ = '\0'; /* Terminate start address. */
+ std::string start_addr (args, tmp);
+ ++tmp;
tmp = skip_spaces (tmp);
- start = parse_and_eval_address (args);
+ start = parse_and_eval_address (start_addr.c_str ());
stop = parse_and_eval_address (tmp);
}
else