| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87  | <?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 xmlns:d="http://docbook.org/ns/docbook">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 xmlns:d="http://docbook.org/ns/docbook" name="generator" content="not publican" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="" /><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. Runtime Errors and Warnings" /></head><body><p id="title"></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="futexcontentionsect.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="runtimeerror.html"><strong>Next</strong></a></li></ul><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="errors"> </a>Chapter 6. Understanding SystemTap Errors</h1></div></div></div><div class="toc"><dl class="toc"><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. Runtime 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"><div class="titlepage"><div><div><h2 class="title"><a id="parsetype"> </a>6.1. Parse and Semantic Errors</h2></div></div></div><a id="id5461" class="indexterm"></a><a id="id5464" class="indexterm"></a><a id="id5467" class="indexterm"></a><div class="para">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. </div><h3><a id="id5471"> </a>parse error: expected <em class="replaceable">foo</em>, saw <em class="replaceable">bar</em></h3><a id="id5474" class="indexterm"></a><a id="id5478" class="indexterm"></a><a id="id5482" class="indexterm"></a><a id="id5486" class="indexterm"></a><a id="id5490" class="indexterm"></a><a id="id5494" class="indexterm"></a><a id="id5498" class="indexterm"></a><a id="id5502" class="indexterm"></a><a id="id5506" class="indexterm"></a><div class="para">The script contains a grammatical or typographical error. SystemTap detected the type of the construct that is incorrect, given the context of the probe. </div><div class="para"> For example, 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"> An attempt to run this SystemTap script fails with the following error message showing that the parser expects 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><h3><a id="id5519"> </a>parse error: embedded code in unprivileged script</h3><a id="id5520" class="indexterm"></a><a id="id5524" class="indexterm"></a><a id="id5528" class="indexterm"></a><a id="id5532" class="indexterm"></a><a id="id5536" class="indexterm"></a><a id="id5540" class="indexterm"></a><div class="para">	The script contains unsafe embedded C code, that is, blocks of code	surrounded by <code class="command">%{</code> and <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 and SystemTap reports this error to warn you if such constructs	appear in the script. </div><a id="id5547" class="indexterm"></a><a id="id5551" class="indexterm"></a><a id="id5555" class="indexterm"></a><a id="id5559" class="indexterm"></a><div class="para"> If you are sure that any similar constructs in the script are safe <span class="emphasis"><em>and</em></span> you are a member of the <code class="systemitem">stapdev</code> group (or have root privileges), run the script in "guru" mode by using the <code class="option">-g</code> option: </div><pre class="screen"><code class="command">stap -g <em class="replaceable">script</em></code></pre><h3><a id="id5570"> </a>semantic error: type mismatch for identifier '<em class="replaceable">foo</em>' ... string vs. long</h3><a id="id5572" class="indexterm"></a><a id="id5576" class="indexterm"></a><a id="id5580" class="indexterm"></a><a id="id5584" class="indexterm"></a><a id="id5588" class="indexterm"></a><div class="para">	The function <em class="replaceable">foo</em> in the	script used the wrong type	(such as <code class="literal">%s</code> or <code class="literal">%d</code>).	In the following example, the format specifier should be <code class="literal">%s</code> and not <code class="literal">%d</code>, because the <code class="function">execname()</code> function returns a string: </div><pre class="programlisting">probe syscall.open { printf ("%d(%d) open\n", execname(), pid()) }</pre><h3><a id="id5600"> </a>semantic error: unresolved type for identifier '<em class="replaceable">foo</em>'</h3><a id="id5602" class="indexterm"></a><a id="id5606" class="indexterm"></a><a id="id5610" class="indexterm"></a><a id="id5614" class="indexterm"></a><div class="para">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 <code class="command">printf</code> statement while	the script never assigns a value to the variable.</div><h3><a id="id5620"> </a>semantic error: Expecting symbol or array index expression</h3><a id="id5621" class="indexterm"></a><a id="id5625" class="indexterm"></a><a id="id5629" class="indexterm"></a><a id="id5633" class="indexterm"></a><div class="para">	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><pre class="programlisting">probe begin { printf("x") = 1 } </pre><h3><a id="id5639"> </a>while searching for arity <em class="replaceable">N</em> function, semantic error: unresolved function call</h3><a id="id5641" class="indexterm"></a><a id="id5645" class="indexterm"></a><a id="id5649" class="indexterm"></a><a id="id5653" class="indexterm"></a><a id="id5657" class="indexterm"></a><div class="para">A function call or array index expression in the script used an invalid	number of arguments or 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><h3><a id="id5663"> </a>semantic error: array locals not supported, missing global declaration?</h3><a id="id5664" class="indexterm"></a><a id="id5668" class="indexterm"></a><a id="id5672" class="indexterm"></a><a id="id5676" class="indexterm"></a><a id="id5680" class="indexterm"></a><div class="para">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><h3><a id="id5685"> </a>semantic error: variable '<em class="replaceable">foo</em>' modified during 'foreach' iteration</h3><a id="id5687" class="indexterm"></a><a id="id5691" class="indexterm"></a><a id="id5695" class="indexterm"></a><a id="id5699" class="indexterm"></a><div class="para">The array <em class="replaceable">foo</em> is being modified (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><h3><a id="id5707"> </a>semantic error: probe point mismatch at position <em class="replaceable">N</em>, while resolving probe point <em class="replaceable">foo</em></h3><a id="id5710" class="indexterm"></a><a id="id5714" class="indexterm"></a><a id="id5718" class="indexterm"></a><a id="id5722" class="indexterm"></a><div class="para">SystemTap did not understand what the event or SystemTap function <em class="replaceable">foo</em> refers	to. This usually means that SystemTap could not find a match for <em class="replaceable">foo</em> in the tapset library. <em class="replaceable">N</em> refers to the	line and column of	the error.</div><h3><a id="id5731"> </a>semantic error: no match for probe point, while resolving probe point <em class="replaceable">foo</em></h3><a id="id5733" class="indexterm"></a><a id="id5737" class="indexterm"></a><a id="id5741" class="indexterm"></a><a id="id5745" class="indexterm"></a><a id="id5749" class="indexterm"></a><div class="para">SystemTap could not resolve the events or handler function <em class="replaceable">foo</em> for a variety of reasons. This error occurs when the script contains the event <code class="command">kernel.function("<em class="replaceable">something</em>")</code>, and <em class="replaceable">something</em> does not exist. In some cases, the error could also mean the script contains an invalid kernel file name or source line number.</div><h3><a id="id5758"> </a>semantic error: unresolved target-symbol expression</h3><a id="id5759" class="indexterm"></a><a id="id5763" class="indexterm"></a><a id="id5767" class="indexterm"></a><a id="id5771" class="indexterm"></a><a id="id5775" class="indexterm"></a><div class="para">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><h3><a id="id5780"> </a>semantic error: libdwfl failure </h3><a id="id5781" class="indexterm"></a><a id="id5785" class="indexterm"></a><a id="id5789" class="indexterm"></a><a id="id5793" class="indexterm"></a><div class="para">There was a problem processing the debugging information. In most	cases, this error results from the installation of a <span class="package">kernel-debuginfo</span> package whose version does not match	the probed kernel exactly. The installed <span class="package">kernel-debuginfo</span> package itself may have some consistency or correctness problems.</div><h3><a id="id5800"> </a>semantic error: cannot find <em class="replaceable">foo</em> debuginfo</h3><div class="para">SystemTap could not find a suitable <span class="package">kernel-debuginfo</span> package.</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. Runtime Errors and Warnings</a></li></ul></body></html> 
 |