diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ChangeLog | 51 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | doc/Makefile.in | 4 | ||||
-rw-r--r-- | elaborate.cxx | 2 | ||||
-rw-r--r-- | parse.cxx | 35 | ||||
-rw-r--r-- | parse.h | 5 | ||||
-rw-r--r-- | runtime/ChangeLog | 22 | ||||
-rw-r--r-- | runtime/regs-ia64.c | 10 | ||||
-rw-r--r-- | runtime/task_finder.c | 61 | ||||
-rwxr-xr-x | stap-client | 6 | ||||
-rwxr-xr-x | stap-find-servers | 28 | ||||
-rw-r--r-- | stap-server.8.in | 69 | ||||
-rwxr-xr-x | stap-start-server | 2 | ||||
-rw-r--r-- | systemtap.spec | 4 | ||||
-rw-r--r-- | tapset/ChangeLog | 4 | ||||
-rw-r--r-- | tapset/signal.stp | 47 | ||||
-rw-r--r-- | tapsets.cxx | 13 | ||||
-rw-r--r-- | testsuite/ChangeLog | 14 | ||||
-rw-r--r-- | testsuite/lib/stap_run.exp | 1 | ||||
-rw-r--r-- | testsuite/systemtap.base/optim_arridx.exp | 8 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes.exp | 5 | ||||
-rwxr-xr-x | testsuite/systemtap.base/uprobes.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.examples/ChangeLog | 5 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/para-callgraph.meta | 4 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/traceio2.stp | 4 | ||||
-rw-r--r-- | translate.cxx | 5 |
28 files changed, 295 insertions, 127 deletions
@@ -5,6 +5,7 @@ autom4te.* cscope.files cscope*out +gmon.out config.h config.log config.status @@ -1,3 +1,49 @@ +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> + + BZ 6028 + * tapsets.cxx (dwarf_derived_probe::emit_probe_local_init): Use REG_IP + instead of pp to check probe address. + +2008-09-12 Frank Ch. Eigler <fche@elastic.org> + + GCC 4.4 (var-tracking) build-compatilibity. + * parse.h: #include <stdint.h>. + * tapsets.cxx (utrace_...::visit_target_symbol_arg): Use + lex_cast<int>(foo) instead of atoi(foo.c_str()) for simpler + c++ object lifetime. + * Makefile.am (staprun_CFLAGS, stapio_CFLAGS): Add + -fno-strict-aliasing, since that code is too casual with pointers. + * Makefile.in: Regenerated. + +2008-09-12 Dave Brolley <brolley@redhat.com> + + PR6881. + From Eugeniy Meshcheryakov eugen@debian.org: + * stap-server.8.in: Correct formatting problems. + +2008-09-12 Dave Brolley <brolley@redhat.com> + + * stap-find-servers (match_server): Don't read past the start of the + next server description. Don't use '^' at the start of the regexp + on calls to 'expr'. + * systemtap.spec: client and server sub packages require avahi. + +2008-09-12 Wenji Huang <wenji.huang@oracle.com> + + * elaborate.cxx (add_global_var_display): Don't, in listing mode. + +2008-09-11 Frank Ch. Eigler <fche@elastic.org> + + PR 6871. + * tapsets.cxx (query_cu): Search for prologues for user-space probes. + (query_func_info): Use prologue_end if available; silently back down + to entrypc probing if needed. + 2008-09-10 Josh Stone <joshua.i.stone@intel.com> * main.cxx (printscript): Ensure no variables are printed in probe lists @@ -5,6 +51,11 @@ 2008-09-10 Frank Ch. Eigler <fche@elastic.org> + * parse.cxx, parse.h: Rewrite scanner lookahead data structure + to a simple ~fixed vector. + +2008-09-10 Frank Ch. Eigler <fche@elastic.org> + PR6876: translator speedup for many $vars * session.h (systemtap_session.functions): vector->map. * coveragedb.cxx, elaborate.cxx, main.cxx, tapsets.cxx, translate.cxx: diff --git a/Makefile.am b/Makefile.am index c1bcd11e..1e356a4f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -100,14 +100,14 @@ staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\ runtime/staprun/ctl.c runtime/staprun/common.c staprun_CPPFLAGS = $(AM_CPPFLAGS) -staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED +staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED -fno-strict-aliasing staprun_LDADD = @PROCFLAGS@ stapio_SOURCES = runtime/staprun/stapio.c \ runtime/staprun/mainloop.c runtime/staprun/common.c \ runtime/staprun/ctl.c \ runtime/staprun/relay.c runtime/staprun/relay_old.c -stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) +stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -fno-strict-aliasing stapio_LDADD = @PROCFLAGS@ -lpthread install-exec-hook: diff --git a/Makefile.in b/Makefile.in index 08d82151..22336ec0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -292,14 +292,14 @@ staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\ runtime/staprun/ctl.c runtime/staprun/common.c staprun_CPPFLAGS = $(AM_CPPFLAGS) -staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED +staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED -fno-strict-aliasing staprun_LDADD = @PROCFLAGS@ stapio_SOURCES = runtime/staprun/stapio.c \ runtime/staprun/mainloop.c runtime/staprun/common.c \ runtime/staprun/ctl.c \ runtime/staprun/relay.c runtime/staprun/relay_old.c -stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) +stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -fno-strict-aliasing stapio_LDADD = @PROCFLAGS@ -lpthread loc2c_test_SOURCES = loc2c-test.c loc2c.c loc2c_test_CPPFLAGS = $(stap_CPPFLAGS) diff --git a/doc/Makefile.in b/doc/Makefile.in index aed03ee2..c003c742 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/elaborate.cxx b/elaborate.cxx index 552ef338..b476948b 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1147,6 +1147,8 @@ semantic_pass_symbols (systemtap_session& s) // Keep unread global variables for probe end value display. void add_global_var_display (systemtap_session& s) { + if (s.listing_mode) return; // avoid end probe in listings_mode + varuse_collecting_visitor vut; for (unsigned i=0; i<s.probes.size(); i++) { @@ -15,6 +15,7 @@ #include "util.h" #include <iostream> + #include <fstream> #include <cctype> #include <cstdlib> @@ -24,6 +25,8 @@ #include <sstream> #include <cstring> #include <cctype> +#include <iterator> + extern "C" { #include <fnmatch.h> } @@ -576,20 +579,23 @@ parser::peek_kw (std::string const & kw) lexer::lexer (istream& i, const string& in, systemtap_session& s): - input (i), input_name (in), cursor_suspend_count(0), + input (i), input_name (in), + input_pointer (0), cursor_suspend_count(0), cursor_line (1), cursor_column (1), session(s) -{ } +{ + char c; + while(input.get(c)) + input_contents.push_back(c); +} int lexer::input_peek (unsigned n) { - while (lookahead.size() <= n) - { - int c = input.get (); - lookahead.push_back (input ? c : -1); - } - return lookahead[n]; + if (input_contents.size() > (input_pointer + n)) + return (int)(unsigned char)input_contents[input_pointer+n]; + else + return -1; } @@ -597,7 +603,7 @@ int lexer::input_get () { int c = input_peek (0); - lookahead.erase (lookahead.begin ()); + input_pointer ++; if (c < 0) return c; // EOF @@ -617,6 +623,7 @@ lexer::input_get () cursor_column ++; } + // clog << "[" << (char)c << "]"; return c; } @@ -624,13 +631,9 @@ lexer::input_get () void lexer::input_put (const string& chars) { - // clog << "[put:" << chars << "]"; - for (int i=chars.size()-1; i>=0; i--) - { - int c = chars[i]; - lookahead.insert (lookahead.begin(), c); - cursor_suspend_count ++; - } + // clog << "[put:" << chars << " @" << input_pointer << "]"; + input_contents.insert (input_contents.begin() + input_pointer, chars.begin(), chars.end()); + cursor_suspend_count += chars.size(); } @@ -16,7 +16,7 @@ #include <iostream> #include <vector> #include <stdexcept> - +#include <stdint.h> struct source_loc { @@ -79,7 +79,8 @@ private: int input_peek (unsigned n=0); std::istream& input; std::string input_name; - std::vector<int> lookahead; + std::vector<char> input_contents; + int input_pointer; // index into input_contents unsigned cursor_suspend_count; unsigned cursor_line; unsigned cursor_column; diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 97b1a0c0..6ad7e51f 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,25 @@ +2008-09-12 Masami Hiramatsu <mhiramat@redhat.com> + + BZ 6028 + * regs-ia64.c (bspcache): Use REG_IP instead of pp to check probe + address. + +2008-09-12 David Smith <dsmith@redhat.com> + + BZ 6755 + * task_finder.c: Added 'inuse' count to know when handlers are still + running. + (__stp_utrace_task_finder_report_clone): If state isn't correct, + detach. Increase 'inuse' count when starting, decrement when + exiting. + (__stp_utrace_task_finder_report_exec): Ditto. + (__stp_utrace_task_finder_target_death): Ditto. + (__stp_utrace_task_finder_target_quiesce): Increase 'inuse' count + when starting, decrement when exiting. + (__stp_utrace_task_finder_target_syscall_entry): Ditto. + (__stp_utrace_task_finder_target_syscall_exit): Ditto. + (stap_stop_task_finder): Wait until all callbacks are finished. + 2008-09-10 Frank Ch. Eigler <fche@elastic.org> * runtime.h (STP_USE_FRAME_POINTER): Remove architecture #if's. diff --git a/runtime/regs-ia64.c b/runtime/regs-ia64.c index 8ce3e4c3..f884c5f8 100644 --- a/runtime/regs-ia64.c +++ b/runtime/regs-ia64.c @@ -39,10 +39,10 @@ static void ia64_stap_get_arbsp(struct unw_frame_info *info, void *arg) * bspcache: get cached unwound address and * set a probe local cache of the offset of unwound address. */ -#define bspcache(cache, regs, pp)\ +#define bspcache(cache, regs)\ if(regs) {\ static unsigned __offset = 0; /* probe local cache */\ - static const char * __pp = NULL; /* reference probe point */\ + static void * __ip = NULL; /* reference ip */\ unsigned long *bsp;\ asm volatile("{ flushrs }\n"); /* flushrs for fixing bsp */\ bsp = (void*)ia64_getreg(_IA64_REG_AR_BSP);\ @@ -53,10 +53,10 @@ static void ia64_stap_get_arbsp(struct unw_frame_info *info, void *arg) if (pa.address != 0) {\ __offset = ia64_rse_num_regs(pa.address, bsp)\ -(regs->cr_ifs & 127);\ - __pp = (const char *)pp;\ + __ip = (void *)REG_IP(regs);\ cache = pa.address;\ }\ - } else if (pp == __pp)\ + } else if ((void *)REG_IP(regs) == __ip)\ cache = ia64_rse_skip_regs(bsp,\ -(__offset + (regs->cr_ifs & 127)));\ } @@ -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__ */ diff --git a/runtime/task_finder.c b/runtime/task_finder.c index cbb10d35..493ca6f7 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -23,6 +23,10 @@ struct stap_task_finder_target; #define __STP_TF_STOPPING 2 #define __STP_TF_STOPPED 3 atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING); +atomic_t __stp_inuse_count = ATOMIC_INIT (0); + +#define __stp_tf_handler_start() (atomic_inc(&__stp_inuse_count)) +#define __stp_tf_handler_end() (atomic_dec(&__stp_inuse_count)) #ifdef DEBUG_TASK_FINDER atomic_t __stp_attach_count = ATOMIC_INIT (0); @@ -30,7 +34,9 @@ atomic_t __stp_attach_count = ATOMIC_INIT (0); #define debug_task_finder_attach() (atomic_inc(&__stp_attach_count)) #define debug_task_finder_detach() (atomic_dec(&__stp_attach_count)) #define debug_task_finder_report() (_stp_dbug(__FUNCTION__, __LINE__, \ - "attach count: %d\n", atomic_read(&__stp_attach_count))) + "attach count: %d, inuse count: %d\n", \ + atomic_read(&__stp_attach_count), \ + atomic_read(&__stp_inuse_count))) #else #define debug_task_finder_attach() /* empty */ #define debug_task_finder_detach() /* empty */ @@ -587,17 +593,24 @@ __stp_utrace_task_finder_report_clone(enum utrace_resume_action action, char *mmpath_buf; char *mmpath; - if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) - return UTRACE_RESUME; + if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) { + debug_task_finder_detach(); + return UTRACE_DETACH; + } + + __stp_tf_handler_start(); // On clone, attach to the child. rc = stap_utrace_attach(child, engine->ops, 0, __STP_TASK_FINDER_EVENTS); - if (rc != 0 && rc != EPERM) + if (rc != 0 && rc != EPERM) { + __stp_tf_handler_end(); return UTRACE_RESUME; + } __stp_utrace_attach_match_tsk(parent, child, 1, (clone_flags & CLONE_THREAD) == 0); + __stp_tf_handler_end(); return UTRACE_RESUME; } @@ -622,8 +635,12 @@ __stp_utrace_task_finder_report_exec(enum utrace_resume_action action, struct stap_task_finder_target *tgt; int found_node = 0; - if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) - return UTRACE_RESUME; + if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) { + debug_task_finder_detach(); + return UTRACE_DETACH; + } + + __stp_tf_handler_start(); // When exec'ing, we need to let callers detach from the // parent thread (if necessary). For instance, assume @@ -646,6 +663,7 @@ __stp_utrace_task_finder_report_exec(enum utrace_resume_action action, // relative. __stp_utrace_attach_match_tsk(tsk, tsk, 1, 1); + __stp_tf_handler_end(); return UTRACE_RESUME; } @@ -682,6 +700,7 @@ __stp_utrace_task_finder_target_death(struct utrace_attached_engine *engine, return UTRACE_DETACH; } + __stp_tf_handler_start(); // The first implementation of this added a // UTRACE_EVENT(DEATH) handler to // __stp_utrace_task_finder_ops. However, dead threads don't @@ -703,6 +722,7 @@ __stp_utrace_task_finder_target_death(struct utrace_attached_engine *engine, (int)tsk->pid, rc); } } + __stp_tf_handler_end(); debug_task_finder_detach(); return UTRACE_DETACH; } @@ -727,8 +747,12 @@ __stp_utrace_task_finder_target_quiesce(enum utrace_resume_action action, return UTRACE_DETACH; } - if (tgt == NULL) + if (tgt == NULL) { + debug_task_finder_detach(); return UTRACE_DETACH; + } + + __stp_tf_handler_start(); // Turn off quiesce handling rc = utrace_set_events(tsk, engine, @@ -807,6 +831,7 @@ __stp_utrace_task_finder_target_quiesce(enum utrace_resume_action action, } utftq_out: + __stp_tf_handler_end(); return UTRACE_RESUME; } @@ -865,6 +890,7 @@ __stp_utrace_task_finder_target_syscall_entry(enum utrace_resume_action action, && syscall_no != MUNMAP_SYSCALL_NO(tsk)) return UTRACE_RESUME; + __stp_tf_handler_start(); // We need the first syscall argument to see what address // we're operating on. @@ -889,6 +915,7 @@ __stp_utrace_task_finder_target_syscall_entry(enum utrace_resume_action action, mmput(mm); } } + __stp_tf_handler_end(); return UTRACE_RESUME; } @@ -1003,6 +1030,7 @@ __stp_utrace_task_finder_target_syscall_exit(enum utrace_resume_action action, : "UNKNOWN")))), arg0, rv); #endif + __stp_tf_handler_start(); // Try to find the vma info we might have saved. if (arg0 != (unsigned long)NULL) @@ -1110,6 +1138,7 @@ __stp_utrace_task_finder_target_syscall_exit(enum utrace_resume_action action, // Cleanup by deleting the saved vma info. __stp_tf_remove_vma_entry(entry); } + __stp_tf_handler_end(); return UTRACE_RESUME; } @@ -1232,12 +1261,30 @@ stap_start_task_finder(void) static void stap_stop_task_finder(void) { +#ifdef DEBUG_TASK_FINDER + int i = 0; +#endif + atomic_set(&__stp_task_finder_state, __STP_TF_STOPPING); debug_task_finder_report(); stap_utrace_detach_ops(&__stp_utrace_task_finder_ops); __stp_task_finder_cleanup(); debug_task_finder_report(); atomic_set(&__stp_task_finder_state, __STP_TF_STOPPED); + + /* Now that all the engines are detached, make sure + * all the callbacks are finished. If they aren't, we'll + * crash the kernel when the module is removed. */ + while (atomic_read(&__stp_inuse_count) != 0) { + schedule(); +#ifdef DEBUG_TASK_FINDER + i++; +#endif + } +#ifdef DEBUG_TASK_FINDER + if (i > 0) + printk(KERN_ERR "it took %d polling loops to quit.\n", i); +#endif } diff --git a/stap-client b/stap-client index f4ccb033..0ac9bd68 100755 --- a/stap-client +++ b/stap-client @@ -659,6 +659,12 @@ function staprun_PATH { # staprun may invoke 'stap'. So we can use the current PATH if we were # not invoked as 'stap' or we are not the first 'stap' on the PATH. local first_stap=`which stap 2>/dev/null` + + if test "X$first_stap" = "X"; then + echo "$PATH" + return + fi + if test `which $0 2>/dev/null` != $first_stap; then echo "$PATH" return diff --git a/stap-find-servers b/stap-find-servers index fea645bd..3038c54e 100755 --- a/stap-find-servers +++ b/stap-find-servers @@ -50,19 +50,27 @@ function match_server { local rc=1 # not found yet # Loop over the avahi service descriptors. - while read + read || exit $rc + while test "X$REPLY" != "X" do + server_name= + server_ip= + server_port= + server_sysinfo= + # Examine the next service descriptor # Is it a stap server? - (echo $REPLY | grep -q "^=.*_stap") || continue + if ! echo $REPLY | grep -q "=.* .* IPv4 .*_stap"; then + read || exit $rc + continue + fi + REPLY= # Get the details of the service - local service_tag equal data + local service_tag equal service_data while read service_tag equal service_data do case $service_tag in - '=' ) - break ;; hostname ) server_name=`expr "$service_data" : '\[\([^]]*\)\]'` ;; @@ -74,12 +82,12 @@ function match_server { local attempt for ((attempt=0; $attempt < 5; ++attempt)) do - server_ip=`expr "$server_ip" : '^\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)$'` + server_ip=`expr "$server_ip" : '\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)$'` if test "X$server_ip" != "X"; then break fi # Resolve the server.domain to an ip address. - server_ip=`avahi-resolve-host-name $hostname` + server_ip=`avahi-resolve-host-name $server_name` server_ip=`expr "$server_ip" : '.* \(.*\)$'` done ;; @@ -90,7 +98,9 @@ function match_server { server_sysinfo=`expr "$service_data" : '\[.*\"\(sysinfo=[^]]*\)\"\]'` ;; * ) - break ;; + REPLY="$service_tag $equal $service_data" + break + ;; esac done @@ -100,7 +110,7 @@ function match_server { fi # It's compatible, or we're finding all servers. Print a summary line - echo $server_name $server_ip $server_port "'$server_sysinfo'" + echo "$server_name $server_ip $server_port '$server_sysinfo'" rc=0 done diff --git a/stap-server.8.in b/stap-server.8.in index 9bfaa789..ffee8dfa 100644 --- a/stap-server.8.in +++ b/stap-server.8.in @@ -6,19 +6,19 @@ stap-server \- systemtap server and related utilities .SH SYNOPSIS .br -.B stap-start-server +.B stap\-start\-server .br -.B stap-find-servers +.B stap\-find\-servers [ -.B --all +.B \-\-all ] .br -.B stap-find-or-start-server +.B stap\-find\-or\-start\-server .br -.B stap-stop-server +.B stap\-stop\-server .I PID .br -.B stap-client +.B stap\-client [ .I ARGUMENTS ] @@ -26,17 +26,16 @@ stap-server \- systemtap server and related utilities .SH DESCRIPTION The systemtap server listens for connections from -.I stap-client +.I stap\-client on the local network and accepts requests to run the .I stap front end. .PP The -.I stap-start-server -program attempts to start a systemtap server ( -.I stap-serverd -) on the local host. Upon +.I stap\-start\-server +program attempts to start a systemtap server (\fIstap-serverd\fP) +on the local host. Upon successful startup, the server listens for connections on a random port and advertises its presence on the local network using the .I avahi @@ -45,71 +44,71 @@ echoed to stdout and the exit code is 0. Otherwise, nothing is echoed and the ex .PP The -.I stap-find-servers +.I stap\-find\-servers program attempts to find systemtap servers running on the local network. The details of any servers found are echoed to stdout. If servers are found, then the exit code is 0, otherwise it is 1. .PP The -.I stap-find-or-start-server +.I stap\-find\-or\-start\-server program attempts to find a compatible systemtap server running on the local network using -.I stap-find-servers. +.IR stap\-find\-servers . If a compatible server is found, -.I stap-find-or-start-server +.I stap\-find\-or\-start\-server echos '0' to stdout and the exit code is 0. Otherwise -.I stap-find-or-start-server +.I stap\-find\-or\-start\-server attempts to start a server on the local network using -.I stap-start-server. +.IR stap\-start\-server . If successful, the process id of the new server is echoed to stdout and the exit code is 0. If no server can be found or started, nothing is echoed to stdout and the exit code is 1. .PP The -.I stap-stop-server +.I stap\-stop\-server program verifies that the given process id is that of a running systemtap server on the local host and, if so, attempts to shut down the server by sending it the SIGTERM signal. If a process id is provided and it is that of a running systemtap server, the exit code is 0. Otherwise the exit code is 1. -.I stap-stop-server +.I stap\-stop\-server does not verify that the server actually shuts down. .PP The -.I stap-client +.I stap\-client program is analagous to the .I stap front end except that it attempts to find a compatible systemtap server on the local network and then attempts to use that server for actions related to passes 1 through 4. Pass 5 actions, if requested, are performed on the localhost using -.I staprun -. Upon successful completion, the exit code is 0. Otherwise the exit code +.IR staprun . +Upon successful completion, the exit code is 0. Otherwise the exit code is 1. .SH OPTIONS The -.I stap-find-servers +.I stap\-find\-servers program supports the following option. Any other option is ignored. .TP -.B \--all +.B \-\-all Instructs -.I stap-find-servers +.I stap\-find\-servers to report all systemtap servers on the local network regardless of compatibility. The default behavior is to report only servers which are compatible with systemtap on the local host. .SH ARGUMENTS The -.I stap-stop-server +.I stap\-stop\-server program requires a process id argument which identifies the server to be stopped. .PP The -.I stap-client +.I stap\-client program accepts the same arguments and options as the .I stap front end. @@ -120,33 +119,33 @@ See the manual page for a collection of sample scripts. .PP Here is a very basic example of how to use -.I stap-client. +.IR stap\-client . .PP To find out if a compatible systemtap server is running on your local network .PP -\& $ stap-find-servers +\& $ stap\-find\-servers .PP If no servers are reported, you can start one using .PP -\& $ stap-start-server +\& $ stap\-start\-server .PP You could also have accomplished both of the previous two steps using .PP -\& $ stap-find-or-start-server +\& $ stap\-find\-or\-start\-server .PP To compile and execute a simple example using the server .PP -\& $ stap-client \-e \[aq]probe begin { printf("Hello World!\\n"); exit() }\[aq] +\& $ stap\-client \-e \[aq]probe begin { printf("Hello World!\\n"); exit() }\[aq] .br \& Hello World! .PP If a process id was echoed by -.I stap-start-server +.I stap\-start\-server or -.I stap-find-or-start-server +.I stap\-find\-or\-start\-server then you can stop the server using .PP -\& $ stap-stop-server PID +\& $ stap\-stop\-server PID .PP where PID is the process id that was echoed. 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 diff --git a/systemtap.spec b/systemtap.spec index 4a7d2b4a..1a967cf1 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -81,7 +81,7 @@ Group: Development/System License: GPLv2+ URL: http://sourceware.org/systemtap/ Requires: systemtap-runtime = %{version}-%{release} -Requires: avahi-tools nc mktemp +Requires: avahi avahi-tools nc mktemp %description client SystemTap client is the client component of an instrumentation @@ -94,7 +94,7 @@ Group: Development/System License: GPLv2+ URL: http://sourceware.org/systemtap/ Requires: systemtap -Requires: avahi-tools nc net-tools mktemp +Requires: avahi avahi-tools nc net-tools mktemp %description server SystemTap server is the server component of an instrumentation diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 3e2ebaf7..97801a20 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,7 @@ +2008-09-12 Wenji Huang <wenji.huang@oracle.com> + + * signal.stp: Initialize __sig in a function. + 2008-09-09 Masami Hiramatsu <mhiramat@redhat.com> * utrace.stp: Added _utrace_syscall_return(). diff --git a/tapset/signal.stp b/tapset/signal.stp index 1128e6fb..66de767e 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -103,14 +103,14 @@ probe signal.send.return = _signal.send.*.return retstr = returnstr(1) } -/* +/* * Return values for "__group_send_sig_info" and "specific_send_sig_info" * - * - return 0 if the signal is sucessfully sent to a process, + * - return 0 if the signal is sucessfully sent to a process, * which means the following: * <1> the signal is ignored by receiving process * <2> this is a non-RT signal and we already have one queued - * <3> the signal is successfully added into the sigqueue of + * <3> the signal is successfully added into the sigqueue of * receiving process * * - return -EAGAIN if the sigqueue is overflow the signal was RT @@ -133,7 +133,7 @@ probe _signal.send.part4.return = kernel.function("specific_send_sig_info").retu %( kernel_v <= "2.6.25" %? /* - * - return 0 if the signal is either sucessfully added into the + * - return 0 if the signal is either sucessfully added into the * sigqueue of receiving process or a SI_TIMER entry is already * queued so just increment the overrun count * @@ -149,7 +149,7 @@ probe _signal.send.part2.return = kernel.function("send_group_sigqueue").return %) /* - * - return 0 if the signal is either sucessfully added into the + * - return 0 if the signal is either sucessfully added into the * sigqueue of receiving process or a SI_TIMER entry is already * queued so just increment the overrun count * @@ -189,14 +189,14 @@ probe signal.checkperm = kernel.function("check_kill_permission") si_code="SI_KERNEL (SIGFPE, SIGSEGV, SIGTRAP, SIGCHLD, SIGPOLL)" else if (sinfo <= 0) si_code="SI_USER or SI_TIMER or SI_ASYNCIO" -} +} probe signal.checkperm.return = kernel.function("check_kill_permission").return { name = "signal.checkperm" retstr = returnstr(1) } - + /* probe signal.wakeup * @@ -205,10 +205,10 @@ probe signal.checkperm.return = kernel.function("check_kill_permission").return * Argument: * sig_pid: pid of the process to be woke up * pid_name: name of the process to be woke up - * resume: indicate whether to wake up a task in STOPPED or + * resume: indicate whether to wake up a task in STOPPED or TRACED state - * state_mask: a string representation indicates the mask - * of task states that can be woken + * state_mask: a string representation indicates the mask + * of task states that can be woken */ probe signal.wakeup = kernel.function("signal_wake_up") { @@ -246,7 +246,7 @@ probe signal.check_ignored.return = kernel.function("sig_ignored").return ? /* probe signal.handle_stop * * For now, just comment it out since at the time handle_stop_signal() - * is called, it doesn't know whether current signal is STOP/COUNT. + * is called, it doesn't know whether current signal is STOP/COUNT. * So the calling of handle_stop_signal() doesn't mean that the Kernel * is now processing the STOP/COUNT signal * @@ -367,7 +367,7 @@ probe signal.send_sig_queue.return = /* probe signal.pending * - * Used to examine the set of signals that are pending for + * Used to examine the set of signals that are pending for * delivery to the calling thread * * long do_sigpending(void __user *set, unsigned long sigsetsize) @@ -395,8 +395,8 @@ probe signal.pending.return = kernel.function("do_sigpending").return * sinfo : address of siginfo table. * ka_addr : Address of the k_sigaction table associated with the signal * oldset_addr : Address of a bit mask array of blocked signals - * regs : Address in the Kernel Mode stack area - * + * regs : Address in the Kernel Mode stack area + * */ probe signal.handle = kernel.function("handle_signal") { @@ -409,7 +409,7 @@ probe signal.handle = kernel.function("handle_signal") regs = $regs // Check whether the signal is a User Mode or Kernel mode Signal. - + if (sinfo == 0 && sig_code <= 0) sig_mode = "User Mode Signal" else if (sinfo >= 1) @@ -506,7 +506,7 @@ probe signal.procmask.return = kernel.function("sigprocmask").return /* * probe signal.flush - * + * * Flush all pending signals for a task. * * void flush_signals(struct task_struct *t) @@ -517,16 +517,16 @@ probe signal.flush = kernel.function("flush_signals") task = $t sig_pid = $t->pid pid_name = kernel_string($t->comm) -} +} function get_sa_flags:long (act:long) %{ /* pure */ - struct k_sigaction *act = (struct k_sigaction *)((long)THIS->act); + struct k_sigaction *act = (struct k_sigaction *)((long)THIS->act); THIS->__retvalue = kread(&act->sa.sa_flags); CATCH_DEREF_FAULT(); %} function get_sa_handler:long (act:long) %{ /* pure */ - struct k_sigaction *act = (struct k_sigaction *)((long)THIS->act); + struct k_sigaction *act = (struct k_sigaction *)((long)THIS->act); THIS->__retvalue = (long)kread(&act->sa.sa_handler); CATCH_DEREF_FAULT(); %} @@ -608,13 +608,10 @@ function sa_handler_str(handler) { /* * Signals start from 1 not 0. */ -function signal_str(num) { - return __sig[num] -} - global __sig[64] -probe begin(-1) { +function signal_str(num) { + if (!(64 in __sig)) { __sig[1] = "HUP" __sig[2] = "INT" __sig[3] = "QUIT" @@ -679,4 +676,6 @@ probe begin(-1) { __sig[62] = "RTMIN+30" __sig[63] = "RTMIN+31" __sig[64] = "RTMIN+32" + } + return __sig[num] } diff --git a/tapsets.cxx b/tapsets.cxx index 308cef1f..85505084 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3458,13 +3458,8 @@ query_func_info (Dwarf_Addr entrypc, } else { - if (q->sess.prologue_searching - && !q->has_statement_str && !q->has_statement_num - && !q->sess.ignore_vmlinux && !q->sess.ignore_dwarf) // PR 2608 + if (fi.prologue_end != 0) { - if (fi.prologue_end == 0) - throw semantic_error("could not find prologue-end " - "for probed function '" + fi.name + "'"); query_statement (fi.name, fi.decl_file, fi.decl_line, &fi.die, fi.prologue_end, q); } @@ -3718,7 +3713,7 @@ query_cu (Dwarf_Die * cudie, void * arg) if (rc != DWARF_CB_OK) q->query_done = true; - if (q->sess.prologue_searching + if ((q->sess.prologue_searching || q->has_process) // PR 6871 && !q->has_statement_str && !q->has_statement_num) // PR 2608 if (! q->filtered_functions.empty()) q->dw.resolve_prologue_endings (q->filtered_functions); @@ -4752,7 +4747,7 @@ void dwarf_derived_probe::emit_probe_local_init(translator_output * o) { // emit bsp cache setup - o->newline() << "bspcache(c->unwaddr, c->regs, c->probe_point);"; + o->newline() << "bspcache(c->unwaddr, c->regs);"; } // ------------------------------------------------------------------------ @@ -5932,7 +5927,7 @@ void utrace_var_expanding_copy_visitor::visit_target_symbol_arg (target_symbol* e) { string argnum_s = e->base_name.substr(4,e->base_name.length()-4); - int argnum = atoi (argnum_s.c_str()); + int argnum = lex_cast<int>(argnum_s); if (flags != UDPF_SYSCALL) throw semantic_error ("only \"process(PATH_OR_PID).syscall\" support $argN.", e->tok); diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 288705b1..bc8af108 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,17 @@ +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. + +2008-09-11 Frank Ch. Eigler <fche@elastic.org> + + PR 6871. + * systemtap.base/uprobes.*: Energize. + 2008-09-10 Josh Stone <joshua.i.stone@intel.com> * systemtap.base/probe_list.exp: New test for correct probe listing. diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp index c0027e95..a4beaa12 100644 --- a/testsuite/lib/stap_run.exp +++ b/testsuite/lib/stap_run.exp @@ -34,6 +34,7 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args } expect { -timeout 180 -re {^WARNING: cannot find module [^\r]*DWARF[^\r]*\r\n} {exp_continue} + -re {^WARNING: No unwind data for /.+\r\n} {exp_continue} -re {^Pass\ ([1234]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms\.\r\n} {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)"; exp_continue} -re {^Pass\ ([34]): using cached [^\r]+\r\n} diff --git a/testsuite/systemtap.base/optim_arridx.exp b/testsuite/systemtap.base/optim_arridx.exp index 89282d1b..bef4d2b4 100644 --- a/testsuite/systemtap.base/optim_arridx.exp +++ b/testsuite/systemtap.base/optim_arridx.exp @@ -9,15 +9,15 @@ elide_idx1:long elide_global_a:long elide_global_b:long # functions -fna:long (a:long) -return a -fnb:long (a:long, b:long) -return (a) + (b) exit:unknown () %{ atomic_set (&session_state, STAP_SESSION_STOPPING); _stp_exit (); %} +fna:long (a:long) +return a +fnb:long (a:long, b:long) +return (a) + (b) # probes begin /* <- begin */ # locals diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index 8fbe6da6..391f5028 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -8,6 +8,7 @@ set fp [open $path "w"] puts $fp "int main (int argc, char *argv[])" puts $fp "{" puts $fp "if (argc > 1) main (argc - 1, argv);" +puts $fp "return 0;" puts $fp "}" close $fp @@ -30,8 +31,8 @@ expect { -re {^Disabling[^\r\n]*\r\n} { exp_continue } -re {^Uprobes[^\r\n]*\r\n} { exp_continue } -re {^Cache[^\r\n]*\r\n} { exp_continue } - -re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*call\r\n} { incr ok; exp_continue } - -re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*return\r\n} { incr ok; exp_continue } + -re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*call argc=0x[1-5][^\r\n]*\r\n} { incr ok; exp_continue } + -re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*return return=0x0[^\r\n]*\r\n} { incr ok; exp_continue } -timeout 30 timeout { } eof { } diff --git a/testsuite/systemtap.base/uprobes.stp b/testsuite/systemtap.base/uprobes.stp index 8e7dbe9d..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/translate.cxx b/translate.cxx index 64308fe3..e92c8483 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4517,8 +4517,13 @@ dump_unwindsyms (Dwfl_Module *m, } else { + // There would be only a small benefit to warning. A user + // likely can't do anything about this; backtraces for the + // affected module would just get all icky heuristicy. +#if 0 c->session.print_warning ("No unwind data for " + modname + ", " + dwfl_errmsg (-1)); +#endif } for (unsigned secidx = 0; secidx < seclist.size(); secidx++) |