Blob Blame History Raw
commit 5a540e9f35dd91d26ea342d5b53a1f2d52109f72
Author: David Smith <dsmith@redhat.com>
Date:   Mon Mar 27 10:32:50 2017 -0500

    BZ1431263: Always use HW_BREAKPOINT_LEN_* macros.
    
    * tapsets.cxx (hwbkpt_derived_probe_group::emit_module_init): Always use
      HW_BREAKPOINT_LEN_* macros, not just on x86_64.

diff --git a/tapsets.cxx b/tapsets.cxx
index 9be2d04..ccd7cbb 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -10305,31 +10305,26 @@ hwbkpt_derived_probe_group::emit_module_init (systemtap_session& s)
   s.op->newline(-1) << "}";
   s.op->newline() << "hp->bp_type = skp->atype;";
 
-  // On x86 & x86-64, hp->bp_len is not just a number but a macro/enum (!?!).
-  if (s.architecture == "i386" || s.architecture == "x86_64" )
-    {
-      s.op->newline() << "switch(skp->len) {";
-      s.op->newline() << "case 1:";
-      s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_1;";
-      s.op->newline() << "break;";
-      s.op->newline(-1) << "case 2:";
-      s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_2;";
-      s.op->newline() << "break;";
-      s.op->newline(-1) << "case 3:";
-      s.op->newline() << "case 4:";
-      s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_4;";
-      s.op->newline() << "break;";
-      s.op->newline(-1) << "case 5:";
-      s.op->newline() << "case 6:";
-      s.op->newline() << "case 7:";
-      s.op->newline() << "case 8:";
-      s.op->newline() << "default:"; // XXX: could instead reject
-      s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_8;";
-      s.op->newline() << "break;";
-      s.op->newline(-1) << "}";
-    }
-  else // other architectures presumed straightforward
-    s.op->newline() << "hp->bp_len = skp->len;";
+  // Convert actual len to bp len.
+  s.op->newline() << "switch(skp->len) {";
+  s.op->newline() << "case 1:";
+  s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_1;";
+  s.op->newline() << "break;";
+  s.op->newline(-1) << "case 2:";
+  s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_2;";
+  s.op->newline() << "break;";
+  s.op->newline(-1) << "case 3:";
+  s.op->newline() << "case 4:";
+  s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_4;";
+  s.op->newline() << "break;";
+  s.op->newline(-1) << "case 5:";
+  s.op->newline() << "case 6:";
+  s.op->newline() << "case 7:";
+  s.op->newline() << "case 8:";
+  s.op->newline() << "default:"; // XXX: could instead reject
+  s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_8;";
+  s.op->newline() << "break;";
+  s.op->newline(-1) << "}";
 
   s.op->newline() << "probe_point = skp->probe->pp;"; // for error messages
   s.op->newline() << "#ifdef STAPCONF_HW_BREAKPOINT_CONTEXT";