David Smith [Tue, 3 Nov 2009 17:04:35 +0000 (11:04 -0600)]
PR 10706 fixed by switching to unbuffered output.
* runtime/staprun/mainloop.c (stp_main_loop): Switched to unbuffered
output (instead of line buffered output).
Breno Leitao [Tue, 3 Nov 2009 16:24:03 +0000 (14:24 -0200)]
I forgot to change the NEWS file when commiting 249534c041971db5e9f89cb11b6d38d311e91f57, and this commit
just adds a line in the NEWS file explaining the commmit above
David Smith [Mon, 2 Nov 2009 18:51:12 +0000 (12:51 -0600)]
PR 6691 fixed by adding support for sys_accept4.
* tapset/aux_syscalls.stp(_sock_type_str): Rewrote in embedded-C and added
socket flags support.
(_sock_flags_str): New function.
* tapset/syscalls.stp: syscall.accept prefers to use sys_accept4 when it
exists. Added support for sys_accept4's 'flag' parameter.
* testsuite/systemtap.syscall/net1.c (main): Updated regular expression to
handle the new 'flags' argument.
Frank Ch. Eigler [Sat, 31 Oct 2009 17:54:41 +0000 (13:54 -0400)]
reorganize app tests; rewrite tcl as sample of improvements
* testsuite/configure.ac (--enable-testapps): New option.
* testsuite/Makefile.am (TESTAPPS): Pass to dejagnu.
* testsuite/systemtap.base/{xulrunner,tcl,mysql,postgres}:
Moved under new systemtap.apps/ subdirectory.
* testsuite/systemtap.apps/stap-tcl.sh: New file to build tcl.
* testsuite/systemtap.apps/stap-tcl.stp: New file to test tcl.
* testsuite/systemtap.apps/tcl.exp: New simplified test driver.
* dtrace.in: Disable STAP_HAS_SEMAPHORES as they don't work on shlibs yet.
* includes/sys/sdt.h (STAP_SEMAPHORE): Include __builtin_expect for unlikely.
David Smith [Thu, 29 Oct 2009 21:12:18 +0000 (16:12 -0500)]
Fix syscall testsuite bugs.
* testsuite/systemtap.syscall/test.tcl: Substitute '[[[[' and ']]]]' for
'(' and ')'. This allows us to get unquoted parens.
* testsuite/systemtap.syscall/test-debug.tcl: Matches substitute logic of
test.tcl.
* testsuite/systemtap.syscall/README: Document '[[[[' and ']]]]'.
* testsuite/systemtap.syscall/chmod.c: Handle optional O_LARGEFILE flag in
open calls.
* testsuite/systemtap.syscall/dir.c: Ditto.
* testsuite/systemtap.syscall/mmap.c: Ditto.
* testsuite/systemtap.syscall/openclose.c: Ditto.
* testsuite/systemtap.syscall/readwrite.c: Ditto.
* testsuite/systemtap.syscall/stat.c: Ditto.
Josh Stone [Tue, 27 Oct 2009 19:15:29 +0000 (12:15 -0700)]
PR10854: Use a mutex around transport startup/shutdown
We had a race where the probe setup could be called during/after the
probe shutdown in abnormal circumstances, which leads to kernel
callbacks still registered after module unload. (BOOM)
Now the setup/shutdown activities and related flags are guarded by a
mutex, so we should have strict ordering.
* runtime/transport/transport.c (_stp_transport_mutex): New.
(_stp_handle_start): Grab the mutex, and make sure we're not exiting.
(_stp_cleanup_and_exit): Grab the mutex.
(_stp_lock_inode, _stp_unlock_inode): Use kernel version for checking
inode locking type.
Tim Moore [Tue, 27 Oct 2009 11:50:25 +0000 (12:50 +0100)]
Kill off child processes correctly on exit.
* grapher/grapher.cxx (ChildDeathReader::reap): New function.
(StapLauncher): Keep a list of instantiated parsers.
(StapLauncher::cleanup): Kill off all launched stap processes.
Tim Moore [Wed, 21 Oct 2009 15:05:59 +0000 (17:05 +0200)]
More refactoring for multiple stap processes.
* grapher/StapParser.hxx (StapParser): Change _win and _widget from
references to pointers.
* grapher/StapParser.cxx (ioCallback): Ditto.
* grapher/grapher.cxx (StapLauncher, GraphicalStapLauncher): Rewrite
to make GraphicalStapLauncher a derived class of StapLauncher.
(main): Accept graphing data from stdin with a "-" argument.
Tim Moore [Tue, 20 Oct 2009 20:14:00 +0000 (22:14 +0200)]
Change stap parser to use an input file descriptor other than stdin
* grapher/StapParser.hxx (_inFd, getInFd, setInFd): new member and fuctions
* grapher/StapParser.cxx (ioCallback): Use _inFd variable
instead of stdin.
* grapher/grapher.cxx (StapLauncher::launch): Don't read input from stap on
stdin; use the the read end of the pipe.
Josh Stone [Thu, 22 Oct 2009 21:37:05 +0000 (14:37 -0700)]
Enable Kbuild-like quiet builds
This enables much cleaner build output from automake. To re-enable the
verbose commands, pass --disable-silent-rules to configure, or use V=1
at make time.
* configure.ac: Enable AM_SILENT_RULES by default.
Josh Stone [Thu, 22 Oct 2009 02:27:17 +0000 (19:27 -0700)]
Correct the safety-net escape WRT locking
Within a probe body, the "out" label starts the normal exit path,
including unlocking whatever globals are used in that probe. Since the
unprivileged safety-net checks are before the locks are ever grabbed, we
should bypass the unlock on the way out.
* elaborate.cxx (derived_probe::emit_process_owner_assertion): Use
"return" instead of "goto out".
Josh Stone [Wed, 21 Oct 2009 23:15:58 +0000 (16:15 -0700)]
Refactor probe locking into shared functions
For scripts with thousands of probes, we save a fair amount of code-gen
time in pass-4 by having the common locking code extracted into shared
functions.
* runtime/probe_lock.h (stp_lock_probe, stp_unlock_probe): New.
* translate.cxx (c_unparser::emit_lock_decls): New, emits a static
const array of locks needed for each probe.
(c_unparser::emit_locks): Just call stp_lock_probe.
(c_unparser::emit_unlocks): Just call stp_unlock_probe.
Josh Stone [Sat, 10 Oct 2009 00:32:26 +0000 (17:32 -0700)]
PR10750: Enforce a reasonable limit on # of varargs
If we leave the number of args unbounded, then an excessively-sized
printf could cause a kernel stack overflow. I've arbitrarily chosen 32
as our new maximum.
* translate.cxx (c_unparser::visit_print_format): Throw if >32 args.
* testsuite/transko/varargs.stp: Assert that 33 args aren't allowed.
* testsuite/transok/varargs.stp: Assert that 32 args are ok.
Stan Cox [Tue, 20 Oct 2009 17:42:01 +0000 (13:42 -0400)]
Added testsuite to test xulrunner sdt markers.
xulrunner.exp: New testsuite, modelled after mysql.exp.
mysql.exp (stap-mysql.sh): Use installed stap.
postgres.exp (stap-mysql.sh): Use installed stap.
tcl.exp (stap-mysql.sh): Use installed stap.
Mark Wielaard [Tue, 20 Oct 2009 11:55:15 +0000 (13:55 +0200)]
Be paranoid about table size resolving cie_for_fde and fde_pointer_type.
* runtime/unwind.c (cie_for_fde): Take table and table_len into account.
(fde_pointer_type): Likewise.
* runtime/unwind/unwind.h: Adjust function prototypes.
Frank Ch. Eigler [Mon, 19 Oct 2009 15:33:24 +0000 (11:33 -0400)]
PR10799: warn on possibly uintended local-vs-global namespace collision
* elaborate.cxx (find_var): Take extra token parameter.
Look for cross-file global variable resolution, signal
a warning.
* testsuite/systemtap.examples/io/traceio2.stp: Fix it.
* testsuite/systemtap.syscall/sys.stp: Fix it.
* NEWS: Document it.
uprobe_fork_uproc() runs with parent_uproc->rwsem locked.
However uprobe_mk_process() that gets called within uprobe_fork_uproc()
also locks child_uproc->rwsem after initializing it.
Lockdep report confuses this to acquiring a lock that already has been
acquired and suggests using sub-classes.
The alternatives we have are:
1. use classes level to distinguish different uproc structures.
2. unlock parent_uproc->rwsem before we call uprobe_fork_uproc().
3. dont try locking child_uproc->rwsem; since we are protected by
uproc_mutex as well as parent_uproc->rwsem;
Mark Wielaard [Thu, 15 Oct 2009 19:55:16 +0000 (21:55 +0200)]
Fix transok/tval-opt.stp testcase. Pick diffent function and non-empty block.
This testcase succeeded just because the value being set couldn't be
found. So the error message being compared was the same. Set -o pipefail
to catch that case. On vta compiled kernels it failed because the optimizer
turned { statement } into statement. So pick a function and argument which
location can always be found and add an extra 'next' statement so the
block isn't folded.
* testsuite/transok/tval-opt.stp: Set -o pipefail. Add 'next' to make
sure block isn't empty. Use "do_filp_open" and "mode".
Josh Stone [Wed, 14 Oct 2009 23:12:49 +0000 (16:12 -0700)]
Fix $$targets in dwarf probes
My print_format refactoring in d5e178c1 missed an improperly-named
token, an sprint that should be sprintf. Since the token value is now
significant, that name needs to be correct.
Frank Ch. Eigler [Wed, 14 Oct 2009 21:02:47 +0000 (17:02 -0400)]
PR10331: improve nss error message handling
* stapsslerr.h: New file containing NSS* error number to string mappings.
Originally from mozilla NSS documentation, also seen in other GPLv2
software.
* nsscommon.c (nssError): Print error number, and text from <stapsslerr.h>.
* stap-{client,server}-connect.c (errWarn): Standardize on nssError().
* Makefile.am (nss binaries): Also link in nsscommon.c.
Tim Moore [Wed, 14 Oct 2009 15:46:31 +0000 (17:46 +0200)]
cleanup of graph data parser, using Boost functions where useful
* grapher/StapParser.cxx (commaSplit): Use Boost string split function
(findTaggedValue): Return bool instead of position
(ioCallback): Avoid using hard-coded string lengths
Josh Stone [Tue, 13 Oct 2009 23:57:38 +0000 (16:57 -0700)]
Consolidate print_format creation
We almost had a factory in print_format::parse_print, so let's take that
the rest of the way. This way we don't have so much duplication in
initializing the print flags.
* staptree.cxx (print_format::parse_print): Replaced with...
(print_format::create): New factory to parse and create print_formats.
* elaborate.cxx (add_global_var_display): Use this factory.
* parse.cxx (parser::parse_symbol): Ditto.
* tapset-mark.cxx
(mark_var_expanding_visitor::visit_target_symbol_context): Ditto.
* tapset-utrace.cxx
(utrace_var_expanding_visitor::visit_target_symbol_arg): Ditto.
* tapsets.cxx
(dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_context) Ditto.
* transport/control.c (*_cmd): Return -Ecodes rather than "-1" from
file_operations callbacks.
* staprun/ctl.c (init_ctl_channel): Return distinct error codes.
* staprun/staprun.c (remove_module): Skip connection attempt to .ctl
file; just do delete_module() with O_NONBLOCK.
Josh Stone [Tue, 13 Oct 2009 21:10:08 +0000 (14:10 -0700)]
Refactor some of the histogram printing
* runtime/stat-common.c (reprint_buf): Removed.
(_stp_stat_print_histogram_buf): Use a local HIST_PRINTF macro to
abstract the buffer management. Also convert reprint_buf calls to
either %* formats or simple for-loops.
* parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
* runtime/stat-common.c: Replace reprint with new reprint_buf, add more
generic _stp_stat_print_histogram_buf and call it from the older one.
Also correct some formatting issues.
* translate.cxx (c_unparser::visit_print_format): Add sprint case.
Use proper $vars according to CONFIG_NFSD and CONFIG_COMPAT in
syscall.nfsservctl and mask it out along with return probe if
CONFIG_NFSD != "[ym]" && CONFIG_COMPAT != "y".
* tapset/syscalls2.stp (syscall.nfsservctl): Fix it.
David Smith [Tue, 13 Oct 2009 13:55:57 +0000 (08:55 -0500)]
PR 10575. Improves running target commands.
* runtime/staprun/mainloop.c (signal_usr1): Renamed from signal_dontcare.
Sets a new variable, usr1_interrupt.
(start_cmd): Avoids pause() race condition by switching to blocking
SIGUSR1, then waiting on SIGUSR1 with sigsuspend().