From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 4/4] Remove argument optional_p from get_tracepoint_by_number
Date: Wed, 05 Mar 2014 12:49:00 -0000 [thread overview]
Message-ID: <1394023608-10761-5-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1394023608-10761-1-git-send-email-yao@codesourcery.com>
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-05 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/breakpoint.c | 22 ++++++++--------------
gdb/breakpoint.h | 3 +--
gdb/tracepoint.c | 2 +-
3 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5dcaa0e..5b5dd10 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15536,7 +15536,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);
}
@@ -15547,7 +15547,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);
}
@@ -15588,12 +15588,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;
@@ -15605,12 +15605,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);
@@ -15620,8 +15615,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;
}
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 3c1fdfe..bf1f52a 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -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. */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 1ff1bda..e1e2fce 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -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 =
--
1.7.7.6
next prev parent reply other threads:[~2014-03-05 12:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 12:49 [PATCH 0/4] Tweak get_number related code Yao Qi
2014-03-05 12:49 ` [PATCH 2/4] Error on bad count number Yao Qi
2014-03-05 14:29 ` Joel Brobecker
2014-03-05 15:59 ` Pedro Alves
2014-03-06 9:56 ` Yao Qi
2014-03-06 12:21 ` Pedro Alves
2014-03-06 13:24 ` Joel Brobecker
2014-03-07 9:40 ` Yao Qi
2014-03-07 10:53 ` Eli Zaretskii
2014-03-07 11:09 ` Yao Qi
2014-03-07 13:27 ` Pedro Alves
2014-03-07 13:50 ` Joel Brobecker
2014-03-10 2:01 ` Yao Qi
2014-03-06 13:26 ` Joel Brobecker
2014-03-05 12:49 ` [OBV PATCH 1/4] Add a newline in output messages Yao Qi
2014-03-05 14:22 ` Joel Brobecker
2014-03-06 6:45 ` Yao Qi
2014-03-05 12:49 ` [PATCH 3/4] Handle parse number error in goto_bookmark_command Yao Qi
2014-03-05 14:38 ` Joel Brobecker
2014-03-06 7:10 ` Yao Qi
2014-03-05 12:49 ` Yao Qi [this message]
2014-03-05 14:44 ` [PATCH 4/4] Remove argument optional_p from get_tracepoint_by_number Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394023608-10761-5-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox