funclatency/sslsniff: fix the TypeError when enabling pid filter on uprobe
attach_uprobe() and attach_uretprobe() expect the type of pid argument
is "int" instead of "str". Fix it by specifying the type of the "-p"/"--pid"
option as "int", and updating the format string of args.pid accordingly.
Fixes: d73c58f0c8c754bd591264205ac2ddc83c1d2c7f
diff --git a/tools/funclatency.py b/tools/funclatency.py
index a35e363..d2e65f2 100755
--- a/tools/funclatency.py
+++ b/tools/funclatency.py
@@ -45,7 +45,7 @@
description="Time functions and print latency as a histogram",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=examples)
-parser.add_argument("-p", "--pid",
+parser.add_argument("-p", "--pid", type=int,
help="trace this PID only")
parser.add_argument("-i", "--interval", default=99999999,
help="summary interval, seconds")
@@ -147,7 +147,7 @@
# code substitutions
if args.pid:
bpf_text = bpf_text.replace('FILTER',
- 'if (tgid != %s) { return 0; }' % args.pid)
+ 'if (tgid != %d) { return 0; }' % args.pid)
else:
bpf_text = bpf_text.replace('FILTER', '')
if args.milliseconds: