]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: fix to handle multiple SDT-based probes in a single function
authorKris Van Hees <kris.van.hees@oracle.com>
Wed, 1 Aug 2012 14:05:30 +0000 (10:05 -0400)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 29 Jun 2015 21:40:28 +0000 (22:40 +0100)
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
scripts/dtrace_sdt.sh

index a7af742025d5499fde2b6dbbb9e790d48f46dc07..11c3bf5efd5147d49e04e0fb8c1f72dd340774ee 100755 (executable)
@@ -24,7 +24,7 @@ lfn="$2"
                 next;
             }
 
-            / F / {
+            $3 == "F" {
                 printf "%16s %s F %s\n", $4, $1, $6;
 
                 if (!lfn)
@@ -46,6 +46,7 @@ lfn="$2"
                 printf "%16s %s R %s %s\n", sect, $1, $3, sectbase[sect];
                 next;
             }' | \
+tee /tmp/sdt.log | \
        sort
     [ "x${lfn}" != "x" ] && nm ${lfn}
 ) | \
@@ -131,34 +132,44 @@ lfn="$2"
         $2 ~ /^[tT]$/ {
             fun = $3;
 
-            if (fun in prdata) {
+            if (fun in probes) {
                 baseaddr = $1;
                 sub(/^0+/, "", baseaddr);
 
-                $0 = prdata[fun];
-                sub(/^0+/, "", $1);
-                sub(/^0+/, "", $4);
+                $0 = probes[fun];
 
-                print "\tPTR\t0x" addl(baseaddr, subl($1, $4));
-                print "\tPTR\t" length($3);
-                print "\tPTR\t" length(fun);
-                print "\t.asciz\t\042" $3 "\042";
-                print "\t.asciz\t\042" fun "\042";
-                print "\tALGN";
+                for (i = 1; i <= NF; i++) {
+                    prb = $i;
 
-                probec++;
+                    print "\tPTR\t0x" addl(baseaddr, poffst[prb]);
+                    print "\tPTR\t" length(prb);
+                    print "\tPTR\t" length(fun);
+                    print "\t.asciz\t\042" prb "\042";
+                    print "\t.asciz\t\042" fun "\042";
+                    print "\tALGN";
+
+                    probec++;
+                }
             }
+
             next;
         }
 
         $3 == "F" {
             fun = $4;
             addr = $2;
+
+            sub(/^0+/, "", addr);
+
             next;
         }
 
         $3 == "R" {
-            prdata[fun] = $2 " " $5 " " $4 " " addr;
+            sub(/^0+/, "", $2);
+
+            probes[fun] = $4 " " probes[fun];
+            poffst[$4] = subl($2, addr);
+
             next;
         }