From d0dca8f4c797a6c41d45147b3fe7a359e98179ef Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 18 Nov 2008 23:10:02 -0500 Subject: [PATCH] Proof Understanding SystemTap Errors Chapter. --- .../en-US/Errors.xml | 181 +++++++++++++++--- 1 file changed, 154 insertions(+), 27 deletions(-) diff --git a/doc/SystemTap_Beginners_Guide/en-US/Errors.xml b/doc/SystemTap_Beginners_Guide/en-US/Errors.xml index 55081185d..13adc64f9 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Errors.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Errors.xml @@ -10,9 +10,13 @@ This chapter explains the most common errors you may encounter while using SystemTap.
- Parse and Type Errors + 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. Specifically, type errors result from operations that assign invalid values to variables or arrays. +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 <replaceable>foo</replaceable>, saw <replaceable>bar</replaceable> @@ -20,20 +24,63 @@ -need more clarification (example) on this; could not replicate. how to replicate? +need more clarification (example) on this; could not replicate. how to + replicate? + + + The following invalid SystemTap script is missing the the probe + handlers: + + + + + + + + + + It results in the following error message showing that the parser was + expecting something other than the probe 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 constructs; in most cases, embedded C. SystemTap allows you to embed C code in a script, which is useful if there are no tapsets to suit your purposes. However, some embedded C constructs may not be safe; as such, SystemTap warns you with this error if such constructs appear in the script. (from ) is an example of a script that contains embedded C. + + 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 be + safe; as such, SystemTap warns you with this error if such constructs + appear in the script. + -If you are sure of the safety of any similar constructs in the script, run the script in "guru" mode by using the option -g (i.e. stap -g script). + + 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 '<replaceable>foo</replaceable>' ... string vs. long - The function foo in the script used the wrong type of variable (i.e. %s or %d). This error will present itself in , since the function execname should be referenced using %s, not %d. - + 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. + @@ -48,45 +95,54 @@ probe syscall.open semantic error: unresolved type for identifier '<replaceable>foo</replaceable>' -The identifier (e.g. a variable) was used, but no operation could assign it a type (e.g. integer, string). This occurs, for instance, if you use a variable in a printf statement while no other function in the script can assign a value to it. +The identifier (e.g. a variable) was used, but no type (integer or + string)could be determine. This occurs, for instance, if you use a + variable in a printf statement while no other + function in the script can assign a value to it. semantic error: Expecting symbol or array index expression -SystemTap found an operation that could not assign a value to a variable or unique key referenced by an 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: + + + + + + -
- -
- Symbol Errors - -Symbol errors result from operations in the script that process variables, arrays, or function calls incorrectly. Unlike "type" errors — which assign invalid values to a variable or array — symbol errors prevent the script from assigning any value altogether. - while searching for arity <replaceable>N</replaceable> 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 key pairs to an array, or the number of parameters to a function. +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. semantic error: array locals not supported: - The script used an array operation without declaring the array as global first. Similar messages appear if an array is used, but with inconsistent arities. + 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. semantic error: variable ’<replaceable>foo</replaceable>’ modified during ’foreach’ 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. -
- -
- Probe Errors -Probe errors result from the use of invalid events (e.g. events that could not be found in the tapset library), or the use of handlers that are invalid in the context of the probe. - semantic error: probe point mismatch at position <replaceable>N</replaceable>, while resolving probe point <replaceable>foo</replaceable> - SystemTap did not understand what the event / handler function foo refers to. This usually means that SystemTap could not find a match for foo in the tapset library. + 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 column + the error occurred in. 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) @@ -103,11 +159,14 @@ probe syscall.open semantic error: libdwfl 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 perfectly. Sometimes, the installed kernel-debuginfo RPM itself may have some consistency / correctness problems. + 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. - semantic error: cannot find <replaceable>foo</replaceable> debuginfo + semantic error: cannot find <replaceable>foo</replaceable> debuginfo SystemTap could not find a suitable kernel-debuginfo at all.