Mark Wielaard [Mon, 16 Nov 2009 20:41:13 +0000 (21:41 +0100)]
Add testcase for retrieving $global vars from execs and shared libs.
Explicit testcase for PR10010 and PR10622.
* testsuite/systemtap.base/externalvar.c: New file.
* testsuite/systemtap.base/externalvar.exp: New file.
* testsuite/systemtap.base/externalvar.stp: New file.
* testsuite/systemtap.base/externalvar_lib.c: New file.
Mark Wielaard [Mon, 16 Nov 2009 20:34:00 +0000 (21:34 +0100)]
PR10010 Support $globals in shared libraries.
* dwflpp.cxx (dwflpp::emit_address): Enable task finder and emit a
_stp_module_relocate for the ".dynamic" section when seeing a
user-space dso address.
* runtime/sym.c (_stp_mod_sec_lookup): Remove .dynamic section addr cheat.
(_stp_tf_mmap_cb): Add cheat here.
David Smith [Mon, 16 Nov 2009 18:58:46 +0000 (12:58 -0600)]
PR 5150 partial fix. Support nfs_write_begin()/nfs_write_end().
* tapset/nfs.stp: Added support for nfs_write_begin()/nfs_write_end(),
which replaced nfs_prepare_write()/nfs_commit_write().
Mark Wielaard [Mon, 16 Nov 2009 09:02:50 +0000 (10:02 +0100)]
PR10622 Search for extern $variables in symbol table.
* dwflpp.h (vardie_from_symtable): New method.
* dwflpp.cxx (vardie_from_symtable): New method.
(literal_stmt_for_local): Use vardie_from_symtable when no location
attribute and DW_AT_external.
* testsuite/buildok/xtime.stp: New testcase from PR10622.
Mark Wielaard [Fri, 13 Nov 2009 12:39:24 +0000 (13:39 +0100)]
Accept relative user module paths for -d.
When using relative (non-canonical) paths for user modules one would get
a confusing WARNING: missing unwind/symbol data for module 'bin/test'.
Also unless the path started with '/' the task_finder wouldn't start.
By checking that the given file can be made absolute (canonicalized)
both issues are resolved and the user module will be correctly identified
at both translation and runtime.
* main.cxx (main): case 'd' try canonicalize_file_name() the argument
first to identify user modules.
Josh Stone [Wed, 11 Nov 2009 02:37:02 +0000 (18:37 -0800)]
PR5916: Exploit kretprobe data storage area
Since 2.6.25, kretprobes can carry a data packet to be filled in an
entry_handler. This patch lets us store our implicitly-saved $target
variables in .return probes in that data area.
* tapset/kretprobe.stp: New get/set functions for kretprobe data.
* translate.cxx (c_unparser::emit_common_header): Add context->pi_longs.
* tapsets.cxx
(dwarf_var_expanding_visitor::visit_target_symbol_saved_return): Switch
between the old and new methods of saving $vars in .return probes.
(dwarf_var_expanding_visitor::gen_mapped_saved_return): The old way.
(dwarf_var_expanding_visitor::gen_kretprobe_saved_return): The new way.
(dwarf_derived_probe::join_group): Don't register paired entry-handlers.
(dwarf_derived_probe::dwarf_derived_probe): Remember saved-var details.
(dwarf_derived_probe_group::emit_module_decls): Output saved-var details.
Also split the kretprobe handler whether we're on entry or return.
(dwarf_derived_probe_group::emit_module_init): Prepare the entry handler.
* testsuite/systemtap.base/kretprobe-vars.stp: Test implicit $var saving.
Dave Brolley [Mon, 9 Nov 2009 19:50:52 +0000 (14:50 -0500)]
Don't reference global variable modpath in insert_module and its helpers.
This allows insert_module to to be used for loading the signed uprobes.ko
module.
Allow the use of $$parms and $$return in uprobes based probes for
unprivileged users.
Re-add management of module signatures in the cache. Don't know why
it was removed.
Mark Wielaard [Sun, 8 Nov 2009 21:03:31 +0000 (22:03 +0100)]
PR10923 Handle AT_frame_base given by DW_OP_call_frame_cfa in .debug_frame.
dwarf_cfi_addrframe should not be called with pc adjusted to the bias
of the dwfl_module_dwarf_cfi or dwfl_module_eh_cfi. This just happened to
work in the .eh_frame case because bias was always zero.
* dwflpp.cxx (get_cfa_ops): Don't adjust pc for bias.
Josh Stone [Sat, 7 Nov 2009 00:01:10 +0000 (16:01 -0800)]
Constrain $var-checking for -L of .return probes
Normally, using a $var in a return probe create a matching entry probe
to save the value. We don't want all this machinery though when we're
just checking the accessibility of a $var for -L mode.
* tapsets.cxx (dwarf_derived_probe::saveargs): Save/restore has_return
while the $var accesses are attempted.
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.