Lukas Berk [Fri, 31 May 2013 15:33:03 +0000 (11:33 -0400)]
Adjust stapbm.in and docs to avoid recurssion
*NEWS: added news blurb
*java/stapbm.in: due to change in tapset-method.cxx and only probing
probe begin, we're able to remove java recursion gaurds
and simply
*main/stapprobes.3stap: update docs reflecting requirement of jvm pid's
to be prexisting and if a string is passed for
process name, it needs to be listed in a jps -l
invocation
*tapset-method.cxx: switch process("java").begin probe to probe begin
in order to avoid recurssion due to byteman operations
David Smith [Fri, 31 May 2013 14:05:23 +0000 (09:05 -0500)]
Fixed BZ920444 by using macros to handle nfs parameter changes.
* tapset/linux/nfs_proc.stpm: New file.
* tapset/linux/nfs_proc.stp: Remove __i2n_ip_proto(),
__nfs_read_data_info(), and __nfs_write_data_info() functions. Callers
of those functions now use new macros in nfs_proc.stpm. The advantage
the macros have, besides clarity, is that they preserve type
information. Kernel commit 0b7c01533aa9f4a228d07d2768d084acb3a387bc
changed the commit functions to take a nfs_commit_data structure instead
of a nfs_write_data_structure. Because functions lose type information,
systemtap didn't notice this change.
Josh Stone [Wed, 29 May 2013 20:52:58 +0000 (13:52 -0700)]
Double-check DW_AT_comp_dir before we try to use it
In building tracepoints, we try a late search for the kernel source tree
using DW_AT_comp_dir, and add extra includes based on that path. That
comp_dir is not always reliable though; for instance, Ubuntu leaves it
something like "/build/buildd/linux...", which is not an installed path.
(See also http://brainstorm.ubuntu.com/idea/11327)
* tapsets.cxx (tracepoint_builder::init_dw): Verify that the given
DW_AT_comp_dir actually exists before we use it.
Josh Stone [Wed, 29 May 2013 19:53:59 +0000 (12:53 -0700)]
Remove redundant assert_is_myproc from utf functions
* tapset/uconversions.stp (user_string_utf16, user_string_utf32): These
are marked "/* myproc-unprivileged */", so the translator will insert
the necessary assert_is_myproc() already. Having a redundant check
doesn't actually hurt, except it adds confusion by implying that other
similar functions are in error for not having this too.
David Smith [Tue, 28 May 2013 21:42:03 +0000 (16:42 -0500)]
Fix PR15543 by fixing the 'servername' convenience variables in the rpc tapset.
* tapset/linux/rpc.stp: Handle kernel change that moves the 'cl_server'
field of the 'rpc_clnt' structure into the 'rpc_xprt' structure.
* tapset/linux/rcu.stp: New file.
Raphaël Beamonte [Tue, 28 May 2013 01:45:55 +0000 (21:45 -0400)]
Remove a direct include of rwlock.h which fail on a kernel with the RT patches
The file linux/rwlock.h should not be included directly as stated by
an #error message at the 5th line of the file. With a RT patched
kernel, linux/rwlock_rt.h should be included instead of linux/rwlock.h.
The file linux/spinlock.h already do the proper check. We then should
let the include be done by this file.
Jonathan Lebon [Mon, 27 May 2013 20:43:20 +0000 (16:43 -0400)]
PR14440: made usage of pfiles.stp and plimit.stp more consistent
Added support for plimit.stp to accept a target PID through both -x and
$1, just like in pfiles.stp. Also removed the //bin/true hack from
pfiles.stp and '#!/usr/bin/env stap' from plimit.stp so that both of
them must be run using stap -g.
Lukas Berk [Mon, 27 May 2013 18:35:10 +0000 (14:35 -0400)]
Add xvfb-run workaround for docs generation
*configure.ac: add AC_PROG_CHECK for xvfb-run
*doc/beginners/Makefile.am: exec xvfb-run -a publican ...
*systemtap.spec: add buildrequires line for building stap
Jonathan Lebon [Mon, 27 May 2013 15:00:01 +0000 (11:00 -0400)]
PR15525: removed duplicate O_CLOEXEC flag check
The O_CLOEXEC flag was being checked twice, which caused it to be
printed out twice in the flag string when present. The duplication
was removed and the flags were put back in alphabetical order (same
order as in `man 2 open`) to ensure this does not happen again.
Lukas Berk [Mon, 27 May 2013 14:09:04 +0000 (10:09 -0400)]
Change use of jps to ps and stop bmsubmit recursion issue
*java/stapbm.in: we can make use of ps instead of jps as the java
name we're looking for is also passed as an argument
to java and this avoids starting another java proc
also add a lockfile to bmsubmit via rulename to stop
further recursion
Jonathan Lebon [Fri, 24 May 2013 14:33:06 +0000 (10:33 -0400)]
traceio.stp example: check for negative $return
The I/O reads and writes should only be counted when $return is
nonnegative. A negative $result occurs if an error was met (e.g.
EAGAIN = -11).
We could have instead here used the bytes_read/written variables
provided by the tapset, but this example demonstrates the use of
local vars and is also consistent with the disktop.stp example.
Josh Stone [Wed, 22 May 2013 23:17:30 +0000 (16:17 -0700)]
stapdyn: Restrict visibility in generated modules
We only want to expose a few specific functions, per stapdyn.h, and we
also want our internal use of those to be bound internally. This is
accomplished by "-fvisibility=hidden", and then setting visibility to
"protected" by #pragma just for stapdyn.h.
Josh Stone [Wed, 22 May 2013 23:14:18 +0000 (16:14 -0700)]
stapdyn: separate enter_dyninst_uprobe_regs
That function calls enter_dyninst_uprobe, which is only defined when
uprobes are active, so we have a weak binding in place. By instead
splitting this into a new file, which is only included when uprobes are
known to be active, it doesn't need the weak reference.
Josh Stone [Wed, 22 May 2013 21:16:42 +0000 (14:16 -0700)]
stapdyn: isolate the tls context pointer more
* runtime/dyninst/runtime_context.h: Rename contexts to tls_context to
better indicate the purpose of this pointer; update everywhere.
(_stp_runtime_entryfn_put_context): Take a pointer argument for the
context you're releasing, to slightly help prevent coding accidents.
* runtime/dyninst/transport.c: Stop the insider-trading of contexts, not
renaming to tls_context either. Use _stp_runtime_get_context().
* tapsets.cxx, translate.cxx: Pass the argument to put_context.
Josh Stone [Wed, 22 May 2013 00:45:31 +0000 (17:45 -0700)]
stapdyn: Remove the _stp_err copy of stderr
The only places left using _stp_err were the transport debug messages,
and _stp_vlog only when transport fails. Both may as well use whatever
stderr is local to the process directly.
Josh Stone [Tue, 21 May 2013 23:18:56 +0000 (16:18 -0700)]
stapdyn: Remove the _stp_out copy of stdout
With the transport in place, the only remaining use of _stp_out was for
that transport thread to get its out_fd. This thread runs within
stapdyn, and we know we'll keep our stdout intact, so _stp_out is no
longer necessary. Just set out_fd to STDOUT_FILENO, and be prepared for
this to be a -o file (PR14791).
Josh Stone [Tue, 21 May 2013 22:02:22 +0000 (15:02 -0700)]
stapdyn: remove the clunky stp_dyninst_master
This is a holdover from early stapdyn, which ran all module code within
the mutatee, and even tried to run module_exit in the DSO destructor to
catch the mutatee as it was exiting. We now do these things more
reliably in stapdyn itself.
It was kept around as a bit of a fallback to let new modules keep
working with stapdyn 2.0, but frankly this is bad code and untested
compatibility, that we shouldn't feel nostalgic about. Modules will now
require at least stapdyn 2.1, detected by having properly initialized
their shared memory before stp_dyninst_session_init is called.
David Smith [Fri, 17 May 2013 18:18:06 +0000 (13:18 -0500)]
Fix PR15486 by handling debug messages properly in dyninst mode.
* runtime/dyninst/io.c (_stp_vlog): If we're handling a message of type
DBUG, don't allocate a transport log buffer. Instead use the temporary
buffer.
* testsuite/systemtap.printf/dbug.exp: New test file.
* testsuite/systemtap.printf/dbug.stp: Ditto.
Josh Stone [Fri, 17 May 2013 01:53:39 +0000 (18:53 -0700)]
PR15481: Only destroy mutexes from stapdyn itself
The primary bug was since commit 8ca891c, _stp_shm_destroy was calling
_stp_runtime_context_free, which calls pthread_mutex_destroy on the
context locks. But _stp_shm_destroy is only meant to destroy *one*
processes view of shm -- it still needs to leave the contents intact for
other processes! This was making it so a child process ended and
destroyed the contexts, and thus in stapdyn it couldn't grab a context
to run the end probes.
* runtime/dyninst/shm.c (_stp_shm_destroy): Don't destroy contexts!
* runtime/dyninst/runtime_context.h (_stp_runtime_contexts_free): Remove
the __-prefixed variant, and explain in comments who should call this.
* tapsets.cxx (common_probe_entryfn_epilogue): Only call put_context if
we had successfully called get_context before.
* testsuite/systemtap.base/be_loaded.*: Test the simple begin/end case
with a child command loaded.
* translate.cxx (c_unparser::emit_module_exit): This generated exit
function is the best place to free the contexts and also shutdown the
transport, because this is the final call among all processes.
* runtime/dyninst/runtime.h (stp_dyninst_dtor): Don't shutdown the
transport here, because this is called by every process that has the
module loaded.
Josh Stone [Fri, 17 May 2013 00:11:44 +0000 (17:11 -0700)]
stapdyn: implement tapset tzinfo.stp
* runtime/dyninst/session_attributes.*: Add tz_gmtoff and tz_name.
* stapdyn/mutator.cxx (mutator::init_session_attributes): Set them.
* tapset/tzinfo.stp: Reduce to just the common tz_ctime().
* tapset/linux/tzinfo.stp: Move the linux tz_gmtoff() and tz_name here.
* tapset/dyninst/tzinfo.stp: Implement dyninst versions of the same.
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Get docstrings from the
new linux/tzinfo.stp too.
Josh Stone [Thu, 16 May 2013 23:12:02 +0000 (16:12 -0700)]
Improve the kernel target_set.stp and add a stapdyn version
* tapset/linux/target_set.stp: Prefer process.begin/end for better
tracking *process* lifetime. (syscall.exit covers thread exits too!)
* tapset/dyninst/target_set.stp: Implement stapdyn target_set.
* testsuite/systemtap.base/target_set_thread.*: Test that thread exits
don't cause target_set to lose sight of a process.
* main.cxx (run_sdt_benchmark): Save the timing info for verbose runs.
Josh Stone [Thu, 16 May 2013 19:36:47 +0000 (12:36 -0700)]
stapdyn: implement tapset module_name()
Note: for parity with the kernel mode, this name is without any path or
filename extension. We might want to consider adding a module_path()
with the full filename we loaded.
Frank Ch. Eigler [Thu, 16 May 2013 02:34:18 +0000 (22:34 -0400)]
java probes: make these unprivileged
* tapset-method.cxx (register_tapset_java): bind_unprivileged the lot,
considering that they are simply uprobes.
* tapset/system.stp (system): Mark as /* unprivileged */.
Josh Stone [Wed, 15 May 2013 20:02:13 +0000 (13:02 -0700)]
Change "-" to "__" in naming our internal benchmark probes
They're supposed to be named like C-identifiers. Plus the process.mark
tapset normalizes "-" in user input to "__" already, making it
impossible to directly match on a literal "benchmark-begin".
Josh Stone [Wed, 15 May 2013 19:51:33 +0000 (12:51 -0700)]
PR14297: Skip the user's input when scanning for resolved probes
* elaborate.cxx (derived_probe::script_location): Sweep the derivation
chain from its second-to-last, so we get at least one level of
resolution from the user's input.
* testsuite/systemtap.base/list.exp: Add a case for kernel init_once,
which demonstrates listing the @file:line is useful to disambiguate.
Add a case for 'begin' too, the simplest expansion we have.