|
|
e5a588 |
commit ab4a060a82d0eb68189590ff3f48e8eb5617b6ae
|
|
|
e5a588 |
Author: Frank Ch. Eigler <fche@redhat.com>
|
|
|
e5a588 |
Date: Thu Jan 9 11:43:59 2020 -0500
|
|
|
e5a588 |
|
|
|
e5a588 |
RHBZ1788648: parse arm64 sys/sdt.h operand format [x?, x?]
|
|
|
e5a588 |
|
|
|
e5a588 |
On arm64, the sys/sdt.h operand [x0, x1] was observed, and not
|
|
|
e5a588 |
handled. New code in
|
|
|
e5a588 |
sdt_uprobe_var_expanding_visitor::try_parse_arg_register_pair
|
|
|
e5a588 |
recognizes that and parses it indirectly via
|
|
|
e5a588 |
sdt_uprobe_var_expanding_visitor::try_parse_arg_effective_addr .
|
|
|
e5a588 |
|
|
|
e5a588 |
diff --git a/tapsets.cxx b/tapsets.cxx
|
|
|
e5a588 |
index 68ec74b..aab7c83 100644
|
|
|
e5a588 |
--- a/tapsets.cxx
|
|
|
e5a588 |
+++ b/tapsets.cxx
|
|
|
e5a588 |
@@ -6949,17 +6949,30 @@ sdt_uprobe_var_expanding_visitor::try_parse_arg_register_pair (target_symbol *e,
|
|
|
e5a588 |
const string& asmarg,
|
|
|
e5a588 |
long precision)
|
|
|
e5a588 |
{
|
|
|
e5a588 |
+
|
|
|
e5a588 |
// BZ1613157: for powerpc, accept "R,R", as an alias of "(Ra,Rb)"
|
|
|
e5a588 |
- if (sess.architecture.substr(0,7) != "powerpc")
|
|
|
e5a588 |
- return NULL;
|
|
|
e5a588 |
-
|
|
|
e5a588 |
- // test for BASE_REGISTER,INDEX_REGISTER
|
|
|
e5a588 |
- string regexp = "^(" + regnames + "),(" + regnames + ")$";
|
|
|
e5a588 |
- vector<string> matches;
|
|
|
e5a588 |
- if (!regexp_match(asmarg, regexp, matches))
|
|
|
e5a588 |
+ if (sess.architecture.substr(0,7) == "powerpc")
|
|
|
e5a588 |
+ {
|
|
|
e5a588 |
+ // test for BASE_REGISTER,INDEX_REGISTER
|
|
|
e5a588 |
+ string regexp = "^(" + regnames + "),(" + regnames + ")$";
|
|
|
e5a588 |
+ vector<string> matches;
|
|
|
e5a588 |
+ if (!regexp_match(asmarg, regexp, matches))
|
|
|
e5a588 |
+ {
|
|
|
e5a588 |
+ // delegate to parenthetic syntax
|
|
|
e5a588 |
+ return try_parse_arg_effective_addr (e, string("(")+asmarg+string(")"), precision);
|
|
|
e5a588 |
+ }
|
|
|
e5a588 |
+ }
|
|
|
e5a588 |
+ else if (elf_machine == EM_AARCH64) // BZ1788648
|
|
|
e5a588 |
{
|
|
|
e5a588 |
- // delegate to parenthetic syntax
|
|
|
e5a588 |
- return try_parse_arg_effective_addr (e, string("(")+asmarg+string(")"), precision);
|
|
|
e5a588 |
+ // test for [BASE_REGISTER, INDEX_REGISTER]
|
|
|
e5a588 |
+ string regexp = "^\\[(" + regnames + "), (" + regnames + ")\\]$";
|
|
|
e5a588 |
+ vector<string> matches;
|
|
|
e5a588 |
+ if (!regexp_match(asmarg, regexp, matches))
|
|
|
e5a588 |
+ {
|
|
|
e5a588 |
+ // delegate to parenthetic syntax
|
|
|
e5a588 |
+ string regnames = asmarg.substr(1, asmarg.length()-2); // trim the []
|
|
|
e5a588 |
+ return try_parse_arg_effective_addr (e, string("(")+regnames+string(")"), precision); // add the ()
|
|
|
e5a588 |
+ }
|
|
|
e5a588 |
}
|
|
|
e5a588 |
|
|
|
e5a588 |
return NULL;
|
|
|
e5a588 |
@@ -6975,7 +6988,7 @@ sdt_uprobe_var_expanding_visitor::try_parse_arg_effective_addr (target_symbol *e
|
|
|
e5a588 |
// test for OFFSET(BASE_REGISTER,INDEX_REGISTER[,SCALE]) where OFFSET is +-N+-N+-N
|
|
|
e5a588 |
// NB: Despite PR11821, we can use regnames here, since the parentheses
|
|
|
e5a588 |
// make things unambiguous. (Note: gdb/stap-probe.c also parses this)
|
|
|
e5a588 |
- string regexp = "^([+-]?[0-9]*)([+-][0-9]*)?([+-][0-9]*)?[(](" + regnames + "),(" +
|
|
|
e5a588 |
+ string regexp = "^([+-]?[0-9]*)([+-][0-9]*)?([+-][0-9]*)?[(](" + regnames + "),[ ]?(" +
|
|
|
e5a588 |
regnames + ")(,[1248])?[)]$";
|
|
|
e5a588 |
vector<string> matches;
|
|
|
e5a588 |
if (!regexp_match(asmarg, regexp, matches))
|