summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Baron <elliott@localhost.localdomain>2008-12-19 10:13:52 -0500
committerElliott Baron <elliott@localhost.localdomain>2008-12-19 10:13:52 -0500
commita46143af464b24e75e784a3ebaebf86bc52a44ed (patch)
tree8ab09ae8ff39e673fed163ad6ef225c3e0ae754a
parent30c94a80d5f7bef33450bd1a7e090c8e99b6db89 (diff)
parentb00e123d3bc577a0b255628e36f7534dc7a1e641 (diff)
downloadsystemtap-steved-a46143af464b24e75e784a3ebaebf86bc52a44ed.tar.gz
systemtap-steved-a46143af464b24e75e784a3ebaebf86bc52a44ed.tar.xz
systemtap-steved-a46143af464b24e75e784a3ebaebf86bc52a44ed.zip
Merge branch 'master' of ssh://ebaron@sources.redhat.com/git/systemtap
-rw-r--r--ChangeLog14
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml8
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Arrays.xml2
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Errors.xml12
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml3
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Scripts.xml238
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml2
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-inodewatch.xml11
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-sockettrace.xml2
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml2
-rw-r--r--runtime/ChangeLog4
-rw-r--r--runtime/sduprobes.h119
-rw-r--r--systemtap.spec8
-rw-r--r--tapsets.cxx46
-rw-r--r--testsuite/ChangeLog4
-rw-r--r--testsuite/systemtap.base/static_uprobes.exp74
-rw-r--r--testsuite/systemtap.base/static_uprobes.stp14
17 files changed, 310 insertions, 253 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a852834..ab8f482d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-12-16 Roland McGrath <roland@redhat.com>
+
+ * systemtap.spec (Requires): Add kernel-devel, is correct virtual
+ provide in kernel-*-devel rpms.
+ (with_sqlite): Typo fix in default defn check.
+ [%{with_sqlite}] (Requires): Remove. BuildRequires causes the correct
+ automatic dependency.
+
+2008-12-16 Stan Cox <scox@redhat.com>
+
+ * tapsets.cxx (dwarf_builder::build): Consider alignment when
+ fetching .probes values. Convert .mark to .statement(0x) instead
+ of .statement(foo.c:N)
+
2008-12-11 Dave Brolley <brolley@redhat.com>
PR7087
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml b/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml
index bf496321..00a8673c 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml
@@ -505,7 +505,7 @@ probe timer.s(3)
}
</screen>
-<para>This <command>foreach</command> statement instructs the script to process the elements in the array <command>reads</command> in descending order (of associated value). The <command>limit 10</command> option instructs the script to only process the first ten elements in the array (i.e. the first 10, starting with the highest value).</para>
+<para>This <command>foreach</command> statement instructs the script to process the elements in the array <command>reads</command> in descending order (of associated value). The <command>limit 10</command> option instructs the <command>foreach</command> to only process the first ten iterations (i.e. print the first 10, starting with the highest value).</para>
</section>
<section id="arrayops-deleting">
@@ -665,7 +665,7 @@ probe vfs.read
probe timer.s(3)
{
printf("=======\n")
- foreach (count in reads+)
+ foreach (count in reads-)
printf("%s : %d \n", count, reads[count])
delete reads
}
@@ -673,7 +673,7 @@ probe timer.s(3)
probe end
{
printf("TOTALS\n")
- foreach (total in totalreads+)
+ foreach (total in totalreads-)
printf("%s : %d \n", total, totalreads[total])
}
</screen>
@@ -788,7 +788,7 @@ probe timer.s(3)
</formalpara>
<screen>
-if([<replaceable>index_expression</replaceable>] in <replaceable>array_name</replaceable>)
+if([<replaceable>index_expression</replaceable>] in <replaceable>array_name</replaceable>) <replaceable>statement</replaceable>
</screen>
<para>To illustrate this, consider the following example:</para>
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml b/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml
index ac320fcd..3d3dec01 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml
@@ -161,7 +161,7 @@ foo["harry"] = 25
</screen>
</example>
-<para>You can specify up to 5 index expressons in an array statement, each one delimited by a comma (<command>,</command>). This is useful if you wish to have a key that contains multiple pieces of information. The following line from <xref linkend="scriptdisktop"/> uses 5 elements for the key: process ID, executable name, user ID, parent ID, and string "W". It associates the value of <command>devname</command> with that key.</para>
+<para>You can specify up to 5 index expressons in an array statement, each one delimited by a comma (<command>,</command>). This is useful if you wish to have a key that contains multiple pieces of information. The following line from <xref linkend="scriptdisktop"/> uses 5 elements for the key: process ID, executable name, user ID, parent process ID, and string "W". It associates the value of <command>devname</command> with that key.</para>
<screen>
device[pid(),execname(),uid(),ppid(),"W"] = devname
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Errors.xml b/doc/SystemTap_Beginners_Guide/en-US/Errors.xml
index ffb70470..62e89580 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Errors.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Errors.xml
@@ -101,7 +101,7 @@
replicate?</remark>
<para>
- The following invalid SystemTap script is missing the its probe
+ The following invalid SystemTap script is missing its probe
handlers:
</para>
@@ -473,8 +473,9 @@ probe syscall.open
<computeroutput><replaceable>foo</replaceable></computeroutput> refers
to. This usually means that SystemTap could not find a match for
<computeroutput><replaceable>foo</replaceable></computeroutput> in the
- tapset library. The <replaceable>N</replaceable> refers to the column
- the error occurred in.</para>
+ tapset library. The <replaceable>N</replaceable> refers to the
+ line and column of
+ the error.</para>
</formalpara>
<remark>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) </remark>
@@ -807,6 +808,7 @@ An array containing aggregate values contains too many distinct key pairs at thi
<para>
Too many levels of function call nesting were attempted.
+ The default nesting of function calls allowed is 10.
</para>
</formalpara>
@@ -843,7 +845,9 @@ An array containing aggregate values contains too many distinct key pairs at thi
<tertiary>understainding SystemTap errors</tertiary>
</indexterm>
<para>
- The probe handler attempted to execute too many statements in the probe handler.
+ The probe handler attempted to execute too many statements in the
+ probe handler. The default number of actions allow in a probe handler
+ is 1000.
</para>
</formalpara>
diff --git a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
index 2550efce..89334eff 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
@@ -177,7 +177,8 @@ The <command><replaceable>statement1</replaceable></command> is executed if the
<command><replaceable>condition</replaceable></command> expression is
non-zero. The <command><replaceable>statement2</replaceable></command> is
executed if the <command><replaceable>condition</replaceable></command>
-expression is zero. The <command>else</command> is optional. Both
+expression is zero. The <command>else</command> clause
+(<command>else</command> <replaceable>statement2</replaceable>)is optional. Both
<command><replaceable>statement1</replaceable></command> and
<command><replaceable>statement2</replaceable></command> can be statement
blocks.
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
index fe2e69f4..88aa42ab 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
@@ -129,7 +129,7 @@
</indexterm>
<para>
SystemTap scripts use the file extension <filename>.stp</filename>, and
- are conatains probes written in the following format:
+ contains probes written in the following format:
</para>
</formalpara>
<screen>
@@ -555,21 +555,21 @@ probe timer.s(4)
</indexterm>
<para> Consider the following sample script: </para>
- <example id="helloworld"><title>helloworld.stp</title>
- <programlisting>
- probe begin
- {
- printf ("hello world\n")
- exit ()
- }
- </programlisting>
- </example>
+<example id="helloworld"><title>helloworld.stp</title>
+<programlisting>
+probe begin
+{
+ printf ("hello world\n")
+ exit ()
+}
+</programlisting>
+</example>
<para>
In <xref linkend="helloworld"/>, the event <command>begin</command>
(i.e. the start of the session) triggers the handler enclosed in
<command>{ }</command>, which simply prints <command>hello
- world</command>, then exits.
+ world</command> followed by a new-line, then exits.
</para>
<note>
@@ -581,7 +581,7 @@ probe timer.s(4)
<indexterm>
<primary><command>exit()</command></primary>
- <secondary>Handlers</secondary>
+ <secondary>functions</secondary>
</indexterm>
<para>
SystemTap scripts continue to run until the
@@ -666,15 +666,15 @@ probe timer.s(4)
<para> To illustrate this, consider the following probe example: </para>
- <example id="syscall-open">
- <title>variables-in-printf-statements.stp</title>
- <programlisting>
- probe syscall.open
- {
- printf ("%s(%d) open\n", execname(), pid())
- }
- </programlisting>
- </example>
+<example id="syscall-open">
+<title>variables-in-printf-statements.stp</title>
+<programlisting>
+probe syscall.open
+{
+ printf ("%s(%d) open\n", execname(), pid())
+}
+</programlisting>
+</example>
<para>
<xref linkend="syscall-open"/> instructs SystemTap to probe all entries to
@@ -688,16 +688,16 @@ probe timer.s(4)
to "argument1", "format specifier2" is to "argument2", or is this clear
enough? </remark>
- <screen>
- vmware-guestd(2206) open
- hald(2360) open
- hald(2360) open
- hald(2360) open
- df(3433) open
- df(3433) open
- df(3433) open
- hald(2360) open
- </screen>
+<screen>
+vmware-guestd(2206) open
+hald(2360) open
+hald(2360) open
+hald(2360) open
+df(3433) open
+df(3433) open
+df(3433) open
+hald(2360) open
+</screen>
<formalpara id="systemtapscript-functions">
<title>SystemTap Functions</title>
@@ -732,20 +732,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>tid()</command></tertiary>
+ <secondary><command>tid()</command></secondary>
+<!-- <tertiary><command>tid()</command></tertiary> -->
</indexterm>
<indexterm>
- <primary>handler functions</primary>
- <secondary>Handlers</secondary>
- <tertiary><command>tid()</command></tertiary>
+ <primary>functions</primary>
+ <secondary><command>tid()</command></secondary>
+<!-- <tertiary></tertiary> -->
</indexterm>
<indexterm>
<primary><command>tid()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler </tertiary> -->
</indexterm>
<para>The ID of the current thread.</para>
@@ -757,20 +757,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>uid()</command></tertiary>
+ <!--<secondary>handler functions</secondary>-->
+ <secondary><command>uid()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>uid()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>uid()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>The ID of the current user.</para>
</listitem>
@@ -781,20 +781,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>cpu()</command></tertiary>
+ <!--<secondary>handler functions</secondary>-->
+ <secondary><command>cpu()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>cpu()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>cpu()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>The current CPU number.</para>
</listitem>
@@ -805,20 +805,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>gettimeofday_s()</command></tertiary>
+ <!--<secondary>handler functions</secondary>-->
+ <secondary><command>gettimeofday_s()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>gettimeofday_s()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>gettimeofday_s()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>The number of seconds since UNIX epoch (January 1, 1970).</para>
@@ -830,20 +830,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>ctime()</command></tertiary>
+ <!--<secondary>handler functions</secondary>-->
+ <secondary><command>ctime()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>ctime()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>ctime()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>
Convert number of seconds since UNIX epoch to date.
@@ -865,20 +865,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>pp()</command></tertiary>
+ <!--<secondary>handler functions</secondary>-->
+ <secondary><command>pp()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>pp()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>pp()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>A string describing the probe point currently being handled.</para>
</listitem>
@@ -897,20 +897,20 @@ probe timer.s(4)
<listitem>
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>thread_indent()</command></tertiary>
+ <!--<secondary>handler functions</secondary>-->
+ <secondary><command>thread_indent()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>thread_indent()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>thread_indent()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>
This particular function is quite useful, providing you with a way
@@ -945,42 +945,42 @@ probe timer.s(4)
<command>thread_indent()</command>:
</para>
- <example id="thread_indent"><title>thread_indent.stp</title>
- <programlisting>
- probe kernel.function("*@net/socket.c")
- {
- printf ("%s -> %s\n", thread_indent(1), probefunc())
- }
- probe kernel.function("*@net/socket.c").return
- {
- printf ("%s &lt;- %s\n", thread_indent(-1), probefunc())
- }
- </programlisting>
- </example>
+<example id="thread_indent"><title>thread_indent.stp</title>
+<programlisting>
+probe kernel.function("*@net/socket.c")
+{
+ printf ("%s -> %s\n", thread_indent(1), probefunc())
+}
+probe kernel.function("*@net/socket.c").return
+{
+ printf ("%s &lt;- %s\n", thread_indent(-1), probefunc())
+}
+</programlisting>
+</example>
<para>
<xref linkend="thread_indent"/> prints out the
<command>thread_indent()</command> and probe functions at each event
in the following format:</para>
- <screen>
- 0 ftp(7223): -&gt; sys_socketcall
- 1159 ftp(7223): -&gt; sys_socket
- 2173 ftp(7223): -&gt; __sock_create
- 2286 ftp(7223): -&gt; sock_alloc_inode
- 2737 ftp(7223): &lt;- sock_alloc_inode
- 3349 ftp(7223): -&gt; sock_alloc
- 3389 ftp(7223): &lt;- sock_alloc
- 3417 ftp(7223): &lt;- __sock_create
- 4117 ftp(7223): -&gt; sock_create
- 4160 ftp(7223): &lt;- sock_create
- 4301 ftp(7223): -&gt; sock_map_fd
- 4644 ftp(7223): -&gt; sock_map_file
- 4699 ftp(7223): &lt;- sock_map_file
- 4715 ftp(7223): &lt;- sock_map_fd
- 4732 ftp(7223): &lt;- sys_socket
- 4775 ftp(7223): &lt;- sys_socketcall
- </screen>
+<screen>
+0 ftp(7223): -&gt; sys_socketcall
+1159 ftp(7223): -&gt; sys_socket
+2173 ftp(7223): -&gt; __sock_create
+2286 ftp(7223): -&gt; sock_alloc_inode
+2737 ftp(7223): &lt;- sock_alloc_inode
+3349 ftp(7223): -&gt; sock_alloc
+3389 ftp(7223): &lt;- sock_alloc
+3417 ftp(7223): &lt;- __sock_create
+4117 ftp(7223): -&gt; sock_create
+4160 ftp(7223): &lt;- sock_create
+4301 ftp(7223): -&gt; sock_map_fd
+4644 ftp(7223): -&gt; sock_map_file
+4699 ftp(7223): &lt;- sock_map_file
+4715 ftp(7223): &lt;- sock_map_fd
+4732 ftp(7223): &lt;- sys_socket
+4775 ftp(7223): &lt;- sys_socketcall
+</screen>
<para>This sample output contains the following information:</para>
@@ -1047,20 +1047,20 @@ probe timer.s(4)
<indexterm>
<primary>functions</primary>
- <secondary>handler functions</secondary>
- <tertiary><command>target()</command></tertiary>
+<!-- <secondary>handler functions</secondary> -->
+ <secondary><command>target()</command></secondary>
</indexterm>
-
+<!--
<indexterm>
<primary>handler functions</primary>
<secondary>Handlers</secondary>
<tertiary><command>target()</command></tertiary>
</indexterm>
-
+ -->
<indexterm>
<primary><command>target()</command></primary>
- <secondary>Handlers</secondary>
- <tertiary>handler functions</tertiary>
+ <secondary>functions</secondary>
+<!-- <tertiary>handler functions</tertiary> -->
</indexterm>
<para>
Used in conjunction with <command>stap
@@ -1073,15 +1073,15 @@ probe timer.s(4)
to it. For example:
</para>
- <example id="targetexample">
- <title>targetexample.stp</title>
- <programlisting>
- probe syscall.* {
- if (pid() == target())
- printf("%s/n", name)
- }
- </programlisting>
- </example>
+<example id="targetexample">
+<title>targetexample.stp</title>
+<programlisting>
+probe syscall.* {
+ if (pid() == target())
+ printf("%s/n", name)
+}
+</programlisting>
+</example>
<para>
When <xref linkend="targetexample"/> is run with the argument
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml b/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml
index 4e61e247..d9fe6ab4 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml
@@ -53,7 +53,7 @@
expiration, session termination, etc. A handler is a series of script
language statements that specify the work to be done whenever the event
occurs. This work normally includes extracting data from the event context,
- storing them into internal variables, or printing results.
+ storing them into internal variables, and printing results.
</para>
<section id="understanding-architecture-tools">
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-inodewatch.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-inodewatch.xml
index 098524ae..47cc4e16 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-inodewatch.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-inodewatch.xml
@@ -59,7 +59,8 @@ no script in examples
<remark>need to add references to sources/man pages that explain how "dev_nr = $file->f_dentry->d_inode->i_sb->s_dev" and "($1 &lt;&lt; 20 | $2)".</remark>
-<para><xref linkend="inodewatch"/> takes the following information about the file as an argument:</para>
+<para><xref linkend="inodewatch"/> takes the following information about the
+file as arguments on the command line:</para>
<indexterm>
<primary>script examples</primary>
<secondary>file device number (integer format)</secondary>
@@ -81,7 +82,9 @@ no script in examples
</indexterm>
<itemizedlist>
- <listitem><para>The file's device number, in integer format. When this is passed to the script as the first argument, be sure to replace any <computeroutput>0</computeroutput> with a space.</para></listitem>
+ <listitem><para>The file's major device number.</para></listitem>
+
+ <listitem><para>The file's minor device number.</para></listitem>
<listitem><para>The file's <command>inode</command> number.</para></listitem>
</itemizedlist>
@@ -121,9 +124,9 @@ no script in examples
<secondary>examples of SystemTap scripts</secondary>
</indexterm>
-<para><computeroutput>805</computeroutput> is the device number, while <computeroutput>1078319</computeroutput> is the <command>inode</command> number. To start monitoring <filename>/etc/crontab</filename>, run <command>stap inodewatch.stp 8 5 1078319</command>.</para>
+<para><computeroutput>805</computeroutput> is the base-16 (hexadecimal) device number. The lower two digits are the minor device number and the upper digits are the major number. <computeroutput>1078319</computeroutput> is the <command>inode</command> number. To start monitoring <filename>/etc/crontab</filename>, run <command>stap inodewatch.stp 0x8 0x05 1078319</command> (The <command>0x</command> prefixes indicate base-16 values.</para>
-<para>The output of this command contains the name and ID of any process performing a read/write, the function it is performing (i.e. <command>vfs_read</command> or <command>vfs_write</command>), the device number (in hex format), and the <command>inode</command> number. <xref linkend="inodewatchoutput"/> contains the output of <command>stap inodewatch.stp 8 5 1078319</command> (when <command>cat /etc/crontab</command> is executed while the script is running) :</para>
+<para>The output of this command contains the name and ID of any process performing a read/write, the function it is performing (i.e. <command>vfs_read</command> or <command>vfs_write</command>), the device number (in hex format), and the <command>inode</command> number. <xref linkend="inodewatchoutput"/> contains the output of <command>stap inodewatch.stp 0x8 0x05 1078319</command> (when <command>cat /etc/crontab</command> is executed while the script is running) :</para>
<example id="inodewatchoutput">
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-sockettrace.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-sockettrace.xml
index 9a9e1c55..6e913b48 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-sockettrace.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-sockettrace.xml
@@ -51,7 +51,7 @@
<title>socket-trace.stp</title>
<para>
<programlisting>
- <xi:include parse="text" href="extras/testsuite/systemtap.examples/network/socket-trace.stp" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include parse="text" href="extras/testsuite/systemtap.examples/network/socket-trace.stp" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</para>
</formalpara>
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml
index 4fc7ecc2..7451de98 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml
@@ -50,7 +50,7 @@
</para>
<formalpara id="traceio2">
- <title>traceio2-simple.stp</title>
+ <title>traceio2.stp</title>
<para>
<programlisting>
<xi:include parse="text" href="extras/testsuite/systemtap.examples/io/traceio2.stp" xmlns:xi="http://www.w3.org/2001/XInclude" />
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 3f88bae2..7026b276 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-16 Stan Cox <scox@redhat.com>
+
+ * sduprobes.h (STAP_PROBE): Add synthetic reference to probe label.
+
2008-12-09 Frank Ch. Eigler <fche@elastic.org>
* time.c (_stp_gettimeofday_ns): Protect some more against freq=0.
diff --git a/runtime/sduprobes.h b/runtime/sduprobes.h
index b91dea93..efa25be7 100644
--- a/runtime/sduprobes.h
+++ b/runtime/sduprobes.h
@@ -9,23 +9,23 @@
#include <string.h>
#if _LP64
-#define STAP_PROBE_STRUCT_ARG \
- __uint64_t probe_arg;
+#define STAP_PROBE_STRUCT_ARG(arg) \
+ __uint64_t arg;
#else
-#define STAP_PROBE_STRUCT_ARG \
- long probe_arg __attribute__ ((aligned(8)));
+#define STAP_PROBE_STRUCT_ARG(arg) \
+ long arg __attribute__ ((aligned(8)));
#endif
#define STAP_PROBE_STRUCT(probe,type,argc) \
struct _probe_ ## probe \
{ \
char probe_name [strlen(#probe)+1]; \
- int probe_type; \
- STAP_PROBE_STRUCT_ARG \
+ int probe_type; \
+ STAP_PROBE_STRUCT_ARG (probe_arg); \
}; \
static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {#probe,type,argc};
-#ifndef USE_STAP_DEBUGINFO_PROBE
+#ifdef USE_STAP_PROBE
#define STAP_PROBE(provider,probe) \
STAP_PROBE_STRUCT(probe,0,0) \
_stap_probe_0 (_probe_ ## probe.probe_name);
@@ -34,108 +34,99 @@ struct _probe_ ## probe \
_probe_ ## probe: \
asm volatile ("nop"); \
STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
- asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
+ goto _probe_ ## probe;
#endif
-#ifndef USE_STAP_DEBUGINFO_PROBE
+#ifdef USE_STAP_PROBE
#define STAP_PROBE1(provider,probe,arg1) \
STAP_PROBE_STRUCT(probe,0,1) \
_stap_probe_1 (_probe_ ## probe.probe_name,(size_t)arg1);
#else
#define STAP_PROBE1(provider,probe,parm1) \
+ volatile typeof(parm1) probe ## _arg1 = parm1; \
_probe_ ## probe: \
- asm volatile ("nop"); \
- volatile typeof(parm1) arg1 = parm1; \
+ asm volatile ("nop" :: "r"(probe ## _arg1)); \
STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
- asm volatile ("# %0" :: "r"(arg1)); \
- asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
+ goto _probe_ ## probe;
#endif
-#ifndef USE_STAP_DEBUGINFO_PROBE
+#ifdef USE_STAP_PROBE
#define STAP_PROBE2(provider,probe,arg1,arg2) \
STAP_PROBE_STRUCT(probe,0,2) \
_stap_probe_2 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2);
#else
#define STAP_PROBE2(provider,probe,parm1,parm2) \
+ volatile typeof(parm1) probe ## _arg1 = parm1; \
+ volatile typeof(parm2) probe ## _arg2 = parm2; \
_probe_ ## probe: \
- asm volatile ("nop"); \
- volatile typeof(parm1) arg1 = parm1; \
- volatile typeof(parm2) arg2 = parm2; \
+ asm volatile ("nop" :: "r"(probe ## _arg1), "r"(probe ## _arg2)); \
STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe)\
- asm volatile ("# %0" :: "r"(arg1)); \
- asm volatile ("# %0" :: "r"(arg2)); \
- asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
+ goto _probe_ ## probe;
#endif
-#ifndef USE_STAP_DEBUGINFO_PROBE
+#ifdef USE_STAP_PROBE
#define STAP_PROBE3(provider,probe,arg1,arg2,arg3) \
STAP_PROBE_STRUCT(probe,0,3) \
_stap_probe_3 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3);
#else
#define STAP_PROBE3(provider,probe,parm1,parm2,parm3) \
+ volatile typeof(parm1) probe ## _arg1 = parm1; \
+ volatile typeof(parm2) probe ## _arg2 = parm2; \
+ volatile typeof(parm3) probe ## _arg3 = parm3; \
_probe_ ## probe: \
- asm volatile ("nop"); \
- volatile typeof(parm1) arg1 = parm1; \
- volatile typeof(parm2) arg2 = parm2; \
- volatile typeof(parm3) arg3 = parm3; \
+ asm volatile ("nop" :: "r"(probe ## _arg1), "r"(probe ## _arg2), "r"(probe ## _arg3)); \
STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
- asm volatile ("# %0" :: "r"(arg1)); \
- asm volatile ("# %0" :: "r"(arg2)); \
- asm volatile ("# %0" :: "r"(arg3)); \
- asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
+ goto _probe_ ## probe;
#endif
-#ifndef USE_STAP_DEBUGINFO_PROBE
+#ifdef USE_STAP_PROBE
#define STAP_PROBE4(provider,probe,arg1,arg2,arg3,arg4) \
STAP_PROBE_STRUCT(probe,0,4) \
_stap_probe_4 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4);
#else
-#define STAP_PROBE4(provider,probe,parm1,parm2,parm3) \
+#define STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \
+ volatile typeof(parm1) probe ## _arg1 = parm1; \
+ volatile typeof(parm2) probe ## _arg2 = parm2; \
+ volatile typeof(parm3) probe ## _arg3 = parm3; \
+ volatile typeof(parm4) probe ## _arg4 = parm4; \
_probe_ ## probe: \
- asm volatile ("nop"); \
- volatile typeof(parm1) arg1 = parm1; \
- volatile typeof(parm2) arg2 = parm2; \
- volatile typeof(parm3) arg3 = parm3; \
- volatile typeof(parm4) arg4 = parm4; \
+ asm volatile ("nop" "r"(probe ## _arg1), "r"(probe ## _arg2), "r"(probe ## _arg3), "r"(probe ## _arg4)); \
STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
- asm volatile ("# %0" :: "r"(arg1)); \
- asm volatile ("# %0" :: "r"(arg2)); \
- asm volatile ("# %0" :: "r"(arg3)); \
- asm volatile ("# %0" :: "r"(arg4)); \
- asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
+ goto _probe_ ## probe;
#endif
-#ifndef USE_STAP_DEBUGINFO_PROBE
+#ifdef USE_STAP_PROBE
#define STAP_PROBE5(provider,probe,arg1,arg2,arg3,arg4,arg5) \
STAP_PROBE_STRUCT(probe,0,5) \
_stap_probe_5 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4,(size_t)arg5);
#else
#define STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \
+ volatile typeof(parm1) probe ## _arg1 = parm1; \
+ volatile typeof(parm2) probe ## _arg2 = parm2; \
+ volatile typeof(parm3) probe ## _arg3 = parm3; \
+ volatile typeof(parm4) probe ## _arg4 = parm4; \
+ volatile typeof(parm5) probe ## _arg5 = parm5; \
_probe_ ## probe: \
- asm volatile ("nop"); \
- volatile typeof(parm1) arg1 = parm1; \
- volatile typeof(parm2) arg2 = parm2; \
- volatile typeof(parm3) arg3 = parm3; \
- volatile typeof(parm4) arg4 = parm4; \
- volatile typeof(parm5) arg5 = parm5; \
+ asm volatile ("nop" "r"(probe ## _arg1), "r"(probe ## _arg2), "r"(probe ## _arg3), "r"(probe ## _arg4), "r"(probe ## _arg5)); \
STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
- asm volatile ("# %0" :: "r"(arg1)); \
- asm volatile ("# %0" :: "r"(arg2)); \
- asm volatile ("# %0" :: "r"(arg3)); \
- asm volatile ("# %0" :: "r"(arg4)); \
- asm volatile ("# %0" :: "r"(arg5)); \
- asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
+ goto _probe_ ## probe;
#endif
-#define DTRACE_PROBE1(provider,probe,parm1,parm2,parm3,parm4,parm5) \
-STAP_PROBE1(provider,probe,parm1,parm2,parm3,parm4,parm5)
-#define DTRACE_PROBE2(provider,probe,parm1,parm2,parm3,parm4,parm5) \
-STAP_PROBE2(provider,probe,parm1,parm2,parm3,parm4,parm5)
-#define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3,parm4,parm5) \
-STAP_PROBE3(provider,probe,parm1,parm2,parm3,parm4,parm5)
-#define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4,parm5) \
-STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4,parm5)
-#define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \
-STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5)
+#define DTRACE_PROBE(provider,probe) \
+STAP_PROBE(provider,probe)
+#define DTRACE_PROBE1(provider,probe,parm1) \
+STAP_PROBE1(provider,probe,parm1)
+#define DTRACE_PROBE2(provider,probe,parm1,parm2) \
+STAP_PROBE2(provider,probe,parm1,parm2)
+#define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \
+STAP_PROBE3(provider,probe,parm1,parm2,parm3)
+#define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \
+STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4)
diff --git a/systemtap.spec b/systemtap.spec
index c8c6b030..479e2b4c 100644
--- a/systemtap.spec
+++ b/systemtap.spec
@@ -1,5 +1,5 @@
%{!?release: %define release 1}
-%{!?with_sqllite: %define with_sqlite 1}
+%{!?with_sqlite: %define with_sqlite 1}
%{!?with_docs: %define with_docs 1}
%{!?with_crash: %define with_crash 0}
%{!?with_bundled_elfutils: %define with_bundled_elfutils 0}
@@ -20,13 +20,13 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: kernel >= 2.6.9-11
%if %{with_sqlite}
BuildRequires: sqlite-devel
-Requires: sqlite
%endif
%if %{with_crash}
BuildRequires: crash-devel zlib-devel
%endif
-# Requires: kernel-devel
-# or is that kernel-smp-devel? kernel-hugemem-devel?
+# Alternate kernel packages kernel-PAE-devel et al have a virtual
+# provide for kernel-devel, so this requirement does the right thing.
+Requires: kernel-devel
Requires: gcc make
# Suggest: kernel-debuginfo
Requires: systemtap-runtime = %{version}-%{release}
diff --git a/tapsets.cxx b/tapsets.cxx
index 4d9a021d..0efaf455 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3856,7 +3856,8 @@ query_cu (Dwarf_Die * cudie, void * arg)
// Verify that a raw address matches the beginning of a
// statement. This is a somewhat lame check that the address
// is at the start of an assembly instruction.
- if (q->has_statement_num)
+ // Avoid for now since this thwarts a probe on a statement in a macro
+ if (0 && q->has_statement_num)
{
Dwarf_Addr queryaddr = q->statement_num_val;
dwarf_line_t address_line(dwarf_getsrc_die(cudie, queryaddr));
@@ -5297,14 +5298,14 @@ dwarf_builder::build(systemtap_session & sess,
location->components[0]->arg = new literal_string(sess.cmd);
((literal_map_t&)parameters)[location->components[0]->functor] = location->components[0]->arg;
Dwarf_Addr bias;
- Elf* elf = (dwarf_getelf (dwfl_module_getdwarf (dw->module, &bias))
- ?: dwfl_module_getelf (dw->module, &bias));
+ Elf* elf = dwfl_module_getelf (dw->module, &bias);
size_t shstrndx;
Elf_Scn *probe_scn = NULL;
dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
__uint64_t probe_arg = 0;
int probe_type = no_debuginfo;
+ char *probe_name;
// Find the .probes section where the static probe label and arg are stored
while ((probe_scn = elf_nextscn (elf, probe_scn)))
{
@@ -5314,23 +5315,24 @@ dwarf_builder::build(systemtap_session & sess,
if (strcmp (elf_strptr (elf, shstrndx, shdr->sh_name), ".probes") != 0)
continue;
- Elf_Data *pdata = elf_getdata (probe_scn, NULL);
+ Elf_Data *pdata = elf_getdata_rawchunk (elf, shdr->sh_offset, shdr->sh_size, ELF_T_BYTE);
assert (pdata != NULL);
size_t probe_scn_offset = 0;
while (probe_scn_offset < pdata->d_size)
{
- char *probe_name = (char*)pdata->d_buf + probe_scn_offset;
- probe_scn_offset += strlen(probe_name);
- probe_scn_offset += sizeof(int) - (probe_scn_offset % sizeof(int));
- probe_type = *(((char*)pdata->d_buf + probe_scn_offset));
+ probe_name = (char*)pdata->d_buf + probe_scn_offset;
+ probe_scn_offset += strlen(probe_name) + 1;
+ if (probe_scn_offset % (sizeof(int)))
+ probe_scn_offset += sizeof(int) - (probe_scn_offset % sizeof(int));
+ probe_type = *((int*)((char*)pdata->d_buf + probe_scn_offset));
probe_scn_offset += sizeof(int);
- probe_arg = *((__uint32_t*)((char*)pdata->d_buf + probe_scn_offset));
- probe_arg <<= 32;
- probe_arg |= *((__uint32_t*)((char*)pdata->d_buf + probe_scn_offset + 4));
+ if (probe_scn_offset % (sizeof(__uint64_t)))
+ probe_scn_offset += sizeof(__uint64_t) - (probe_scn_offset % sizeof(__uint64_t));
+ probe_arg = *((__uint64_t*)((char*)pdata->d_buf + probe_scn_offset));
if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name) == 0)
break;
- probe_scn_offset += sizeof(__uint64_t);
- probe_scn_offset += sizeof(__uint64_t)*2 - (probe_scn_offset % (sizeof(__uint64_t)*2));
+ if (probe_scn_offset % (sizeof(__uint64_t)*2))
+ probe_scn_offset = (probe_scn_offset + sizeof(__uint64_t)*2) - (probe_scn_offset % (sizeof(__uint64_t)*2));
}
}
@@ -5378,7 +5380,6 @@ dwarf_builder::build(systemtap_session & sess,
size_t cuhl;
Dwarf_Off noff = 0;
const char *probe_file = "@sduprobes.c";
- int probe_line;
// Find where the probe instrumentation landing points are defined
while (dwarf_nextcu (dwarf, off = noff, &noff, &cuhl, NULL, NULL, NULL) == 0)
{
@@ -5386,6 +5387,8 @@ dwarf_builder::build(systemtap_session & sess,
Dwarf_Die *cudie = dwarf_offdie (dwarf, off + cuhl, &cudie_mem);
if (cudie == NULL)
continue;
+ if (0)
+ printf("2 diename=%s module_name=%s probe_type=%d probe_arg=%#Lx\n",dwarf_diename(&cudie_mem),module_name.c_str(), (int)probe_type, (long long)probe_arg);
if (probe_type == no_debuginfo)
{
if (strncmp (dwarf_diename(&cudie_mem), "sduprobes", 9) == 0)
@@ -5393,15 +5396,6 @@ dwarf_builder::build(systemtap_session & sess,
break;
}
}
- else
- {
- Dwarf_Line *dwarf_line = dwarf_getsrc_die (cudie, probe_arg);
- if (dwarf_line == NULL)
- continue;
- dwarf_lineno (dwarf_line, &probe_line);
- probe_file = (dwarf_diename(&cudie_mem) ?: "<unknown>");
- break;
- }
}
location->components[1]->functor = TOK_STATEMENT;
if (probe_type == no_debuginfo)
@@ -5414,11 +5408,9 @@ dwarf_builder::build(systemtap_session & sess,
}
else
{
- char *pline;
- if (asprintf (&pline, "*@%s:%d", probe_file, probe_line + 1) < 0)
- return;
- location->components[1]->arg = new literal_string(pline);
+ location->components[1]->arg = new literal_number((int)probe_arg);
}
+
((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg;
dw->module = 0;
}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 8e174efc..dc91a215 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-16 Stan Cox <scox@redhat.com>
+
+ * systemtap.base/static_uprobes.exp: Generate our own probes file.
+
2008-12-09 Frank Ch. Eigler <fche@elastic.org>
PR6961.
diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp
index 78641d3f..f3f26d8a 100644
--- a/testsuite/systemtap.base/static_uprobes.exp
+++ b/testsuite/systemtap.base/static_uprobes.exp
@@ -8,6 +8,7 @@ set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=
set fp [open $sup_srcpath "w"]
puts $fp "
#include <stdlib.h>
+#define USE_STAP_PROBE 1
#include \"sduprobes.h\"
foo ()
@@ -24,12 +25,13 @@ bar (int i)
baz (int i, char* s)
{
+ STAP_PROBE1(tstlabel,label0,i);
if (i == 0)
i = 1000;
STAP_PROBE2(tstlabel,label3,i,s);
}
-buz ()
+buz (int parm)
{
}
@@ -39,6 +41,7 @@ main ()
foo();
bar(2);
baz(3,\"abc\");
+ buz(4);
}
"
close $fp
@@ -52,33 +55,85 @@ if { $res != "" } {
pass "compiling static_uprobes.c"
}
+set fp [open "[pwd]/static_uprobes.stp" "w"]
+puts $fp "
+probe process(\"static_uprobes.x\").mark(\"label0\")
+{
+ printf(\"In label0 probe %#x\\n\", \$arg1)
+}
+probe process(\"static_uprobes.x\").mark(\"label1\")
+{
+ printf(\"In label1 probe\\n\")
+}
+probe process(\"static_uprobes.x\").mark(\"label2\")
+{
+ printf(\"In label2 probe %#x\\n\", \$arg1)
+}
+probe process(\"static_uprobes.x\").mark(\"label3\")
+{
+ printf(\"In label3 probe %#x %#x\\n\", \$arg1, \$arg2)
+}
+"
+close $fp
+
set ok 0
-spawn stap -c $sup_exepath $srcdir/$subdir/static_uprobes.stp
+verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp"
+spawn stap -c $sup_exepath [pwd]/static_uprobes.stp
expect {
-timeout 180
-re {In label1 probe} { incr ok; exp_continue }
-re {In label2 probe 0x2} { incr ok; exp_continue }
+ -re {In label0 probe 0x3} { incr ok; exp_continue }
-re {In label3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
+if {$ok == 4} { pass "$test" } { fail "$test ($ok)" }
+set ok 0
+
# Now do a debuginfo style probe of the above test
set fp [open "[pwd]/static_uprobes.sh" "w"]
puts $fp "
ed $sup_srcpath <<HERE
-1a
-#define USE_STAP_DEBUGINFO_PROBE 1
+/USE_STAP_PROBE/d
+/buz/+1
+a
+ DTRACE_PROBE1(tstlabel,label4,parm);
.
w
q
-HERE
"
close $fp
spawn sh [pwd]/static_uprobes.sh
-set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=$env(SYSTEMTAP_RUNTIME)/sduprobes.c"
+set fp [open "[pwd]/static_uprobes.stp" "w"]
+puts $fp "
+probe process(\"static_uprobes.x\").mark(\"label0\")
+{
+ printf(\"In label0 probe %#x\\n\", \$label0_arg1)
+}
+probe process(\"static_uprobes.x\").mark(\"label1\")
+{
+ printf(\"In label1 probe\\n\")
+}
+probe process(\"static_uprobes.x\").mark(\"label2\")
+{
+ printf(\"In label2 probe %#x\\n\", \$label2_arg1)
+}
+probe process(\"static_uprobes.x\").mark(\"label3\")
+{
+ printf(\"In label3 probe %#x %#x\\n\", \$label3_arg1, \$label3_arg2)
+}
+probe process(\"static_uprobes.x\").mark(\"label4\")
+{
+ printf(\"In label4 dtrace probe %#x\\n\", \$label4_arg1)
+}
+"
+close $fp
+
+set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=-O additional_flags=$env(SYSTEMTAP_RUNTIME)/sduprobes.c"
set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags]
if { $res != "" } {
verbose "target_compile failed: $res" 2
@@ -88,16 +143,19 @@ if { $res != "" } {
pass "compiling sduprobes.c -g"
}
-spawn stap -c $sup_exepath $srcdir/$subdir/static_uprobes.stp
+verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp"
+spawn stap -c $sup_exepath [pwd]/static_uprobes.stp
expect {
-timeout 180
-re {In label1 probe} { incr ok; exp_continue }
-re {In label2 probe 0x2} { incr ok; exp_continue }
+ -re {In label0 probe 0x3} { incr ok; exp_continue }
-re {In label3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue }
+ -re {In label4 dtrace probe 0x4} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
wait
-if {$ok == 6} { pass "$test" } { fail "$test ($ok)" }
+if {$ok == 5} { pass "$test" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/static_uprobes.stp b/testsuite/systemtap.base/static_uprobes.stp
deleted file mode 100644
index b9de197e..00000000
--- a/testsuite/systemtap.base/static_uprobes.stp
+++ /dev/null
@@ -1,14 +0,0 @@
-probe process("static_uprobes.x").mark("label1")
-{
- printf("In label1 probe\n")
-}
-
-probe process("static_uprobes.x").mark("label2")
-{
- printf("In label2 probe %#x\n", $arg1)
-}
-
-probe process("static_uprobes.x").mark("label3")
-{
- printf("In label3 probe %#x %#x\n", $arg1, $arg2)
-}