此内容没有您所选择的语言版本。
9.2. Context at the probe point
The following functions provide ways to access the current task context at a probe point. Note that these may not return correct values when a probe is hit in interrupt context.
9.2.1. backtrace
General syntax:
backtrace:string ()
Returns a string of hex addresses that are a backtrace of the stack. The output is truncated to MAXSTRINGLEN.
9.2.2. caller
General syntax:
caller:string()
Returns the address and name of the calling function. It works only for return probes.
9.2.3. caller_addr
General syntax:
caller_addr:long ()
Returns the address of the calling function. It works only for return probes.
9.2.9. is_return
General syntax:
is_return:long ()
Returns 1 if the probe point is a return probe, else it returns zero.
Deprecated.
9.2.15. print_backtrace
General syntax:
print_backtrace:unknown ()
This function is equivalent to
print_stack(backtrace())
, except that deeper stack nesting is supported. The function does not return a value.
9.2.17. print_stack
General syntax:
print_stack:unknown (stk:string)
This function performs a symbolic lookup of the addresses in the given string, which is assumed to be the result of a prior call to
backtrace()
. It prints one line per address. Each printed line includes the address, the name of the function containing the address, and an estimate of its position within that function. The function does not return a value.
9.2.19. stack_unused
General syntax:
stack_unused:long ()
Returns how many bytes are currently unused in the stack.
9.2.20. stack_used
General syntax:
stack_used:long ()
Returns how many bytes are currently used in the stack.
9.2.22. target
General syntax:
target:long ()
Returns the process ID of the target process. This is useful in conjunction with the -x PID or -c CMD command-line options to stap. An example of its use is to create scripts that filter on a specific process.
-x <pid>
target() returns the pid specified by -x
-c <command>
target() returns the pid for the executed command specified by -c.