Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/cast-scope.stp

raw
1 global function_string, statement_string, mark_string
2
3 probe process.function("[email protected]")
4 {
5 function_string .= sprintf("function direct: %s\n", $str$$)
6 function_string .= sprintf("function cast: %s\n", @cast($str, "sClass")$$)
7 }
8
9 probe process.statement("[email protected]+5")
10 {
11 statement_string .= sprintf("statement direct: %s\n", $str$$)
12 statement_string .= sprintf("statement cast: %s\n", @cast($str, "sClass")$$)
13 }
14
15 probe process.mark("length")
16 {
17 mark_string .= sprintf("mark cast: %s\n", @cast($arg1, "sClass")$$)
18 }
19
20 probe end
21 {
22 # Why print the strings this way? cast-scope.exp expects the
23 # output in a certain order. If the probe addresses end up
24 # the same, the process.function/process.mark probes might get
25 # called in any order.
26 #
27 # So, we'll print the strings in a defined order.
28 printf("%s", function_string);
29 printf("%s", mark_string);
30 printf("%s", statement_string);
31 }