This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/3] Rename some trace functions


This patch renames a few trace-related functions, so that they adhere to
the de facto standard of naming command entry point functions
<command>_command.  I like the ease of looking up a command entry point
if they all follow that rule.

An enum label "tstop_command" conflicts with a new function name, so I
renamed this one trace_stop_command.

gdb/ChangeLog:

	* tracefile-tfile.c (tfile_write_status): Adjust to renames.
	* tracefile.c (trace_save_command): Rename to...
	(tsave_command): ...this.
	(_initialize_tracefile): Adjust to renames.
	* tracepoint.c (trace_actions_command): Rename to...
	(actions_command): ...this.
	(trace_stop_command): Rename to...
	(tstop_command): ...this.
	(trace_status_command): Rename to...
	(tstatus_command): ...this, and adjust to renames.
	(trace_status_mi): Adjust to renames.
	(parse_trace_status): Adjust to renames.
	(_initialize_tracepoint): Adjust to renames.
	* tracepoint.h (enum trace_stop_reason): Rename tstop_command to
	trace_stop_command.
---
 gdb/tracefile-tfile.c |  2 +-
 gdb/tracefile.c       |  4 ++--
 gdb/tracepoint.c      | 32 ++++++++++++++++----------------
 gdb/tracepoint.h      |  2 +-
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 57bb597..18f0ca9 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -138,7 +138,7 @@ tfile_write_status (struct trace_file_writer *self,
   fprintf (writer->fp, "status %c;%s",
 	   (ts->running ? '1' : '0'), stop_reason_names[ts->stop_reason]);
   if (ts->stop_reason == tracepoint_error
-      || ts->stop_reason == tstop_command)
+      || ts->stop_reason == trace_stop_command)
     {
       char *buf = (char *) alloca (strlen (ts->stop_desc) * 2 + 1);
 
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index 56fb0d2..9aacdb7 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -306,7 +306,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
 }
 
 static void
-trace_save_command (char *args, int from_tty)
+tsave_command (char *args, int from_tty)
 {
   int target_does_save = 0;
   char **argv;
@@ -500,7 +500,7 @@ extern initialize_file_ftype _initialize_tracefile;
 void
 _initialize_tracefile (void)
 {
-  add_com ("tsave", class_trace, trace_save_command, _("\
+  add_com ("tsave", class_trace, tsave_command, _("\
 Save the trace data to a file.\n\
 Use the '-ctf' option to save the data to CTF format.\n\
 Use the '-r' option to direct the target to save directly to the file,\n\
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index e5c353c..27c8b20 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -166,10 +166,10 @@ char *trace_notes = NULL;
 char *trace_stop_notes = NULL;
 
 /* ======= Important command functions: ======= */
-static void trace_actions_command (char *, int);
-static void trace_start_command (char *, int);
-static void trace_stop_command (char *, int);
-static void trace_status_command (char *, int);
+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 trace_find_command (char *, int);
 static void trace_find_pc_command (char *, int);
 static void trace_find_tracepoint_command (char *, int);
@@ -648,7 +648,7 @@ decode_agent_options (const char *exp, int *trace_string)
 
 /* Enter a list of actions for a tracepoint.  */
 static void
-trace_actions_command (char *args, int from_tty)
+actions_command (char *args, int from_tty)
 {
   struct tracepoint *t;
   struct command_line *l;
@@ -1900,7 +1900,7 @@ start_tracing (char *notes)
    anybody else messing with the target.  */
 
 static void
-trace_start_command (char *args, int from_tty)
+tstart_command (char *args, int from_tty)
 {
   dont_repeat ();	/* Like "run", dangerous to repeat accidentally.  */
 
@@ -1920,7 +1920,7 @@ trace_start_command (char *args, int from_tty)
    of the trace run's status.  */
 
 static void
-trace_stop_command (char *args, int from_tty)
+tstop_command (char *args, int from_tty)
 {
   if (!current_trace_status ()->running)
     error (_("Trace is not running."));
@@ -1977,7 +1977,7 @@ stop_tracing (char *note)
 
 /* tstatus command */
 static void
-trace_status_command (char *args, int from_tty)
+tstatus_command (char *args, int from_tty)
 {
   struct trace_status *ts = current_trace_status ();
   int status, ix;
@@ -2012,7 +2012,7 @@ trace_status_command (char *args, int from_tty)
 	case trace_never_run:
 	  printf_filtered (_("No trace has been run on the target.\n"));
 	  break;
-	case tstop_command:
+	case trace_stop_command:
 	  if (ts->stop_desc)
 	    printf_filtered (_("Trace stopped by a tstop command (%s).\n"),
 			     ts->stop_desc);
@@ -2189,7 +2189,7 @@ trace_status_mi (int on_stop)
 	{
 	  switch (ts->stop_reason)
 	    {
-	    case tstop_command:
+	    case trace_stop_command:
 	      stop_reason = "request";
 	      break;
 	    case trace_buffer_full:
@@ -3612,7 +3612,7 @@ Status line: '%s'\n"), p, line);
 	  ts->stop_reason = tracepoint_passcount;
 	  ts->stopping_tracepoint = val;
 	}
-      else if (strncmp (p, stop_reason_names[tstop_command], p1 - p) == 0)
+      else if (strncmp (p, stop_reason_names[trace_stop_command], p1 - p) == 0)
 	{
 	  p2 = strchr (++p1, ':');
 	  if (!p2 || p2 > p3)
@@ -3630,7 +3630,7 @@ Status line: '%s'\n"), p, line);
 	    ts->stop_desc = xstrdup ("");
 
 	  p = unpack_varlen_hex (++p2, &val);
-	  ts->stop_reason = tstop_command;
+	  ts->stop_reason = trace_stop_command;
 	}
       else if (strncmp (p, stop_reason_names[trace_disconnected], p1 - p) == 0)
 	{
@@ -4432,16 +4432,16 @@ De-select any trace frame and resume 'live' debugging."),
 	   _("Select the first trace frame in the trace buffer."),
 	   &tfindlist);
 
-  add_com ("tstatus", class_trace, trace_status_command,
+  add_com ("tstatus", class_trace, tstatus_command,
 	   _("Display the status of the current trace data collection."));
 
-  add_com ("tstop", class_trace, trace_stop_command, _("\
+  add_com ("tstop", class_trace, tstop_command, _("\
 Stop trace data collection.\n\
 Usage: tstop [ <notes> ... ]\n\
 Any arguments supplied are recorded with the trace as a stop reason and\n\
 reported by tstatus (if the target supports trace notes)."));
 
-  add_com ("tstart", class_trace, trace_start_command, _("\
+  add_com ("tstart", class_trace, tstart_command, _("\
 Start trace data collection.\n\
 Usage: tstart [ <notes> ... ]\n\
 Any arguments supplied are recorded with the trace as a note and\n\
@@ -4482,7 +4482,7 @@ Accepts a comma-separated list of (one or more) expressions.\n\
 The result of each evaluation will be discarded.\n\
 Note: this command can only be used in a tracepoint \"actions\" list."));
 
-  add_com ("actions", class_trace, trace_actions_command, _("\
+  add_com ("actions", class_trace, actions_command, _("\
 Specify the actions to be taken at a tracepoint.\n\
 Tracepoint actions may include collecting of specified data,\n\
 single-stepping, or enabling/disabling other tracepoints,\n\
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 8985394..9e93658 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -74,7 +74,7 @@ enum trace_stop_reason
   {
     trace_stop_reason_unknown,
     trace_never_run,
-    tstop_command,
+    trace_stop_command,
     trace_buffer_full,
     trace_disconnected,
     tracepoint_passcount,
-- 
2.10.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]