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.
This commit is contained in:
parent
3ca58cdea1
commit
f1bb75ab2a
|
@ -1,3 +1,13 @@
|
||||||
|
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>
|
2019-05-16 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||||
|
|
||||||
* stap-probe.c (stap_get_opcode): Update comment.
|
* stap-probe.c (stap_get_opcode): Update comment.
|
||||||
|
|
|
@ -705,8 +705,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
|
||||||
pointer. */
|
pointer. */
|
||||||
++p->arg;
|
++p->arg;
|
||||||
}
|
}
|
||||||
|
else if (*p->arg == '-')
|
||||||
if (*p->arg == '-')
|
|
||||||
{
|
{
|
||||||
got_minus = true;
|
got_minus = true;
|
||||||
++p->arg;
|
++p->arg;
|
||||||
|
@ -842,15 +841,15 @@ stap_parse_single_operand (struct stap_parse_info *p)
|
||||||
const char *int_prefix = NULL;
|
const char *int_prefix = NULL;
|
||||||
|
|
||||||
/* We first try to parse this token as a "special token". */
|
/* 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_p (gdbarch)
|
||||||
if (gdbarch_stap_parse_special_token (gdbarch, p) != 0)
|
&& (gdbarch_stap_parse_special_token (gdbarch, p) != 0))
|
||||||
{
|
{
|
||||||
/* If the return value of the above function is not zero,
|
/* If the return value of the above function is not zero,
|
||||||
it means it successfully parsed the special token.
|
it means it successfully parsed the special token.
|
||||||
|
|
||||||
If it is NULL, we try to parse it using our method. */
|
If it is NULL, we try to parse it using our method. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+')
|
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
|
/* If we are here, it means it is a displacement. The only
|
||||||
operations allowed here are `-' and `+'. */
|
operations allowed here are `-' and `+'. */
|
||||||
if (c == '~')
|
if (c != '-' && c != '+')
|
||||||
error (_("Invalid operator `%c' for register displacement "
|
error (_("Invalid operator `%c' for register displacement "
|
||||||
"on expression `%s'."), c, p->saved_arg);
|
"on expression `%s'."), c, p->saved_arg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue