Lukas Berk [Tue, 30 Apr 2013 20:46:23 +0000 (16:46 -0400)]
remove spaces in rule names and their files for bmsubmit and bminstall
*java/stapbm: surround all variables in quotes to manage spaces
*tapset-method.cxx: add new_no_method (standing for no spaces),
this will be the rule name which is used to pass
to bmsubmit and actually name the file
Lukas Berk [Mon, 29 Apr 2013 14:47:58 +0000 (10:47 -0400)]
Add check for '.sh' suffix on byteman specific commands
*java/stapbm: When installed from rpm, byteman scripts do not have the
'.sh' suffix. However, they do if byteman is installed from
source. We need to be flexible on which we accept.
Lukas Berk [Sat, 27 Apr 2013 19:13:57 +0000 (15:13 -0400)]
Add passable -J<BYTEMAN_INSTALL_OPTIONS> to stap
This will allow systemtap to pass options to bminstall. This can include
an option such as -Jorg.jboss.byteman.compile.to.bytecode which will then
be passed as -Dorg.jboss.byteman.compile.to.bytecode and directly compile
the byteman rule to bytecode, allowing for faster rule execution
*cmdline.h: add the J case
*java/stapbm: add the new (optional) parameter to be passed
*session.cxx: add the new -J case statement
*session.h: compilation variable
*tapset-method.cxx: append the passed command
Lukas Berk [Sat, 27 Apr 2013 18:27:19 +0000 (14:27 -0400)]
Add java.exp testcase
*testsuite/systemtap.apps/java.exp: expect file for testcase
*testsuite/systemtap.apps/java.stp: script to use for java testing
*testsuite/systemtap.apps/singleparam.java: java file to compile and test
Lukas Berk [Sat, 27 Apr 2013 17:39:36 +0000 (13:39 -0400)]
Add a locking file while writing the rule in stapbm script
*java/stapbm: at times there are several rules being written so quickly
that the script overlaps the rules, resulting in an errnous
script, add a lock file to ensure this doesn't happen
configure.ac: rework configury to support --with-helper and --with-jdk options
The different options control where libHelperSDT.so and HelperSDT.jar end up.
Use --with-helper to install to a folder like libexec for subsequent symlinking
Use --with-jdk to install a jdk folder under ...ext/ and ...amd64/ directories
Lukas Berk [Thu, 25 Apr 2013 19:07:11 +0000 (15:07 -0400)]
Adjust stapbm to allow more than one rule per process
*java/stapbm: Relax script to allow more than one rule per process
This required file locks to be used to ensure bminstall
was only called once, as well as only allowing one
rule to be submitted at a time.
*java/tapset-method.cxx: stapbm script always needs all parameters to be
passed to ensure properly running behaviour
Lukas Berk [Tue, 23 Apr 2013 16:34:46 +0000 (12:34 -0400)]
Moved bm{install,submit} operations to pass 5
*java/stapbm: removed unneeded suffix from file name
*session.cxx: remove byteman operations/variables
*session.h: remove byteman operations/variables
*tapset-method.cxx: add new add new probe points and ensure that
the main probe body isn't copied to all new
probe points
Lukas Berk [Thu, 4 Apr 2013 15:24:51 +0000 (11:24 -0400)]
Only install rules once per java process
*session.cxx: re-enable the check before executing java_detach
*tapset-method.cxx: only bminstall.sh the process if its not already been recorded
and check to see if we've installed any java procs already
Lukas Berk [Wed, 3 Apr 2013 21:26:40 +0000 (17:26 -0400)]
Allow more than one java probe point per script
*tapset-method.cxx: add filter to match probe against the class
and method, if it doesn't match, then skip
the probe point
*session.cxx: change how rules are uninstalled
Lukas Berk [Tue, 19 Mar 2013 14:39:59 +0000 (10:39 -0400)]
Cleanup and use stap_system() to launch commands
*tapset-method.cxx: use stap_system() to launch bmsubmit and bminstall
commands instead of forking and managing it ourselves.
Also, a small cleanup of commented out vars and varnames
Lukas Berk [Mon, 18 Mar 2013 23:11:29 +0000 (19:11 -0400)]
Uninstall the specific byteman rule we generated
*session.cxx: add systemtap_session member variables and use
stap_system to launch bmsubmit.sh uninstall command
*session.h: added member variable declarations
*tapset-method.cx: use member variables so we know which rule to uninstall
*tapsets.cxx: reorder which tapsets to register so normal process probes
are registered first
Lukas Berk [Thu, 14 Mar 2013 20:44:06 +0000 (16:44 -0400)]
Exit gracefully from a java process (uninstall rules)
*session.cxx: add java_detach() function, exec bmsubmit.sh -u
*session.h: declaration of java_detach
*tapset-method: change some local variables to systemtap_session
variables for java_detach
Lukas Berk [Mon, 4 Mar 2013 20:38:58 +0000 (15:38 -0500)]
Add java specific helper files
*java/HelperSDT.c: the actual value extraction and passing to stap
*java/HelperSDT.h: the jni header file
*java/HelperSDT.java: the java jni file
*java/README: how to manually compile and add the .jar and .so
*java/TODO: the TODO for automation
*tapset-method.cxx: fix the helper name
Lukas Berk [Mon, 4 Mar 2013 18:50:34 +0000 (13:50 -0500)]
Make use of HAVE_HELPER config variable
*tapset-method.cxx: only create new probe point and exec byteman
if HAVE_HELPER / --with-helper was defined
and use the specified variable in the new
process("libHelperSDT.so").mark("*") probe
Lukas Berk [Sat, 2 Mar 2013 20:41:59 +0000 (15:41 -0500)]
Fix method argument amount calculation
*tapset-method.cxx: previously the number of arguments in a method
was determined by counting the number of ','s.
Fix this by checking for distance between ()'s
Lukas Berk [Sat, 2 Mar 2013 17:42:12 +0000 (12:42 -0500)]
Initial java per method probing functionality
* Makefile.{am,in}: add tapset-method.cxx to file list
* session.cxx: add java_derived_probes to systemtap_session class
* session.h: likewise
* tapsets.cxx: add new token strings, call java probe point builder
* tapset-method.cxx: actual byteman exec and probe redefinition/builder
stapdyn: add a one-second timeout to the mutatee state-change ppoll
Intermittently, the filehandle-based notification hangs (with rawhide
dyninst 8.1.1 x86-64), but subsequent event polling works. So let's
not let stapdyn block indefinitely on the former.
* stapdyn/mutator.cxx (mutator::run): Add a 10-second timeout.
David Smith [Fri, 26 Apr 2013 16:25:24 +0000 (11:25 -0500)]
Fixed PR14491 by adding a real transport layer for dyninst.
* runtime/dyninst/transport.c: New file.
* runtime/dyninst/transport.h: New file.
* translate.cxx (c_unparser::emit_module_init): Emit a call to
stp_session_init_finished() before probe registrations.
(c_unparser::emit_module_exit): In dyninst mode, delay
releasing the context.
* tapsets.cxx (common_probe_entryfn_epilogue): In dyninst mode, delay
releasing the context.
* runtime/dyninst/stapdyn.h: Add stp_dyninst_session_init_finished()
prototype.
* runtime/dyninst/shm.c (_stp_shm_destroy): Right before unmapping the
shared memory, tear down the contexts.
* runtime/dyninst/runtime_context.h (__stp_runtime_contexts_free): New
function.
* runtime/dyninst/runtime.h (stp_pthread_rwlock_init_shared): New function.
(stp_dyninst_shm_connect): Initialize the transport by calling
_stp_dyninst_transport_init().
(stp_dyninst_session_init): Ditto.
(stp_dyninst_session_init_finished): New function.
(stp_dyninst_dtor): Shutdown the transport by calling
_stp_dyninst_transport_shutdown().
* runtime/dyninst/print.c (_stp_print_flush): Now just calls
_stp_dyninst_transport_write().
(_stp_reserve_bytes): Now just calls
_stp_dyninst_transport_reserve_bytes().
(_stp_unreserve_bytes): Now just calls
_stp_dyninst_transport_unreserve_bytes().
* runtime/dyninst/common_session_state.h: Add transport data to session
data structure.
* runtime/common_probe_context.h: Add transport data to context structure.
* runtime/dyninst/io.c (_stp_vlog): New function.
(_stp_warn): Now uses _stp_vlog().
(_stp_error): Ditto.
(_stp_softerror): Ditto.
(_stp_dbug): Ditto.
Josh Stone [Tue, 23 Apr 2013 22:10:51 +0000 (15:10 -0700)]
Expand the SDT benchmark locations
- Add the loop index as an argument to stap:benchmark.
- Add stap:benchmark-thread-begin/end around each thread.
- Add stap:benchmark-begin/end around the whole thing.
Josh Stone [Thu, 4 Apr 2013 18:11:36 +0000 (11:11 -0700)]
BZ855981: Further tweak getcpu compatibility
- Keep using sched_getcpu() where possible - it's sometimes faster.
- Pass the correct parameters to syscall(getcpu).
- Direct the tapset cpu() through this compat code too.
BZ855981: stapdyn runtime compatibility with RHEL5
Old kernels & old glibcs require some minor compatibility hacks.
* runtime/dyninst/linux_defs.h: Dummy-define CLOCK_MONOTONIC_RAW
if required.
* runtime/dyninst/runtime.h: Dummy-define BITS_PER_LONG if required.
_stp_runtime_entryfn_get_context: Use syscall(__NR_gettid) as
fallback from __NR_getcpu if required.
Josh Stone [Wed, 27 Mar 2013 23:33:56 +0000 (16:33 -0700)]
PR15315: Filter inode-uprobe processes in the handler
We already had process tracking, mainly for setting semaphores, but this
gives the list needed to check if an incoming uprobe hit is for a
process we care about. So now stapiu_probe_prehandler will consult this
list before proceeding with the rest of the probe handler.
This also updates locking so that readers of this process list have a
more fine-grained lock, rather than the global stapiu_process_lock.
Code that needs to reserve/free a uprobe slot will both the global lock
and the specific target lock.
Josh Stone [Tue, 26 Mar 2013 19:25:17 +0000 (12:25 -0700)]
PR15306: Guard the stapdyn probe prologue for no shm
* runtime/dyninst/common_session_state.h (GET_SESSION_ATOMIC,
_stap_hash_seed, probe_alibi, probe_timing, stp_session_context):
Return NULL if the session (in shm) doesn't exist yet.
* tapsets.cxx (common_probe_entryfn_prologue): Skip the whole probe if
the session_state isn't available at all (i.e. no shm yet).
(common_probe_entryfn_epilogue): Close the session_state block.
linux-headers* already depends on the right linux-kbuild* package and
our heuristic for guessing the package name is lacking. For example
with linux-image-3.2.0-0.bpo.4-amd64 version 3.2.35-2~bpo60+1 from
squeeze-backports it predicts "linux-kbuild-3.2.0" while the package
is actually named "linux-kbuild-3.2".