Blame SOURCES/rhbz1613157.patch

317253
commit c826ad731fd51b65fbb377a60f63219b2d14e6f8
317253
Author: Frank Ch. Eigler <fche@redhat.com>
317253
Date:   Tue May 21 19:28:58 2019 -0400
317253
317253
    RHBZ1613157: support powerpc64 sdt.h rN,rM operand syntax
317253
    
317253
    This syntax appears in some ppc64le binaries, including of stap
317253
    itself.  It means the same thing as "0(rN,rM)" on other architectures.
317253
317253
diff --git a/tapsets.cxx b/tapsets.cxx
317253
index 62be422..a4edaa3 100644
317253
--- a/tapsets.cxx
317253
+++ b/tapsets.cxx
317253
@@ -6323,6 +6323,9 @@ struct sdt_uprobe_var_expanding_visitor: public var_expanding_visitor
317253
   expression* try_parse_arg_offset_register (target_symbol *e,
317253
                                              const string& asmarg,
317253
                                              long precision);
317253
+  expression* try_parse_arg_register_pair (target_symbol *e,
317253
+                                           const string& asmarg,
317253
+                                           long precision);
317253
   expression* try_parse_arg_effective_addr (target_symbol *e,
317253
                                             const string& asmarg,
317253
                                             long precision);
317253
@@ -6940,6 +6943,27 @@ sdt_uprobe_var_expanding_visitor::try_parse_arg_offset_register (target_symbol *
317253
 }
317253
 
317253
 expression*
317253
+sdt_uprobe_var_expanding_visitor::try_parse_arg_register_pair (target_symbol *e,
317253
+                                                               const string& asmarg,
317253
+                                                               long precision)
317253
+{
317253
+  // BZ1613157: for powerpc, accept "R,R", as an alias of "(Ra,Rb)"
317253
+  if (sess.architecture.substr(0,7) != "powerpc")
317253
+    return NULL;
317253
+    
317253
+  // test for BASE_REGISTER,INDEX_REGISTER
317253
+  string regexp = "^(" + regnames + "),(" + regnames + ")$";
317253
+  vector<string> matches;
317253
+  if (!regexp_match(asmarg, regexp, matches))
317253
+    {
317253
+      // delegate to parenthetic syntax
317253
+      return try_parse_arg_effective_addr (e, string("(")+asmarg+string(")"), precision);
317253
+    }
317253
+
317253
+  return NULL;
317253
+}
317253
+
317253
+expression*
317253
 sdt_uprobe_var_expanding_visitor::try_parse_arg_effective_addr (target_symbol *e,
317253
                                                                 const string& asmarg,
317253
                                                                 long precision)
317253
@@ -7014,6 +7038,7 @@ sdt_uprobe_var_expanding_visitor::try_parse_arg_effective_addr (target_symbol *e
317253
   return argexpr;
317253
 }
317253
 
317253
+
317253
 expression*
317253
 sdt_uprobe_var_expanding_visitor::try_parse_arg_varname (target_symbol *e,
317253
                                                          const string& asmarg,
317253
@@ -7139,7 +7164,7 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol_arg (target_symbol *e)
317253
       //                    indirect offset   offset                       VAR+off
317253
       // x86    $N      %rR (%rR)    N(%rR)   O(%bR,%iR,S)     var var+off var+off(%rip)
317253
       // x86_64 $N      %rR (%rR)    N(%rR)   O(%bR,%iR,S)     var var+off var+off(%rip)
317253
-      // power  iN      R   (R)      N(R)
317253
+      // power  iN      R   (R)      N(R)     R,R
317253
       // ia64   N       rR  [r16]
317253
       // s390   N       %rR 0(rR)    N(r15)
317253
       // arm    #N      rR  [rR]     [rR, #N]
317253
@@ -7164,6 +7189,8 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol_arg (target_symbol *e)
317253
             goto matched;
317253
           if ((argexpr = try_parse_arg_offset_register(e, asmarg, precision)) != NULL)
317253
             goto matched;
317253
+          if ((argexpr = try_parse_arg_register_pair(e, asmarg, precision)) != NULL)
317253
+            goto matched;
317253
           if ((argexpr = try_parse_arg_effective_addr(e, asmarg, precision)) != NULL)
317253
             goto matched;
317253
           if ((argexpr = try_parse_arg_varname(e, asmarg, precision)) != NULL)