]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: ensure new SDT info generation works on sparc64
authorKris Van Hees <kris.van.hees@oracle.com>
Wed, 14 Sep 2016 10:40:19 +0000 (06:40 -0400)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 14 Oct 2016 17:05:43 +0000 (18:05 +0100)
Due to addresses on sparc64 being in the lower range of the memory map, the
calculated addresses for SDT probe points were represented with less hex
characters then their function base address counterparts (obtained from
objdump output).  This messed up the sorting based on address values, and
resulted in all probe points being associated with the last function in the
list.

This commit ensures that all addresses are 16 hex characters long.

Orabug: 24655168

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
scripts/dtrace_sdt.sh

index beeef8102ae588d192c4bbd52e999f5cd29304e4..bcff44aa0feb992dd6fd093551be64e574324b29 100755 (executable)
@@ -138,7 +138,7 @@ if [ "$tok" = "kmod" ]; then
 
                  if (v0l > v1l) {
                      if (v0h >= v1h) {
-                         d = sprintf("%x%x", v0h - v1h, v0l - v1l);
+                         d = sprintf("%08x%08x", v0h - v1h, v0l - v1l);
                      } else {
                          printf "#error Invalid addresses: %x vs %x", v0, v1 \
                                                                 >"/dev/stderr";
@@ -152,7 +152,7 @@ if [ "$tok" = "kmod" ]; then
              } else {
                  v0 = strtonum("0x"v0);
                  v1 = strtonum("0x"v1);
-                 d = sprintf("%x", v0 - v1);
+                 d = sprintf("%016x", v0 - v1);
              }
              $0 = tmp;
 
@@ -279,11 +279,11 @@ else
                  if (length(d) > 8)
                      v0h++;
 
-                 d = sprintf("%x%x", v0h, v0l);
+                 d = sprintf("%08x%08x", v0h, v0l);
              } else {
                  v0 = strtonum("0x"v0);
                  v1 = strtonum("0x"v1);
-                 d = sprintf("%x", v0 + v1);
+                 d = sprintf("%016x", v0 + v1);
              }
              $0 = tmp;
 
@@ -327,7 +327,7 @@ else
 
                  if (v0l > v1l) {
                      if (v0h >= v1h) {
-                         d = sprintf("%x%x", v0h - v1h, v0l - v1l);
+                         d = sprintf("%08x%08x", v0h - v1h, v0l - v1l);
                      } else {
                          printf "#error Invalid addresses: %x vs %x", v0, v1 \
                                                                 >"/dev/stderr";
@@ -341,7 +341,7 @@ else
              } else {
                  v0 = strtonum("0x"v0);
                  v1 = strtonum("0x"v1);
-                 d = sprintf("%x", v0 - v1);
+                 d = sprintf("%016x", v0 - v1);
              }
              $0 = tmp;