(continued from previous page) printf("%s <= %s in %s:%d\
", thread_indent(-1), funcname, filename, lineno); } $ stap \ show-call-hierarchy.stp \ -c"./python test.py" It can be invoked like this: The output looks like this: where the columns are: and the remainder indicates the call/return hierarchy as the script executes. For a –enable-shared build of CPython, the markers are contained within the libpython shared library, and the probe’s dotted path needs to reflect this. For example, this line from the above example: • time in microseconds since start of script • name of executable • PID of process probe process("python").mark("function__entry") { probe should instead read: (assuming a debug build of CPython 3.6) 4 Available static markers The filename, function name, and line number are provided back to the tracing script as positional arguments, which must be accessed using$_{$arg1}$ ,$_{$arg2}$ ,$_{$arg3}$ : This marker indicates that execution of a Python function has begun. It is only triggered for pure-Python (bytecode) functions. This marker is the converse of$_{function__entry()}$ , and indicates that execution of a Python function has ended (either via$_{return}$, or via an exception). It is only triggered for pure-Python (bytecode) functions. The arguments are the same as for$_{function__entry()}$ function__entry(str filename, str funcname, int lineno) function__return(str filename, str funcname, int lineno) • $arg1 :$_{(const char *)}$ filename, accessible using$_{user_string($arg1)}$ • $arg2 :$_{(const char *)}$ function name, accessible using$_{user_string($arg2)}$ • $arg3 :$_{int}$ line number 5 11408 python(8274): => __contains__ in Lib/_abcoll.py:362 11414 python(8274): => __getitem__ in Lib/os.py:425 11418 python(8274):=> encode in Lib/os.py:490 11424 python(8274):<= encode in Lib/os.py:493 11428 python(8274): <= __getitem__ in Lib/os.py:426 11433 python(8274): <= __contains__ in Lib/_abcoll.py:366