Recursive functions
}
This prints:
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
1.4.3. Recursive functions
function fibonacci(i) {
if (i < 1) error ("bad number")
if (i == 1) return 1
if (i == 2) return 2
return fibonacci (i-1) + fibonacci (i-2)
}
probe begin {
printf ("11th fibonacci number: %d", fibonacci (11))
exit ()
}
This prints:
11th fibonacci number: 118
Any larger number input to the function may exceed the MAXACTION or MAXNESTING limits, which
Section 1.6, "Safety
will be caught at run time and result in an error. For more about limits see Section
and
security".
1.5. The stap command
The stap program is the front-end to the SystemTap tool. It accepts probing instructions written in
its scripting language, translates those instructions into C code, compiles this C code, and loads the
3