<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 6. Understanding SystemTap Errors</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta name="generator" content="publican 2.8" /><meta name="package" content="Systemtap-SystemTap_Beginners_Guide-2.1-en-US-2.1-2" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="index.html" title="SystemTap Beginners Guide" /><link rel="prev" href="futexcontentionsect.html" title="5.4. Identifying Contended User-Space Locks" /><link rel="next" href="runtimeerror.html" title="6.2. Run Time Errors and Warnings" /></head><body><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="futexcontentionsect.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="runtimeerror.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="chapter" id="errors" lang="en-US"><div class="titlepage"><div><div><h2 class="title">Chapter 6. Understanding SystemTap Errors</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="errors.html#parsetype">6.1. Parse and Semantic Errors</a></span></dt><dt><span class="section"><a href="runtimeerror.html">6.2. Run Time Errors and Warnings</a></span></dt></dl></div><div class="para"> This chapter explains the most common errors you may encounter while using SystemTap. </div><div class="section" id="parsetype"><div class="titlepage"><div><div keep-together.within-column="always"><h2 class="title" id="parsetype">6.1. Parse and Semantic Errors</h2></div></div></div><a id="idp2190240" class="indexterm"></a><a id="idm1233384" class="indexterm"></a><a id="idp37018968" class="indexterm"></a><div class="para"> 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. </div><div class="formalpara"><h5 class="formalpara" id="idm6663480">parse error: expected <em class="replaceable"><code>foo</code></em>, saw <em class="replaceable"><code>bar</code></em></h5><a id="idm22020048" class="indexterm"></a><a id="idm7429904" class="indexterm"></a><a id="idp4281232" class="indexterm"></a><a id="idp12467128" class="indexterm"></a><a id="idp11978424" class="indexterm"></a><a id="idm4572328" class="indexterm"></a><a id="idm6339480" class="indexterm"></a><a id="idm6338528" class="indexterm"></a><a id="idp6075000" class="indexterm"></a> The script contains a grammatical/typographical error. SystemTap detected type of construct that is incorrect, given the context of the probe. </div><div class="para"> The following invalid SystemTap script is missing its probe handlers: </div><div class="para"> <pre class="programlisting">probe vfs.read probe vfs.write </pre> </div><div class="para"> It results in the following error message showing that the parser was expecting something other than the <code class="command">probe</code> keyword in column 1 of line 2: </div><div class="para"> <pre class="programlisting">parse error: expected one of '. , ( ? ! { = +=' saw: keyword at perror.stp:2:1 1 parse error(s).</pre> </div><div class="formalpara"><h5 class="formalpara" id="idm9802200">parse error: embedded code in unprivileged script</h5><a id="idm9801600" class="indexterm"></a><a id="idm1221816" class="indexterm"></a><a id="idm1220888" class="indexterm"></a><a id="idp2924016" class="indexterm"></a><a id="idp2924968" class="indexterm"></a><a id="idp2925920" class="indexterm"></a> The script contains unsafe embedded C code (blocks of code surrounded by <code class="command">%{</code> <code class="command">%}</code>. 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. </div><a id="idp30908496" class="indexterm"></a><a id="idp5471744" class="indexterm"></a><a id="idp5472688" class="indexterm"></a><a id="idm4447248" class="indexterm"></a><div class="para"> If you are sure of the safety of any similar constructs in the script <span class="emphasis"><em>and</em></span> are member of <code class="command">stapdev</code> group (or have root privileges), run the script in "guru" mode by using the option <code class="command">-g</code> (i.e. <code class="command">stap -g <em class="replaceable"><code>script</code></em></code>). </div><div class="formalpara"><h5 class="formalpara" id="idm18710704">semantic error: type mismatch for identifier '<em class="replaceable"><code>foo</code></em>' ... string vs. long</h5><a id="idm18709888" class="indexterm"></a><a id="idm18708896" class="indexterm"></a><a id="idm8556816" class="indexterm"></a><a id="idm8555824" class="indexterm"></a><a id="idm7894408" class="indexterm"></a> The function <code class="command"><em class="replaceable"><code>foo</code></em></code> in the script used the wrong type (i.e. <code class="command">%s</code> or <code class="command">%d</code>). This error will present itself in <a class="xref" href="errors.html#errorvariable">Example 6.1, “error-variable.stp”</a>, because the function <code class="command">execname()</code> returns a string the format specifier should be a <code class="command">%s</code>, not <code class="command">%d</code>. </div><div class="example" id="errorvariable"><h6>Example 6.1. error-variable.stp</h6><div class="example-contents"><pre class="programlisting">probe syscall.open { printf ("%d(%d) open\n", execname(), pid()) }</pre></div></div><br class="example-break" /><div class="formalpara"><h5 class="formalpara" id="idm7889848">semantic error: unresolved type for identifier '<em class="replaceable"><code>foo</code></em>'</h5><a id="idm9494312" class="indexterm"></a><a id="idm9493320" class="indexterm"></a><a id="idm9492352" class="indexterm"></a><a id="idp285000" class="indexterm"></a> 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 <code class="command">printf</code> statement while the script never assigns a value to the variable. </div><div class="formalpara"><h5 class="formalpara" id="idm1868976">semantic error: Expecting symbol or array index expression</h5><a id="idm1868312" class="indexterm"></a><a id="idm1867400" class="indexterm"></a><a id="idp9561584" class="indexterm"></a><a id="idp9562496" class="indexterm"></a> 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: </div><div class="para"> <pre class="programlisting">probe begin { printf("x") = 1 } </pre> </div><div class="formalpara"><h5 class="formalpara" id="idp3403904">while searching for arity <em class="replaceable"><code>N</code></em> function, semantic error: unresolved function call</h5><a id="idp3404656" class="indexterm"></a><a id="idp7576240" class="indexterm"></a><a id="idp7577168" class="indexterm"></a><a id="idm607824" class="indexterm"></a><a id="idm606872" class="indexterm"></a> A function call or array index expression in the script used an invalid number of arguments/parameters. In SystemTap <em class="firstterm">arity</em> can either refer to the number of indices for an array, or the number of parameters to a function. </div><div class="formalpara"><h5 class="formalpara" id="idm7097176">semantic error: array locals not supported, missing global declaration?</h5><a id="idm7096568" class="indexterm"></a><a id="idm7095616" class="indexterm"></a><a id="idp8615376" class="indexterm"></a><a id="idp8616304" class="indexterm"></a><a id="idp8617256" class="indexterm"></a> 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. </div><div class="formalpara"><h5 class="formalpara" id="idp12456144">semantic error: variable ’<em class="replaceable"><code>foo</code></em>’ modified during ’foreach’ iteration</h5><a id="idp12457008" class="indexterm"></a><a id="idm4560528" class="indexterm"></a><a id="idm4559560" class="indexterm"></a><a id="idm452816" class="indexterm"></a> The array <code class="literal">foo</code> is being modifed (being assigned to or deleted from) within an active <code class="command">foreach</code> loop. This error also displays if an operation within the script performs a function call within the <code class="command">foreach</code> loop. </div><div class="formalpara"><h5 class="formalpara" id="idm2042536">semantic error: probe point mismatch at position <em class="replaceable"><code>N</code></em>, while resolving probe point <em class="replaceable"><code>foo</code></em></h5><a id="idm2041584" class="indexterm"></a><a id="idm2040632" class="indexterm"></a><a id="idm20598600" class="indexterm"></a><a id="idm20597688" class="indexterm"></a> SystemTap did not understand what the event or SystemTap function <code class="computeroutput"><em class="replaceable"><code>foo</code></em></code> refers to. This usually means that SystemTap could not find a match for <code class="computeroutput"><em class="replaceable"><code>foo</code></em></code> in the tapset library. The <em class="replaceable"><code>N</code></em> refers to the line and column of the error. </div><div class="formalpara"><h5 class="formalpara" id="idm1202944">semantic error: no match for probe point, while resolving probe point <em class="replaceable"><code>foo</code></em></h5><a id="idp6134656" class="indexterm"></a><a id="idp6135568" class="indexterm"></a><a id="idp6136496" class="indexterm"></a><a id="idm8017888" class="indexterm"></a><a id="idm8016936" class="indexterm"></a> The events/handler function <code class="computeroutput"><em class="replaceable"><code>foo</code></em></code> could not be resolved altogether, for a variety of reasons. This error occurs when the script contains the event <code class="command">kernel.function("<em class="replaceable"><code>blah</code></em>")</code>, and <code class="command"><em class="replaceable"><code>blah</code></em></code> does not exist. In some cases, the error could also mean the script contains an invalid kernel file name or source line number. </div><div class="formalpara"><h5 class="formalpara" id="idm22022224">semantic error: unresolved target-symbol expression</h5><a id="idm22021624" class="indexterm"></a><a id="idp2224328" class="indexterm"></a><a id="idp2225296" class="indexterm"></a><a id="idp3511408" class="indexterm"></a><a id="idp3512400" class="indexterm"></a> 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. </div><div class="formalpara"><h5 class="formalpara" id="idm20477352">semantic error: libdwfl failure </h5><a id="idm20476784" class="indexterm"></a><a id="idm20475832" class="indexterm"></a><a id="idp2979240" class="indexterm"></a><a id="idp2980192" class="indexterm"></a> There was a problem processing the debugging information. In most cases, this error results from the installation of a <code class="filename">kernel-debuginfo</code> RPM whose version does not match the probed kernel exactly. The installed <code class="filename">kernel-debuginfo</code> RPM itself may have some consistency/correctness problems. </div><div class="formalpara"><h5 class="formalpara" id="idp3493288">semantic error: cannot find <em class="replaceable"><code>foo</code></em> debuginfo</h5> SystemTap could not find a suitable <code class="filename">kernel-debuginfo</code> at all. </div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="futexcontentionsect.html"><strong>Prev</strong>5.4. Identifying Contended User-Space Locks</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="runtimeerror.html"><strong>Next</strong>6.2. Run Time Errors and Warnings</a></li></ul></body></html>