Debian Codegraph @

testsuite/systemtap.examples/general/tcl-trace.stp

raw
1 #! /usr/bin/env stap
2 # Copyright (C) 2018 Red Hat, Inc.
3 # Written by William Cohen <[email protected]>
4 #
5 # Example usage of the tcl tracepoints to show a nested view of all
6 # tcl function calls (and returns) across the whole system.
7 #
8 # Run this using
9 # stap tcl-trace.stp
10 # to instrument all tcl processes on the system, or (for example) using
11 # stap tcl-trace.stp -c COMMAND
12 # to instrument a specific program (implemented in tcl)
13
14 probe process("/usr/lib*/libtcl*.so").mark("proc__entry")
15 {
16 funcname = user_string($arg1)
17 printf("%s => %s\n", thread_indent(1), funcname);
18 }
19
20 probe process("/usr/lib*/libtcl*.so").mark("cmd__entry")
21 {
22 cmdname = user_string($arg1)
23 printf("%s > %s\n", thread_indent(1), cmdname);
24 }
25
26 probe process("/usr/lib*/libtcl*.so").mark("proc__return")
27 {
28 funcname = user_string($arg1)
29 printf("%s <= %s\n", thread_indent(-1), funcname);
30 }
31
32 probe process("/usr/lib*/libtcl*.so").mark("cmd__return")
33 {
34 cmdname = user_string($arg1)
35 printf("%s < %s\n", thread_indent(-1), cmdname);
36 }