--- /dev/null
+title: Callgraph tracing with arguments
+name: para-callgraph.stp
+keywords: trace callgraph
+subsystem: general
+description: Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger.
+test_check: stap -p4 para-callgraph.stp sys_read '*@fs/*.c'
+test_installcheck: TBD
--- /dev/null
+function trace(entry_p) {\r
+ if(tid() in trace)\r
+ printf("%s%s%s\n",thread_indent(entry_p),\r
+ (entry_p>0?"->":"<-"),\r
+ probefunc())\r
+}\r
+\r
+global trace\r
+probe kernel.function(@1).call {\r
+ if (execname() == "stapio") next # skip our own helper process\r
+ trace[tid()] = 1\r
+ trace(1)\r
+}\r
+probe kernel.function(@1).return {\r
+ trace(-1)\r
+ delete trace[tid()]\r
+}\r
+\r
+probe kernel.function(@2).call { trace(1) }\r
+probe kernel.function(@2).return { trace(-1) }\r
+function trace(entry_p) {\r
+ if(tid() in trace)\r
+ printf("%s%s%s\n",thread_indent(entry_p),\r
+ (entry_p>0?"->":"<-"),\r
+ probefunc())\r
+}\r
+\r
+global trace\r
+probe kernel.function(@1).call {\r
+ if (execname() == "stapio") next # skip our own helper process\r
+ trace[tid()] = 1\r
+ trace(1)\r
+}\r
+probe kernel.function(@1).return {\r
+ trace(-1)\r
+ delete trace[tid()]\r
+}\r
+\r
+probe kernel.function(@2).call { trace(1) }\r
+probe kernel.function(@2).return { trace(-1) }\r