public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Slightly improve logic of some operations on stap-probe.c
@ 2019-05-16 20:31 Sergio Durigan Junior
0 siblings, 0 replies; only message in thread
From: Sergio Durigan Junior @ 2019-05-16 20:31 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1bb75ab2a68b7d0878966f5a945eb7d33a48280
commit f1bb75ab2a68b7d0878966f5a945eb7d33a48280
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Thu May 16 16:17:30 2019 -0400
Slightly improve logic of some operations on stap-probe.c
This patch contains three very small improvement on the logic of some
operations we do on stap-probe.c. They don't change what the code
does.
Pushed as obvious.
gdb/ChangeLog:
2019-05-16 Sergio Durigan Junior <sergiodj@redhat.com>
* stap-probe.c (stap_parse_register_operand): Make "if (*p->arg ==
'-')" and "else if".
(stap_parse_single_operand): Join checks for
"gdbarch_stap_parse_special_token_p" and
"gdbarch_stap_parse_special_token" in the same "if" statement.
Invert check when verifying for operation on register
displacement.
Diff:
---
gdb/ChangeLog | 10 ++++++++++
gdb/stap-probe.c | 21 ++++++++++-----------
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3389167..c89b703 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2019-05-16 Sergio Durigan Junior <sergiodj@redhat.com>
+ * stap-probe.c (stap_parse_register_operand): Make "if (*p->arg ==
+ '-')" and "else if".
+ (stap_parse_single_operand): Join checks for
+ "gdbarch_stap_parse_special_token_p" and
+ "gdbarch_stap_parse_special_token" in the same "if" statement.
+ Invert check when verifying for operation on register
+ displacement.
+
+2019-05-16 Sergio Durigan Junior <sergiodj@redhat.com>
+
* stap-probe.c (stap_get_opcode): Update comment.
(stap_get_expected_argument_type): Likewise.
(handle_stap_probe): Likewise.
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index bc2f9fc..db92315 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -705,8 +705,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
pointer. */
++p->arg;
}
-
- if (*p->arg == '-')
+ else if (*p->arg == '-')
{
got_minus = true;
++p->arg;
@@ -842,15 +841,15 @@ stap_parse_single_operand (struct stap_parse_info *p)
const char *int_prefix = NULL;
/* We first try to parse this token as a "special token". */
- if (gdbarch_stap_parse_special_token_p (gdbarch))
- if (gdbarch_stap_parse_special_token (gdbarch, p) != 0)
- {
- /* If the return value of the above function is not zero,
- it means it successfully parsed the special token.
+ if (gdbarch_stap_parse_special_token_p (gdbarch)
+ && (gdbarch_stap_parse_special_token (gdbarch, p) != 0))
+ {
+ /* If the return value of the above function is not zero,
+ it means it successfully parsed the special token.
- If it is NULL, we try to parse it using our method. */
- return;
- }
+ If it is NULL, we try to parse it using our method. */
+ return;
+ }
if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+')
{
@@ -890,7 +889,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
{
/* If we are here, it means it is a displacement. The only
operations allowed here are `-' and `+'. */
- if (c == '~')
+ if (c != '-' && c != '+')
error (_("Invalid operator `%c' for register displacement "
"on expression `%s'."), c, p->saved_arg);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-16 20:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 20:31 [binutils-gdb] Slightly improve logic of some operations on stap-probe.c Sergio Durigan Junior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).