Remove argument optional_p from get_tracepoint_by_number
authorYao Qi <yao@codesourcery.com>
Sat, 22 Feb 2014 05:53:37 +0000 (13:53 +0800)
committerYao Qi <yao@codesourcery.com>
Thu, 6 Mar 2014 07:03:38 +0000 (15:03 +0800)
This patch is to remove parameter optional_p as it is always true,
in order to simplify get_tracepoint_by_number.

'optional_p' was added by this change,

1999-11-18  Tom Tromey  <tromey@cygnus.com>

* tracepoint.h (get_tracepoint_by_number): Updated
declaration.
* tracepoint.c (trace_pass_command): Better error message.
Fixed logic when `all' not specified.
(get_tracepoint_by_number): Added `optional_p' argument.  Fixed
all callers.

but after this patch,

 FYI: remove `static's from cli-utils.c
 https://sourceware.org/ml/gdb-patches/2011-03/msg00636.html

'optional_p' passed to get_tracepoint_by_number become always true.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* breakpoint.c (get_tracepoint_by_number): Remove argument
optional_p.  All callers updated.  Adjust comments.  Update
output message.
* breakpoint.h (get_tracepoint_by_number): Update declaration.

gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h
gdb/tracepoint.c

index 3a1124aa6c24470902b9dc8d403e97094c1ee389..d65f94a0e887b8355d5b21427e46c23f00fc37c2 100644 (file)
@@ -1,3 +1,10 @@
+2014-03-06  Yao Qi  <yao@codesourcery.com>
+
+       * breakpoint.c (get_tracepoint_by_number): Remove argument
+       optional_p.  All callers updated.  Adjust comments.  Update
+       output message.
+       * breakpoint.h (get_tracepoint_by_number): Update declaration.
+
 2014-03-06  Yao Qi  <yao@codesourcery.com>
 
        * reverse.c (goto_bookmark_command): Add local 'p'.  Emit error
index 2f2c6252202ad4b794fe6747e2923eabbaa6773f..1551b99919890323f50709e1a17d41773d456e8a 100644 (file)
@@ -15532,7 +15532,7 @@ trace_pass_command (char *args, int from_tty)
     }
   else if (*args == '\0')
     {
-      t1 = get_tracepoint_by_number (&args, NULL, 1);
+      t1 = get_tracepoint_by_number (&args, NULL);
       if (t1)
        trace_pass_set_count (t1, count, from_tty);
     }
@@ -15543,7 +15543,7 @@ trace_pass_command (char *args, int from_tty)
       init_number_or_range (&state, args);
       while (!state.finished)
        {
-         t1 = get_tracepoint_by_number (&args, &state, 1);
+         t1 = get_tracepoint_by_number (&args, &state);
          if (t1)
            trace_pass_set_count (t1, count, from_tty);
        }
@@ -15584,12 +15584,12 @@ get_tracepoint_by_number_on_target (int num)
 
 /* Utility: parse a tracepoint number and look it up in the list.
    If STATE is not NULL, use, get_number_or_range_state and ignore ARG.
-   If OPTIONAL_P is true, then if the argument is missing, the most
-   recent tracepoint (tracepoint_count) is returned.  */
+   If the argument is missing, the most recent tracepoint
+   (tracepoint_count) is returned.  */
+
 struct tracepoint *
 get_tracepoint_by_number (char **arg,
-                         struct get_number_or_range_state *state,
-                         int optional_p)
+                         struct get_number_or_range_state *state)
 {
   struct breakpoint *t;
   int tpnum;
@@ -15601,12 +15601,7 @@ get_tracepoint_by_number (char **arg,
       tpnum = get_number_or_range (state);
     }
   else if (arg == NULL || *arg == NULL || ! **arg)
-    {
-      if (optional_p)
-       tpnum = tracepoint_count;
-      else
-       error_no_arg (_("tracepoint number"));
-    }
+    tpnum = tracepoint_count;
   else
     tpnum = get_number (arg);
 
@@ -15616,8 +15611,7 @@ get_tracepoint_by_number (char **arg,
        printf_filtered (_("bad tracepoint number at or near '%s'\n"), 
                         instring);
       else
-       printf_filtered (_("Tracepoint argument missing "
-                          "and no previous tracepoint\n"));
+       printf_filtered (_("No previous tracepoint\n"));
       return NULL;
     }
 
index 3c1fdfea9d376f575f5d2e5fa8e570b28aa1e960..bf1f52a62dd109f7ea4461c1b963e8a39b16fb41 100644 (file)
@@ -1491,8 +1491,7 @@ extern struct tracepoint *get_tracepoint_by_number_on_target (int num);
 /* Find a tracepoint by parsing a number in the supplied string.  */
 extern struct tracepoint *
      get_tracepoint_by_number (char **arg, 
-                              struct get_number_or_range_state *state,
-                              int optional_p);
+                              struct get_number_or_range_state *state);
 
 /* Return a vector of all tracepoints currently defined.  The vector
    is newly allocated; the caller should free when done with it.  */
index 4153eae14fba92f6c829e92708a0e35f77144c73..673fddde5e16805e142b19001168485d403156cf 100644 (file)
@@ -653,7 +653,7 @@ trace_actions_command (char *args, int from_tty)
   struct tracepoint *t;
   struct command_line *l;
 
-  t = get_tracepoint_by_number (&args, NULL, 1);
+  t = get_tracepoint_by_number (&args, NULL);
   if (t)
     {
       char *tmpbuf =