diff options
author | Jim Keniston <jkenisto@us.ibm.com> | 2008-09-15 02:29:29 -0700 |
---|---|---|
committer | Jim Keniston <jkenisto@us.ibm.com> | 2008-09-15 02:29:29 -0700 |
commit | 553987ef137f6d80b6133a97864942f865e60ece (patch) | |
tree | 5b471373c3640a8f30141a604667910e3d69aaee | |
parent | c79cd4b878c3d4e66fd9203107b078734cfbe0a1 (diff) | |
parent | 8844346125b135280bee9fee12cbdbceb750d898 (diff) | |
download | systemtap-steved-553987ef137f6d80b6133a97864942f865e60ece.tar.gz systemtap-steved-553987ef137f6d80b6133a97864942f865e60ece.tar.xz systemtap-steved-553987ef137f6d80b6133a97864942f865e60ece.zip |
Merge branch 'master' of ssh://kenistoj@sources.redhat.com/git/systemtap
28 files changed, 256 insertions, 200 deletions
@@ -1,6 +1,7 @@ 2008-09-12 Dave Brolley <brolley@redhat.com> * stap-client (staprun_PATH): Ensure that $first_stap is not empty. + * stap-start-server: Use 'ps' to check that the server started. 2008-09-12 Masami Hiramatsu <mhiramat@redhat.com> @@ -1,5 +1,10 @@ * What's new +- The stap "-F" flag activates "flight recorder" mode, which consists of + translating the given script as usual, but implicitly launching it into + the background with staprun's existing "-L" (launch) option. A user + can later reattach to the module with "staprun -A MODULENAME". + - Additional context variables are available on user-space syscall probes. - $argN ($arg1, $arg2, ... $arg6) in process(PATH_OR_PID).syscall gives you the argument of the system call. diff --git a/buildrun.cxx b/buildrun.cxx index ada00027..8ec731df 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -287,6 +287,9 @@ run_pass (systemtap_session& s) if (s.need_uprobes) staprun_cmd += "-u "; + if (s.load_only) + staprun_cmd += "-L "; + staprun_cmd += s.tmpdir + "/" + s.module_name + ".ko"; if (s.verbose>1) clog << "Running " << staprun_cmd << endl; diff --git a/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml b/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml index 6f1b2a0a..b19f5e48 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml @@ -5,7 +5,7 @@ <chapter id="introduction"> <title>Introduction</title> <para> - SystemTap is a tracing and probing tool that provides users deep technical insight into what the operating system (particularly, the kernel) is doing at any given time. It provides information similar to the output of tools like <command>netstat</command>, <command>ps</command>, <command>top</command>, and <command>iostat</command>; however, SystemTap is designed to provide information that is more "granular" in nature. + SystemTap is a tracing and probing tool that provides users to study and monitor the activities of the operating system (particularly, the kernel) in fine detail. It provides information similar to the output of tools like <command>netstat</command>, <command>ps</command>, <command>top</command>, and <command>iostat</command>; however, SystemTap is designed to provide information that is more "granular" in nature. </para> <para> @@ -23,7 +23,7 @@ <para>Without SystemTap, monitoring the activity of a running kernel would require a tedious instrument, recompile, install, and reboot sequence. SystemTap is designed to eliminate this, allowing users to gather the same information by simply running its suite of tools against specific <firstterm>tapsets</firstterm> or SystemTap scripts.</para> - <para>However, SystemTap was initially designed for users with intermediate to advanced knowledge of the kernel. This could present a steep learning curve for administrators or developers whose knowledge of the Linux kernel is little to none.</para> + <para>However, SystemTap was initially designed for users with intermediate to advanced knowledge of the kernel. As such, much of the existing documentation for SystemTap is primarily for advanced users. This could present a steep learning curve for administrators or developers whose knowledge of the Linux kernel is little to none.</para> <para>In line with that, the main goals of the <citetitle>SystemTap Beginner's Guide</citetitle> are as follows:</para> diff --git a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml index d61ec1cf..bbd265c2 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml @@ -13,9 +13,12 @@ As stated in <xref linkend="understanding-how-systemtap-works"/>, SystemTap scripts are made up of two components: <emphasis>events</emphasis> and <emphasis>handlers</emphasis>. Once a SystemTap session is underway, SystemTap monitors the operating system for the specified events and executes the handlers as they occur. </para> + <note> <title>Note</title> <para>An event and its corresponding handler is collectively called a <emphasis>probe</emphasis>. A SystemTap script can have multiple probes.</para> + + <para>A probe's handler is also commonly referred to as a <emphasis>probe body</emphasis>.</para> </note> <para> @@ -92,11 +95,57 @@ probe kernel.function("*@net/socket.c").return { } <varlistentry> <term>syscall.<replaceable>[system_call]</replaceable></term> <listitem> - <para>The entry to the system call <replaceable>[system_call]</replaceable>. Similar to <command>kerne.function</command>, appending a <command>return</command> to the statement specifies the exit of the system call. For example, to specify the entry of the system call <command>close</command>, use <command>syscall.close.return</command>.</para> + <para>The entry to the system call <replaceable>[system_call]</replaceable>. Similar to <command>kernel.function</command>, appending a <command>return</command> to the statement specifies the exit of the system call. For example, to specify the entry of the system call <command>close</command>, use <command>syscall.close.return</command>.</para> <para>To identify what system calls are made by a specific program/command, use <command>strace <replaceable>command</replaceable></command>.</para> </listitem> </varlistentry> + +<varlistentry> + <term>timer.ms()</term> + <listitem> + <para>An event that specifies a handler to be executed "after X number of milliseconds". For example:</para> + +<example id="timer"><title>Using timer.ms</title> +<programlisting> +probe timer.ms(4000) +{ + exit() +} +</programlisting> +</example> + +<para> + <xref linkend="timer"/> is an example of a probe that allows you to terminate the script after 4000 milliseconds (or 4 seconds). When used in conjunction with another probe that traps a large quantity of data, a probe using <command>timer.ms()</command> allows you to limit the information your script is collecting (and printing out). +</para> + + </listitem> +</varlistentry> + +<varlistentry> + <term>module("<replaceable>[module]</replaceable>").function("<replaceable>[function]</replaceable>")</term> + <listitem> + <para>Allows you to probe functions within modules. For example:</para> + +<example id="eventsmodules"><title>Module Probe</title> +<programlisting> +probe module("ext3").function("*") { }
+probe module("ext3").function("*").return { } +</programlisting> +</example> + + <para> + The first probe in <xref linkend="eventsmodules"/> points to the entry of <emphasis>all</emphasis> functions for the <filename>ext3</filename> module. The second probe points to the exits of all entries for that same module; the use of the <command>.return</command> suffix is similar to <command>kernel.function()</command>. Note that the probes in <xref linkend="eventsmodules"/> also do not contain probe bodies, and as such will not print any useful data (as in <xref linkend="wildcards"/>). + </para> + + <para> + A system's loaded modules are typically located in <filename>/lib/modules/<replaceable>[kernel version]</replaceable></filename>, where <replaceable>kernel version</replaceable> refers to the currently loaded kernel. Modules use the filename extension <filename>.ko</filename>. + </para> + + </listitem> +</varlistentry> + +<!--<remark>add timer.ms() to events list!</remark>--> <!-- <varlistentry> <term></term> @@ -114,10 +163,12 @@ probe kernel.function("*@net/socket.c").return { } SystemTap supports the use of a large collection of probe events. For more information about supported events, refer to <command>man stapprobes</command>. The <citetitle>SEE ALSO</citetitle> section of <command>man stapprobes</command> also contains links to other <command>man</command> pages that discuss supported events for specific subsystems and components. </para> </important> + +<remark>is reference appropriate? too advanced for readers (it seems so to me)? please advise.</remark> </section> <section id="systemtapscript-handlers"> - <title>Handlers</title> + <title>Handlers/Probe Body</title> <para> Consider the following sample script: @@ -142,7 +193,10 @@ probe begin <para> The <command>printf ()</command> statement is one of the simplest handler tools for printing data. <command>printf ()</command> can also be used to trap data using a wide variety of SystemTap handler functions using the following format: </para> + </formalpara> +<remark>is "handler tool" appropriate?</remark> + <programlisting> printf ("<replaceable>[format string]</replaceable>\n", <replaceable>[argument]</replaceable>) @@ -164,10 +218,11 @@ printf ("<replaceable>[format string]</replaceable>\n", <replaceable>[argument]< <title>Using Variables In printf ( ) Statements</title> <programlisting> # This probe will need to be manually terminated with Ctrl-C -probe syscall.open
-{
- printf ("%s(%d) open\n", execname(), pid())
-}
+probe syscall.open +{ + printf ("%s(%d) open\n", execname(), pid()) +} + </programlisting> </example> @@ -175,6 +230,8 @@ probe syscall.open <xref linkend="syscall-open"/> instructs SystemTap to probe all entries to the system call <command>open</command>; for each event, it prints the current <command>execname()</command> (which is a string) and <command>pid()</command> (which is a number), followed by the word <command>open</command>. A snippet of this probe's output would look like: </para> +<remark>editorial review: does a clarification that "variable1" is to "argument1", "variable2" is to "argument2", or is this clear enough?</remark> + <screen> vmware-guestd(2206) open hald(2360) open @@ -187,11 +244,13 @@ hald(2360) open </screen> <formalpara> - <title>Handler Functions</title> + <title>Handler Functions</title> <para>SystemTap supports a wide variety of handler functions that can be used as <command>printf ()</command> arguments. <xref linkend="syscall-open"/> uses the handler functions <command>execname()</command> (current process name) and <command>pid()</command> (current process ID).</para> </formalpara> - <para>The following is a list of commonly-used handler functions:</para> - + +<remark>is "handler function" an appropriate term?</remark> + + <para>The following is a list of commonly-used handler functions:</para> <variablelist> <varlistentry> @@ -242,6 +301,56 @@ hald(2360) open <para>If known, the name of the function in which the probe was placed.</para> </listitem> </varlistentry> + +<varlistentry> + <term>thread_indent()</term> + <listitem> + <para>This particular handler function is quite useful, providing you with a way to better organize your print results. When used with an indentation parameter (for example, <command>-1</command>), it allows the probe to internally store an "indentation counter" for each thread (identified by ID, as in <command>tid</command>). It then returns a string with some generic trace data along with an appropriate number of indentation spaces.</para> + + <para>The generic data included in the returned string includes a timestamp (number of microseconds since the most recent initial indentation), a process name, and the thread ID. This allows you to identify what functions were called, who called them, and the duration of each function call. + </para> + + <para> + Consider the following example on the use of <command>thread_indent()</command>: + </para> + +<example id="thread_indent"><title>Using thread_indent()</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 <- %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): -> sys_socketcall + 1159 ftp(7223): -> sys_socket + 2173 ftp(7223): -> __sock_create + 2286 ftp(7223): -> sock_alloc_inode + 2737 ftp(7223): <- sock_alloc_inode + 3349 ftp(7223): -> sock_alloc + 3389 ftp(7223): <- sock_alloc + 3417 ftp(7223): <- __sock_create + 4117 ftp(7223): -> sock_create + 4160 ftp(7223): <- sock_create + 4301 ftp(7223): -> sock_map_fd + 4644 ftp(7223): -> sock_map_file + 4699 ftp(7223): <- sock_map_file + 4715 ftp(7223): <- sock_map_fd + 4732 ftp(7223): <- sys_socket + 4775 ftp(7223): <- sys_socketcall +</screen> + +<remark>remember to add a reference later to "tapsets" from here, to clarify that thread_indent is defined in tapsets as a special function of sorts</remark> + + </listitem> +</varlistentry> <!-- <varlistentry> <term></term> @@ -254,6 +363,7 @@ hald(2360) open <para>For more information about supported handler functions, refer to <command>man stapfuncs</command>.</para> +<remark>will need a complete listing of supported handler functions? also, handler function descriptions seem ambiguous, please advise.</remark> <!-- <para> 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 de5d41b0..76296507 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 @@ -34,7 +34,7 @@ <title>SystemTap Session</title> <step><para>SystemTap first translates the script to C, running the system C compiler to create a kernel module from it.</para></step> - <step><para>SystemTap then loads the module, then enables all the probed events by "hooking" those events into the kernel.</para></step> + <step><para>SystemTap loads the module, then enables all the probed events by "hooking" those events into the kernel.</para></step> <step><para>As the events occur, their corresponding handlers are executed.</para></step> @@ -108,6 +108,7 @@ usage (systemtap_session& s, int exitcode) << " -c CMD start the probes, run CMD, and exit when it finishes" << endl << " -x PID sets target() to PID" << endl + << " -F load module and start probes, then detach" << endl << " -d OBJECT add unwind/symbol data for OBJECT file"; if (s.unwindsym_modules.size() == 0) clog << endl; @@ -363,6 +364,7 @@ main (int argc, char * const argv []) s.consult_symtab = false; s.ignore_vmlinux = false; s.ignore_dwarf = false; + s.load_only = false; const char* s_p = getenv ("SYSTEMTAP_TAPSET"); if (s_p != NULL) @@ -426,7 +428,7 @@ main (int argc, char * const argv []) { "ignore-dwarf", 0, &long_opt, LONG_OPT_IGNORE_DWARF }, { NULL, 0, NULL, 0 } }; - int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:", + int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:F", long_options, NULL); if (grc < 0) break; @@ -611,6 +613,10 @@ main (int argc, char * const argv []) have_script = true; break; + case 'F': + s.load_only = true; + break; + case 0: switch (long_opt) { diff --git a/runtime/regs-ia64.c b/runtime/regs-ia64.c index b0eb9829..f884c5f8 100644 --- a/runtime/regs-ia64.c +++ b/runtime/regs-ia64.c @@ -126,7 +126,7 @@ static void ia64_store_register(int regno, #else /* if defined __ia64__ */ -#define bspcache(cache, regs, pp) do {} while(0) +#define bspcache(cache, regs) do {} while(0) #endif /* if defined __ia64__ */ @@ -104,6 +104,7 @@ struct systemtap_session bool prologue_searching; bool tapset_compile_coverage; bool need_uprobes; + bool load_only; // flight recorder mode // Cache data bool use_cache; diff --git a/stap-start-server b/stap-start-server index eea86526..aa2850b5 100755 --- a/stap-start-server +++ b/stap-start-server @@ -19,7 +19,7 @@ server_pid=$! # Make sure the server is started for ((attempt=0; $attempt < 5; ++attempt)) do - stap-find-servers >/dev/null 2>&1 && echo $server_pid && exit 0 + (ps -a | grep $server_pid) >/dev/null 2>&1 && echo $server_pid && exit 0 sleep 1 done @@ -185,6 +185,10 @@ and aliases. .BI \-L " PROBE" Similar to "-l", but list probe points and local variables. .TP +.BI \-F +Load module and start probes, then detach from the module leaving the +probes running. +.TP .B \-\-kelf For names and addresses of functions to probe, consult the symbol tables in the kernel and modules. diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 97801a20..46e15fd6 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,18 @@ +2008-09-17 Mark Wielaard <mjw@redhat.com> + + * aux_syscalls.stp: Removed commented out code. Removed unneeded + unpure embedded C-code. + +2008-09-15 Mark Wielaard <mjw@redhat.com> + + * x86_64/syscalls.stp (syscall.vm86_warning): Add argstr. + +2008-09-15 Mark Wielaard <mjw@redhat.com> + + * vfs.stp: Fix 2.6.27 detection. + * syscall.stp: Likewise. + * syscall2.stp: Likewise. + 2008-09-12 Wenji Huang <wenji.huang@oracle.com> * signal.stp: Initialize __sig in a function. diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index f79acaf0..6ef9ed1e 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -134,13 +134,10 @@ function _struct_compat_utimbuf_modtime:long(uaddr:long) #endif %} -%{ -#define STP_UTIME_NOW ((1l << 30) - 1l) -#define STP_UTIME_OMIT ((1l << 30) - 2l) -%} - function _struct_timespec_u:string(uaddr:long, n:long) %{ /* pure */ +#define STP_UTIME_NOW ((1l << 30) - 1l) +#define STP_UTIME_OMIT ((1l << 30) - 2l) int n = (int)THIS->n; struct timespec ts[n]; char *ptr = (char *)(unsigned long)THIS->uaddr; @@ -168,10 +165,14 @@ function _struct_timespec_u:string(uaddr:long, n:long) } } } +#undef STP_UTIME_NOW +#undef STP_UTIME_OMIT %} function _struct_compat_timespec_u:string(uaddr:long, n:long) %{ /* pure */ #ifdef CONFIG_COMPAT +#define STP_UTIME_NOW ((1l << 30) - 1l) +#define STP_UTIME_OMIT ((1l << 30) - 2l) int n = (int)THIS->n; struct compat_timespec ts[n]; char *ptr = (char *)(unsigned long)THIS->uaddr; @@ -199,6 +200,8 @@ function _struct_compat_timespec_u:string(uaddr:long, n:long) } } } +#undef STP_UTIME_NOW +#undef STP_UTIME_OMIT #endif %} @@ -256,16 +259,31 @@ function _struct_compat_itimerval_u:string(uaddr:long) #endif %} - %{ -#include <linux/version.h> +// Needed for function _struct_sockaddr_u. Unfortunately cannot be +// inlined into the function since these header files define static +// functions themselves. #include <linux/socket.h> #include <linux/in.h> +#include <linux/netlink.h> +%} + +function _struct_sockaddr_u:string(uaddr:long, len:long) +%{ /* pure */ +#include <linux/version.h> #include <linux/in6.h> #include <linux/un.h> -#include <linux/netlink.h> #include <linux/if_packet.h> + char *ptr = (char *)(unsigned long)THIS->uaddr; + if (ptr == NULL) + strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN); + else { + char buf[128]; + size_t len = THIS->len < 128 ? THIS->len : 128; + if(_stp_copy_from_user(buf, ptr, len)) + strlcpy (THIS->__retvalue, "[...]", MAXSTRINGLEN); + else { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) #define LPORT (inet->inet.num) #define DADDR (&inet->inet.daddr) @@ -274,10 +292,9 @@ function _struct_compat_itimerval_u:string(uaddr:long) #define DADDR (&inet->daddr) #endif -//FIXME. Not done yet. - -void _stp_sockaddr_str(char *str, const int strlen, char *buf, int len) -{ + //FIXME. Not done yet. + char *str = THIS->__retvalue; + const int strlen = MAXSTRINGLEN; struct sockaddr *sa = (struct sockaddr *)buf; if ((sa->sa_family == AF_INET)&&(len == sizeof(struct sockaddr_in))) { @@ -321,29 +338,15 @@ void _stp_sockaddr_str(char *str, const int strlen, char *buf, int len) { if (len >= sizeof(sa_family_t)) { - snprintf(str, strlen, "{unknown sockaddr with sa=%d, salen=%d}", sa->sa_family, len); + snprintf(str, strlen, "{unknown sockaddr with sa=%d, salen=%d}", sa->sa_family, (int) len); } else { - snprintf(str, strlen, "{unknown sockaddr with salen=%d}", len); + snprintf(str, strlen, "{unknown sockaddr with salen=%d}", (int)len); } } -} -%} - -function _struct_sockaddr_u:string(uaddr:long, len:long) -%{ /* pure */ - char *ptr = (char *)(unsigned long)THIS->uaddr; - if (ptr == NULL) - strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN); - else { - char buf[128]; - size_t len = THIS->len < 128 ? THIS->len : 128; - if(_stp_copy_from_user(buf, ptr, len)) - strlcpy (THIS->__retvalue, "[...]", MAXSTRINGLEN); - else - _stp_sockaddr_str(THIS->__retvalue, MAXSTRINGLEN, buf, len); } +} %} function _struct_rlimit_u:string(uaddr:long) @@ -519,124 +522,6 @@ function __get_compat_argv:string(a:long, first:long) %} /* - * Return a integer member value of struct - * timezone user space pointer parameter - * CALLERS: - * syscall.gettimeofday - * syscall.settimeofday - */ -/* -function __uget_tz_m:long(u_addr:long,member:long) -%{ - struct timezone tz; - char *ptr = (char *)(unsigned long)THIS->u_addr; - size_t sz = sizeof(struct timezone); - - if(copy_from_user(&tz,ptr,sz)) - THIS->__retvalue = -EFAULT; - else if(THIS->member == 0) - THIS->__retvalue = tz.tz_minuteswest; - else - THIS->__retvalue = tz.tz_dsttime; -%} -*/ -/* - * Return integer member value of struct - * timex user space pointer parameter - * CALLERS: - * syscall.adjtimex - */ -/* -function __uget_timex_m:long(u_addr:long,member:long) -%{ - struct timex tx; - char *ptr = (char *)(unsigned long)THIS->u_addr; - size_t sz = sizeof(struct timex); - - if(copy_from_user(&tx,ptr,sz)) { - THIS->__retvalue = -EFAULT; - } else - switch(THIS->member) { - case 0: THIS->__retvalue = tx.modes; - break; - case 1: THIS->__retvalue = tx.offset; - break; - case 2: THIS->__retvalue = tx.freq; - break; - case 3: THIS->__retvalue = tx.maxerror; - break; - case 4: THIS->__retvalue = tx.esterror; - break; - case 5: THIS->__retvalue = tx.status; - break; - case 6: THIS->__retvalue = tx.constant; - break; - case 7: THIS->__retvalue = tx.precision; - break; - case 8: THIS->__retvalue = tx.tolerance; - break; - case 9: THIS->__retvalue = tx.time.tv_sec; - break; - case 10: THIS->__retvalue = tx.time.tv_usec; - break; - case 11: THIS->__retvalue = tx.tick; - break; - default: THIS->__retvalue = -1; - } -%} -*/ -/* - * Return the clock_t member value of the - * struct tms user space pointer parameter - * CALLERS: - * syscall.times - */ -/* -%{ #include <linux/times.h> %} -function __uget_tms_m:long(u_addr:long,member:long) -%{ - struct tms tms; - char *ptr = (char *)(unsigned long)THIS->u_addr; - size_t sz = sizeof(struct tms); - - if(copy_from_user(&tms,ptr,sz)) - THIS->__retvalue = -EFAULT; - switch(THIS->member) { - case 0: THIS->__retvalue = tms.tms_utime; - break; - case 1: THIS->__retvalue = tms.tms_stime; - break; - case 2: THIS->__retvalue = tms.tms_cutime; - break; - case 3: THIS->__retvalue = tms.tms_cstime; - break; - default: THIS->__retvalue = -1; - } -%} -*/ -/* - * Return a time_t / long member value of the - * struct timespec user space pointer parameter - * CALLERS: - * syscall.nanosleep - */ -/* -function __uget_ts_m:long(u_addr:long,member:long) -%{ - struct timespec ts; - char *ptr = (char *)(unsigned long)THIS->u_addr; - size_t sz = sizeof(struct timespec); - - if(copy_from_user(&ts,ptr,sz)) - THIS->__retvalue = -EFAULT; - else if(THIS->member == 0) - THIS->__retvalue = ts.tv_sec; - else - THIS->__retvalue = ts.tv_nsec; -%} -*/ - -/* * Return the symbolic string representation * of the struct timex.mode member of adjtimex * consult `man adjtimex` for more information @@ -915,13 +800,10 @@ function _recvflags_str(f) { return substr(bs,0,strlen(bs)-1) } -%{ -#include <linux/mman.h> -%} - /* `man mlockall` for more information */ function _mlockall_flags_str:string(flags:long) %{ /* pure */ + #include <linux/mman.h> int len; long f = THIS->flags; char *str = THIS->__retvalue; @@ -973,11 +855,9 @@ function _shutdown_how_str(how) { return sprintf("UNKNOWN VALUE: %d", how) } -%{ -#include <linux/reboot.h> -%} function _reboot_magic_str:string(magic:long) %{ /* pure */ + #include <linux/reboot.h> int magic = (int)THIS->magic; switch (magic) { case LINUX_REBOOT_MAGIC1: @@ -1756,6 +1636,7 @@ function _shmat_flags_str:string(f:long) %{ +#include <linux/mman.h> const _stp_val_array const _stp_mprotect_list[] = { {0, "PROT_NONE"}, V(PROT_READ), @@ -1772,6 +1653,7 @@ function _mprotect_prot_str:string(prot:long) %} %{ +#include <linux/mman.h> const _stp_val_array const _stp_mmap_list[] = { V(MAP_SHARED), V(MAP_PRIVATE), diff --git a/tapset/syscalls.stp b/tapset/syscalls.stp index 7fd942af..89b3c730 100644 --- a/tapset/syscalls.stp +++ b/tapset/syscalls.stp @@ -1715,7 +1715,7 @@ probe syscall.getuid.return = # void __user *value, size_t size) probe syscall.getxattr = kernel.function("sys_getxattr") { name = "getxattr" -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path = user_string($pathname) %: path = user_string($path) @@ -1725,7 +1725,7 @@ probe syscall.getxattr = kernel.function("sys_getxattr") { value_uaddr = $value size = $size argstr = sprintf("%s, %s, %p, %d", -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? user_string_quoted($pathname), %: user_string_quoted($path), @@ -1763,7 +1763,7 @@ probe syscall.inotify_add_watch = kernel.function("sys_inotify_add_watch") ? { name = "inotify_add_watch" fd = $fd mask = $mask -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path_uaddr = $pathname path = user_string($pathname) argstr = sprintf("%d, %s, %d", $fd, user_string_quoted($pathname), $mask) @@ -2096,7 +2096,7 @@ probe syscall.lchown16.return = kernel.function("sys_lchown16").return ? { # probe syscall.lgetxattr = kernel.function("sys_lgetxattr") { name = "lgetxattr" -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path = user_string($pathname) %: path = user_string($path) @@ -2106,7 +2106,7 @@ probe syscall.lgetxattr = kernel.function("sys_lgetxattr") { value_uaddr = $value size = $size argstr = sprintf("%s, %s, %p, %d", -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? user_string_quoted($pathname), %: user_string_quoted($path), @@ -2181,7 +2181,7 @@ probe syscall.listxattr = kernel.function("sys_listxattr") { name = "listxattr" list_uaddr = $list size = $size -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path_uaddr = $pathname path = user_string($pathname) argstr = sprintf("%s, %p, %d", user_string_quoted($pathname), $list, $size) @@ -2203,7 +2203,7 @@ probe syscall.llistxattr = kernel.function("sys_llistxattr") { name = "llistxattr" list_uaddr = $list size = $size -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path_uaddr = $pathname path = user_string($pathname) argstr = sprintf("%s, %p, %d", user_string_quoted($pathname), $list, $size) @@ -2262,7 +2262,7 @@ probe syscall.lremovexattr = kernel.function("sys_lremovexattr") { name = "lremovexattr" name_uaddr = $name name2 = user_string($name) -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path_uaddr = $pathname path = user_string($pathname) argstr = sprintf("%s, %s", user_string_quoted($pathname), user_string_quoted($name)) @@ -2302,7 +2302,7 @@ probe syscall.lseek.return = kernel.function("sys_lseek").return { # probe syscall.lsetxattr = kernel.function("sys_lsetxattr") { name = "lsetxattr" -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path_uaddr = $pathname path = user_string($pathname) %: @@ -2315,7 +2315,7 @@ probe syscall.lsetxattr = kernel.function("sys_lsetxattr") { size = $size flags = $flags argstr = sprintf("%s, %s, %p, %d, %d", -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? user_string_quoted($pathname), %: user_string_quoted($path), diff --git a/tapset/syscalls2.stp b/tapset/syscalls2.stp index 57d190e3..28691a66 100644 --- a/tapset/syscalls2.stp +++ b/tapset/syscalls2.stp @@ -625,7 +625,7 @@ probe syscall.readlinkat = kernel.function("sys_readlinkat") ? { dfd = $dfd buf_uaddr = $buf bufsiz = $bufsiz -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path = user_string($pathname) argstr = sprintf("%s, %s, %p, %d", _dfd_str($dfd), user_string_quoted($pathname), $buf, $bufsiz) %: @@ -812,7 +812,7 @@ probe syscall.remap_file_pages.return = probe syscall.removexattr = kernel.function("sys_removexattr") { name = "removexattr" name_str = user_string($name) -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path = user_string($pathname) argstr = sprintf("%s, %s", user_string_quoted($pathname), user_string_quoted($name)) @@ -1990,7 +1990,7 @@ probe syscall.setuid.return = # probe syscall.setxattr = kernel.function("sys_setxattr") { name = "setxattr" -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path_uaddr = $pathname path = user_string($pathname) %: @@ -2003,7 +2003,7 @@ probe syscall.setxattr = kernel.function("sys_setxattr") { size = $size flags = $flags argstr = sprintf("%s, %s, %p, %d, %d", -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? user_string_quoted($pathname), %: user_string_quoted($path), @@ -2398,7 +2398,7 @@ probe syscall.statfs = { name = "statfs" buf_uaddr = $buf -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path = user_string($pathname) argstr = sprintf("%s, %p", user_string_quoted($pathname), $buf) %: @@ -2427,7 +2427,7 @@ probe syscall.statfs64 = name = "statfs" sz = $sz buf_uaddr = $buf -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? path = user_string($pathname) argstr = sprintf("%s, %d, %p", user_string_quoted($pathname), $sz, $buf) %: diff --git a/tapset/vfs.stp b/tapset/vfs.stp index 1ea8fc8e..7f2312db 100644 --- a/tapset/vfs.stp +++ b/tapset/vfs.stp @@ -744,7 +744,7 @@ probe vfs.do_mpage_readpage.return = kernel.function ("do_mpage_readpage").retur units = "pages" } -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? probe vfs.add_to_page_cache = kernel.function ("add_to_page_cache_locked") %: probe vfs.add_to_page_cache = kernel.function ("add_to_page_cache") @@ -761,7 +761,7 @@ probe vfs.add_to_page_cache = kernel.function ("add_to_page_cache") argstr = sprintf("%d, %d", ino, index) } -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? probe vfs.add_to_page_cache.return = kernel.function ("add_to_page_cache_locked").return %: probe vfs.add_to_page_cache.return = kernel.function ("add_to_page_cache").return diff --git a/tapset/x86_64/syscalls.stp b/tapset/x86_64/syscalls.stp index c9ab617f..ad16878f 100644 --- a/tapset/x86_64/syscalls.stp +++ b/tapset/x86_64/syscalls.stp @@ -120,6 +120,7 @@ probe syscall.mmap2.return = kernel.function("sys32_mmap2").return { # probe syscall.vm86_warning = kernel.function("sys32_vm86_warning") { name = "vm86_warning" + argstr = "" } probe syscall.vm86_warning.return = kernel.function("sys32_vm86_warning").return { name = "wm86_warning" diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 18f04bbf..234ff66d 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2008-09-15 Mark Wielaard <mjw@redhat.com> + + * buildok/seventeen.stp: Fix 2.6.27 detection. + * testsuite/buildok/seven.stp: Likewise. + +2008-09-12 Frank Ch. Eigler <fche@elastic.org> + + * systemtap.base/uprobes.stp: Use printf in case pp() is long enough + to overflow MAXSTRINGLEN. + 2008-09-11 David Smith <dsmith@redhat.com> * lib/stap_run.exp: Ignore new warning. diff --git a/testsuite/buildok/seven.stp b/testsuite/buildok/seven.stp index dc3bc786..874ce72b 100755 --- a/testsuite/buildok/seven.stp +++ b/testsuite/buildok/seven.stp @@ -6,7 +6,7 @@ # first: enums and ints -%( kernel_v <= "2.6.26" %? +%( kernel_v < "2.6.27" %? probe kernel.function("find_pid") { %( kernel_v >= "2.6.17" %? diff --git a/testsuite/buildok/seventeen.stp b/testsuite/buildok/seventeen.stp index e4a7a8e8..126db1fb 100755 --- a/testsuite/buildok/seventeen.stp +++ b/testsuite/buildok/seventeen.stp @@ -5,7 +5,7 @@ probe kernel.function("pipe_write") { -%( kernel_v > "2.6.26" %? +%( kernel_v >= "2.6.27" %? printf("0x%x\n", $write_pipefifo_fops->llseek) %: printf("0x%x\n", $write_fifo_fops->llseek) diff --git a/testsuite/systemtap.base/uprobes.stp b/testsuite/systemtap.base/uprobes.stp index 32bc1a70..b609f3a1 100755 --- a/testsuite/systemtap.base/uprobes.stp +++ b/testsuite/systemtap.base/uprobes.stp @@ -1,3 +1,3 @@ #! stap -p4 -probe process("./jennie").function("main").call { log(pp()." ".$$parms) } -probe process("./jennie").function("main").return { log(pp()." ".$$return) } +probe process("./jennie").function("main").call { printf("%s %s\n",pp(),$$parms) } +probe process("./jennie").function("main").return { printf("%s %s\n",pp(),$$return) } diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog index af641ba7..8d434357 100644 --- a/testsuite/systemtap.examples/ChangeLog +++ b/testsuite/systemtap.examples/ChangeLog @@ -1,3 +1,8 @@ +2008-09-12 Frank Ch. Eigler <fche@elastic.org> + + * io/traceio2.stp: Make compatible with RHEL5. + * general/para-callgraph.meta: Tweak quoting for dejagnu passage. + 2008-08-15 Frank Ch. Eigler <fche@elastic.org> * general/para-callgraph*: Extend. diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta index 740ed5ce..9fcf26c6 100644 --- a/testsuite/systemtap.examples/general/para-callgraph.meta +++ b/testsuite/systemtap.examples/general/para-callgraph.meta @@ -3,5 +3,5 @@ name: para-callgraph.stp keywords: trace callgraph subsystem: general description: Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger. -test_check: stap -p4 para-callgraph.stp 'kernel.function("*@fs/proc*.c")' 'kernel.function("sys_read")' -test_installcheck: stap para-callgraph.stp 'kernel.function("*@fs/proc*.c")' 'kernel.function("sys_read")' -c 'cat /proc/sys/vm/*' +test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") +test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -c 'cat /proc/sys/vm/*' diff --git a/testsuite/systemtap.examples/io/traceio2.stp b/testsuite/systemtap.examples/io/traceio2.stp index 656c38b3..988ea36c 100755 --- a/testsuite/systemtap.examples/io/traceio2.stp +++ b/testsuite/systemtap.examples/io/traceio2.stp @@ -12,7 +12,9 @@ probe begin { probe kernel.function ("vfs_write"), kernel.function ("vfs_read") { - dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev + dev_nr = $file-> + %( kernel_v < "2.6.19" %? f_dentry %: f_path->dentry %) + ->d_inode->i_sb->s_dev if (dev_nr == device_of_interest) printf ("%s(%d) %s 0x%x\n", diff --git a/testsuite/systemtap.syscall/ChangeLog b/testsuite/systemtap.syscall/ChangeLog index 0a3d51ae..772f980a 100644 --- a/testsuite/systemtap.syscall/ChangeLog +++ b/testsuite/systemtap.syscall/ChangeLog @@ -1,3 +1,15 @@ +2008-09-17 Mark Wielaard <mjw@redhat.com> + + * forkwait.c: Low byte of flags is always set to SIGCHLD. + +2008-09-17 Mark Wielaard <mjw@redhat.com> + + * timer.c: Timer id can be arbitrary number. + +2008-09-17 Mark Wielaard <mjw@redhat.com> + + * swap.c: Don't try including unnecessary asm/page.h. + 2008-02-22 Frank Ch. Eigler <fche@elastic.org> * test.tcl: Support noexec /tmp by creating test directory diff --git a/testsuite/systemtap.syscall/forkwait.c b/testsuite/systemtap.syscall/forkwait.c index 10f8d6ac..ffc98708 100644 --- a/testsuite/systemtap.syscall/forkwait.c +++ b/testsuite/systemtap.syscall/forkwait.c @@ -12,7 +12,7 @@ int main () int status; child = fork(); - // clone (CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID) = NNNN + // clone (CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD) = NNNN if (!child) { int i = 0xfffff; while (i > 0) i--; diff --git a/testsuite/systemtap.syscall/swap.c b/testsuite/systemtap.syscall/swap.c index a2db301e..3708a477 100755 --- a/testsuite/systemtap.syscall/swap.c +++ b/testsuite/systemtap.syscall/swap.c @@ -1,6 +1,5 @@ /* COVERAGE: swapon swapoff */ #include <unistd.h> -#include <asm/page.h> #include <sys/swap.h> diff --git a/testsuite/systemtap.syscall/timer.c b/testsuite/systemtap.syscall/timer.c index f7b888ae..947f6a77 100644 --- a/testsuite/systemtap.syscall/timer.c +++ b/testsuite/systemtap.syscall/timer.c @@ -16,16 +16,16 @@ int main() // timer_create (CLOCK_REALTIME, 0x[0]+, XXXX) syscall(SYS_timer_gettime, tid, &val); - // timer_gettime (0, XXXX) + // timer_gettime (NNNN, XXXX) syscall(SYS_timer_settime, 0, tid, &val, &oval); - // timer_settime (0, 0, \[0.000000,0.000000\], XXXX) + // timer_settime (0, NNNN, \[0.000000,0.000000\], XXXX) syscall(SYS_timer_getoverrun, tid); - // timer_getoverrun (0) + // timer_getoverrun (NNNN) syscall(SYS_timer_delete, tid); - // timer_delete (0) + // timer_delete (NNNN) return 0; } |