This chapter explains the most common errors you may encounter while using SystemTap.
Parse and semantic errors occur while SystemTap attempts to parse and translate the script into C, before converting it into a kernel module. For example, type errors result from operations that assign invalid values to variables or arrays.
The script contains a grammatical or typographical error. SystemTap detected the type of the construct that is incorrect, given the context of the probe.
For example, the following invalid SystemTap script is missing its probe handlers:
probe vfs.read
probe vfs.write
An attempt to run this SystemTap script fails with the following error message showing that the parser expects something other than the probe keyword in column 1 of line 2:
parse error: expected one of '. , ( ? ! { = +='
saw: keyword at perror.stp:2:1
1 parse error(s).
The script contains unsafe embedded C code, that is, blocks of code surrounded by %{ and %}. SystemTap allows you to embed C code in a script, which is useful if there are no tapsets to suit your purposes. However, embedded C constructs are not safe and SystemTap reports this error to warn you if such constructs appear in the script.
If you are sure that any similar constructs in the script are safe and you are a member of the stapdev group (or have root privileges), run the script in “guru” mode by using the -g option:
stap -g script
The function foo in the script used the wrong type (such as %s or %d). In the following example, the format specifier should be %s and not %d, because the execname() function returns a string:
probe syscall.open
{
printf ("%d(%d) open\n", execname(), pid())
}
The identifier (variable) was used, but no type (integer or string) could be determined. This occurs, for instance, if you use a variable in a printf statement while the script never assigns a value to the variable.
SystemTap could not assign a value to a variable or to a location in an array. The destination for the assignment is not a valid destination. The following example code would generate this error:
probe begin { printf("x") = 1 }
A function call or array index expression in the script used an invalid number of arguments or parameters. In SystemTap, arity can either refer to the number of indices for an array, or the number of parameters to a function.
The script used an array operation without declaring the array as a global variable (global variables can be declared after their use in SystemTap scripts). Similar messages appear if an array is used, but with inconsistent arities.
The array foo is being modified (being assigned to or deleted from) within an active foreach loop. This error also displays if an operation within the script performs a function call within the foreach loop.
SystemTap did not understand what the event or SystemTap function foo refers to. This usually means that SystemTap could not find a match for foo in the tapset library. N refers to the line and column of the error.
SystemTap could not resolve the events or handler function foo for a variety of reasons. This error occurs when the script contains the event kernel.function(“something”), and something does not exist. In some cases, the error could also mean the script contains an invalid kernel file name or source line number.
A handler in the script references a target variable, but the value of the variable could not be resolved. This error could also mean that a handler is referencing a target variable that is not valid in the context when it was referenced. This may be a result of compiler optimization of the generated code.
There was a problem processing the debugging information. In most cases, this error results from the installation of a kernel-debuginfo package whose version does not match the probed kernel exactly. The installed kernel-debuginfo package itself may have some consistency or correctness problems.
SystemTap could not find a suitable kernel-debuginfo package.