# Understanding SystemTap Errors

By type - http://sourceware.org/systemtap/tutorial/node23.html

This chapter explains the most common errors you may encounter while using SystemTap.

## Parse and Semantic Errors

These types of errors occur while SystemTap attempts to parse and translate the script into C, prior to being converted into a kernel module. For example type errors result from operations that assign invalid values to variables or arrays.

parse error: expected foo, saw bar

The script contains a grammatical/typographical error. SystemTap detected type of construct that is incorrect, given the context of the probe.

understanding SystemTap errors parse/semantics error invalid values to variables/arrays
errors parse/semantics error invalid values to variables/arrays
parse/semantics error understanding SystemTap errors invalid values to variables/arrays
invalid values to variables/arrays parse/semantics error understanding SystemTap errors
understanding SystemTap errors parse/semantics error grammatical/typographical script error
errors parse/semantics error grammatical/typographical script error
parse/semantics error understanding SystemTap errors grammatical/typographical script error
grammatical/typographical script error parse/semantics error understanding SystemTap errors
typographical script error parse/semantics error understanding SystemTap errors
need more clarification (example) on this; could not replicate. how to replicate?

The following invalid SystemTap script is missing its probe handlers:

It results in the following error message showing that the parser was expecting 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).

parse error: embedded code in unprivileged script

The script contains unsafe embedded C code (blocks of code surrounded by `%{` `%}`. 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; as such, SystemTap warns you with this error if such constructs appear in the script.

understanding SystemTap errors parse/semantics error embedded code in unprivileged script
errors parse/semantics error embedded code in unprivileged script
parse/semantics error understanding SystemTap errors embedded code in unprivileged script
embedded code in unprivileged script parse/semantics error understanding SystemTap errors
unprivileged script, embedded code in parse/semantics error understanding SystemTap errors
unsafe embedded code in unprivileged script parse/semantics error understanding SystemTap errors

If you are sure of the safety of any similar constructs in the script and are member of `stapdev` group (or have root privileges), run the script in "guru" mode by using the option `-g` (i.e. `stap -g script`).

semantic error: type mismatch for identifier 'foo' ... string vs. long

The function `foo` in the script used the wrong type (i.e. `%s` or `%d`). This error will present itself in , because the function `execname()` returns a string the format specifier should be a `%s`, not `%d`.

understanding SystemTap errors parse/semantics error type mismatch for identifier
errors parse/semantics error type mismatch for identifier
parse/semantics error understanding SystemTap errors type mismatch for identifier
type mismatch for identifier parse/semantics error understanding SystemTap errors
identifier type mismatch parse/semantics error understanding SystemTap errors

error-variable.stp

    probe syscall.open
    {
      printf ("%d(%d) open\n", execname(), pid())
    }

semantic error: unresolved type for identifier 'foo'

The identifier (e.g. a 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.

understanding SystemTap errors parse/semantics error unresolved type for identifier
errors parse/semantics error unresolved type for identifier
parse/semantics error understanding SystemTap errors unresolved type for identifier
unresolved type for identifier parse/semantics error understanding SystemTap errors

semantic error: Expecting symbol or array index expression

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:

understanding SystemTap errors parse/semantics error expected symbol/array index expression
errors parse/semantics error expected symbol/array index expression
parse/semantics error understanding SystemTap errors expected symbol/array index expression
expected symbol/array index expression parse/semantics error understanding SystemTap errors

while searching for arity N function, semantic error: unresolved function call

A function call or array index expression in the script used an invalid number of arguments/parameters. In SystemTap arity can either refer to the number of indices for an array, or the number of parameters to a function.

understanding SystemTap errors parse/semantics error unresolved function call
errors parse/semantics error unresolved function call
parse/semantics error understanding SystemTap errors unresolved function call
unresolved function call parse/semantics error understanding SystemTap errors
function call (unresolved) parse/semantics error understanding SystemTap errors

semantic error: array locals not supported, missing global declaration?

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.

array locals not supported parse/semantics error understanding SystemTap errors
understanding SystemTap errors parse/semantics error non-global arrays
errors parse/semantics error non-global arrays
parse/semantics error understanding SystemTap errors non-global arrays
non-global arrays parse/semantics error understanding SystemTap errors

semantic error: variable ’foo’ modiﬁed during ’foreach’ iteration

The array `foo` is being modifed (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.

understanding SystemTap errors parse/semantics error variable modified during 'foreach'
errors parse/semantics error variable modified during 'foreach'
parse/semantics error understanding SystemTap errors variable modified during 'foreach'
variable modified during 'foreach' parse/semantics error understanding SystemTap errors

semantic error: probe point mismatch at position N, while resolving probe point foo

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. The N refers to the line and column of the error.

understanding SystemTap errors parse/semantics error probe mismatch
errors parse/semantics error probe mismatch
parse/semantics error understanding SystemTap errors probe mismatch
probe mismatch parse/semantics error understanding SystemTap errors
how to explain N in previous? "The divergence from the “tree” of probe point namespace is at position N (starting with zero at left)." (from tutorial)

semantic error: no match for probe point, while resolving probe point foo

The events/handler function `foo` could not be resolved altogether, for a variety of reasons. This error occurs when the script contains the event `kernel.function("blah")`, and `blah` does not exist. In some cases, the error could also mean the script contains an invalid kernel file name or source line number.

understanding SystemTap errors parse/semantics error no match for probe point
errors parse/semantics error no match for probe point
parse/semantics error understanding SystemTap errors no match for probe point
no match for probe point parse/semantics error understanding SystemTap errors
probe point (no match for) parse/semantics error understanding SystemTap errors

semantic error: unresolved target-symbol expression

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.

understanding SystemTap errors parse/semantics error unresolved target-symbol expression
errors parse/semantics error unresolved target-symbol expression
parse/semantics error understanding SystemTap errors unresolved target-symbol expression
unresolved target-symbol expression parse/semantics error understanding SystemTap errors
target-symbol expression, unresolved parse/semantics error understanding SystemTap errors

semantic error: libdwﬂ failure

There was a problem processing the debugging information. In most cases, this error results from the installation of a `kernel-debuginfo` RPM whose version does not match the probed kernel exactly. The installed `kernel-debuginfo` RPM itself may have some consistency/correctness problems.

understanding SystemTap errors parse/semantics error libdwfl failure
errors parse/semantics error libdwfl failure
parse/semantics error understanding SystemTap errors libdwfl failure
libdwfl failure parse/semantics error understanding SystemTap errors

semantic error: cannot find foo debuginfo

SystemTap could not find a suitable `kernel-debuginfo` at all.

understanding SystemTap errors parse/semantics error
errors parse/semantics error
parse/semantics error understanding SystemTap errors
understanding SystemTap errors parse/semantics error guru mode
errors parse/semantics error guru mode
parse/semantics error understanding SystemTap errors guru mode
guru mode parse/semantics error understanding SystemTap errors

## Run Time Errors and Warnings

Runtime errors and warnings occur when the SystemTap instrumentation has been installed and is collecting data on the system.

WARNING: Number of errors: N, skipped probes: M

Errors and/or skipped probes occurred during this run. Both N and M are the counts of the number of probes that were not executed due to conditions such as too much time required to execute event handlers over an interval of time.

understainding SystemTap errors runtime errors/warnings number of errors: N, skipped probes: M
errors runtime errors/warnings number of errors: N, skipped probes: M
runtime errors/warnings understainding SystemTap errors number of errors: N, skipped probes: M
number of errors: N, skipped probes: M runtime errors/warnings understainding SystemTap errors

division by 0

The script code performed an invalid division.

understainding SystemTap errors runtime errors/warnings division by 0
errors runtime errors/warnings division by 0
runtime errors/warnings understainding SystemTap errors division by 0
division by 0 runtime errors/warnings understainding SystemTap errors
invalid division runtime errors/warnings understainding SystemTap errors

aggregate element not found

A statistics extractor function other than `@count` was invoked on an aggregate that has not had any values accumulated yet. This is similar to a division by zero.

understainding SystemTap errors runtime errors/warnings aggregate element not found
errors runtime errors/warnings aggregate element not found
runtime errors/warnings understainding SystemTap errors aggregate element not found
aggregate element not found runtime errors/warnings understainding SystemTap errors

aggregation overflow

An array containing aggregate values contains too many distinct key pairs at this time.

understainding SystemTap errors runtime errors/warnings aggregation overflow
errors runtime errors/warnings aggregation overflow
runtime errors/warnings understainding SystemTap errors aggregation overflow
aggregation overflow runtime errors/warnings understainding SystemTap errors
overflow of aggregation runtime errors/warnings understainding SystemTap errors

MAXNESTING exceeded

Too many levels of function call nesting were attempted. The default nesting of function calls allowed is 10.

understainding SystemTap errors runtime errors/warnings MAXNESTING exceeded
errors runtime errors/warnings MAXNESTING exceeded
runtime errors/warnings understainding SystemTap errors MAXNESTING exceeded
MAXNESTING exceeded runtime errors/warnings understainding SystemTap errors
exceeded MAXNESTING runtime errors/warnings understainding SystemTap errors

MAXACTION exceeded

The probe handler attempted to execute too many statements in the probe handler. The default number of actions allowed in a probe handler is 1000.

understainding SystemTap errors runtime errors/warnings MAXACTION exceeded
errors runtime errors/warnings MAXACTION exceeded
runtime errors/warnings understainding SystemTap errors MAXACTION exceeded
MAXACTION exceeded runtime errors/warnings understainding SystemTap errors
exceeded MAXACTION runtime errors/warnings understainding SystemTap errors

kernel/user string copy fault at ADDR

The probe handler attempted to copy a string from kernel or user-space at an invalid address (ADDR).

understainding SystemTap errors runtime errors/warnings copy fault
errors runtime errors/warnings copy fault
runtime errors/warnings understainding SystemTap errors copy fault
copy fault runtime errors/warnings understainding SystemTap errors

pointer dereference fault

There was a fault encountered during a pointer dereference operation such as a target variable evaluation.

understainding SystemTap errors runtime errors/warnings pointer dereference fault
errors runtime errors/warnings pointer dereference fault
runtime errors/warnings understainding SystemTap errors pointer dereference fault
pointer dereference fault runtime errors/warnings understainding SystemTap errors
understainding SystemTap errors runtime errors/warnings
errors runtime errors/warnings
runtime errors/warnings understainding SystemTap errors