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.
Mark Wielaard [Wed, 15 May 2013 15:36:08 +0000 (11:36 -0400)]
PR15452 Follow DW_AT_signature attributes when trying to find a DW_AT_type.
When we are trying to find a type DIE we might hit upon a DIE that simply
has a DW_AT_signature pointing to the actual type (possibly in .debug_type).
Extend the debugtypes.exp testcase a bit. Add DW_AT_signature chasing to
dwarf_wrappers.h (dwarf_attr_die) when searching for a DW_AT_type. And
clarify that dwflpp::print_members takes a type DIE not a variable DIE.
Frank Ch. Eigler [Wed, 15 May 2013 02:06:33 +0000 (22:06 -0400)]
PR14297 and .mark($$name) regression
The machinery for derived-probe chaining hasn't worked quite right,
relying on pretend-aliases and in-place-modified probe-point
components, inconsistencies abounding. Some of these are improved
in this code.
* elaborate.cxx (collect_derivation_pp_chain): Use sole_location() for
the starting point as that is the one most likely brought up-to-date
during the building process, and will be emitted in pass-3.
(script_location): Drop *basest* type logic fallback logic entirely;
fall back to top-level sole_location().
* elaborate.h, staptree.h: Drop basest/almost_basest functions.
* staptree.cxx: Ditto.
(probe::probe derived-copy ctor): Make deep-copy of probe body,
in case of partial rewriting during derivation steps.
* main.cxx (printscript): Rework listings code to use exactly the
same routine for -l output as which feeds pn(): namely
derived_probe::script_location().
* tapsets.cxx (query_one_library, query_one_plt, sdt_query::convert_location):
Use new derived-probe-copy ctor systematically; nested if necessary to
track levels of wildcard-expansion and synthetic probe creation.
Frank Ch. Eigler [Mon, 13 May 2013 21:16:42 +0000 (17:16 -0400)]
systemtap java support reorganization
* systemtap.spec: require byteman > 2.0 for java support
* configure.ac: Make java/stapbm a AC_CONFIG_FILE.
* java/HelperSDT.c: Reorganize sys/sdt.h ABI usage: make the rule-name
magic string the last argument, don't pass class/method strings.
Stop mis-using "provider" name.
* java/HelperSDT.h: Regenerated.
* java/Makefile.am: Spell out more dependencies.
* java/stapbm: Thoroughly reorganized to use rulename as run-time unique-id,
byteman port-number selection to enable concurrency, fewer lockfiles.
* tapset-method.cxx: Use consistent exceptions for error handling. Switch
to rulename-based identification. Rework synthetic probe generation.
Register java.* probes only if HAVE_JAVA.
* session.cxx, session.h, man/stap.1: Drop -J / -j options.
* testsuite/systemtap.apps/java*: Rely on pn() for class/method names.
Another related hunk extends the derivation chain to plain struct
probe, to avoid having to (mis)use alias-type derived probes. The
script-location (function tapset::pn) calculation is made based on
a textual analysis of the derivation_pp_chain.
* staptree.h (struct probe): Add a base* field for use by synthetically
created probes. Update copy-ish constructor to use this form. Update
most callers (former users of probe::create_alias) in tapsets.cxx and
tapset-method.cxx. Make collect_derivation_*_chain const functions.
* staptree.cxx (probe::basest, almost_basest, ...): Create/update
accordingly.
* elaborate.cxx (script_location): Rework a as more faithful heuristic.
It should make it possible to get rid of the *basest* type calls soon.
David Smith [Tue, 14 May 2013 13:16:43 +0000 (08:16 -0500)]
Fixed PR15446 by using the new /proc interface.
* runtime/procfs.c: Rewritten to use latest /proc interface (for older
kernels, use compatibility functions defined in proc_fs_compatibility.h).
* runtime/procfs-probes.c (_stp_proc_open_file): Use PDE_DATA() instead of
accessing the data field of a 'struct proc_dir_entry' directly.
* runtime/proc_fs_compatibility.h: New file.
* tapset-procfs.cxx (emit_kernel_module_exit): Only remove the
"/proc/systemtap/{module_name}' directory if the transport layer isn't
using it.
(procfs_derived_probe_group::emit_module_init): Pass the data parameter
down to _stp_create_procfs().
* buildrun.cxx (compile_pass): Add 2 "exportconf" tests for new procfs
features.
Josh Stone [Fri, 10 May 2013 20:09:20 +0000 (13:09 -0700)]
stapdyn: hide internal module functions
The header stapdyn.h is only for functions meant to be called from the
stapdyn binary into the module, so stp_dyninst_session_init_finished
shouldn't be there. Also, all functions that aren't part of stapdyn.h
should be declared with static visibility.
David Smith [Fri, 10 May 2013 19:41:00 +0000 (14:41 -0500)]
Fixed PR15456 by updating syscall tapsets with compat function changes.
* tapset/linux/syscalls.stp (syscall.compat_sys_msgrcv): Updated for newer
kernel compat function argument names.
(syscall.compat_sys_msgsnd): Ditto.
* tapset/linux/syscalls2.stp (syscall.compat_sys_semctl): Updated for
newer kernel compat function argument names.
(syscall.compat_sys_shmat): Updated for newer kernel compat function
argument names. Deprecated old "first", "second", "third" variable names
in favor of variable names that match the non-compat probe alias.
* tapset/linux/nd_syscalls2.stp: Ditto.
* testsuite/buildok/nd_syscalls2-detailed.stp: Updated with new variables
in the "shmat" probe alias.
* testsuite/buildok/syscalls2-detailed.stp: Ditto.
* NEWS: Mentioned variable deprecations.
Serguei Makarov [Fri, 10 May 2013 19:05:54 +0000 (15:05 -0400)]
probe timer.profile: workaround for the incredible disappearing register_timer_hook()
* tapset-timers.cxx: rename timer.profile to timer.profile.tick, explicitly
check for existence of kernel registration functions.
* tapset/timers.stp: timer.profile aliases to either timer.profile.tick
or perf.sw.cpu_clock as an alternative.
runtime perf.c: consistentify perf_event_create_kernel_counter context* use
Two runtime/linux/autoconf tests create a cartesian product of sorts
about the evolution of the $subject kernel API. In one spot, the
runtime neglected to consider the modern combination, breaking perf.*
probes on recent kernels.
Caused by commit 30c05350c39d ("powerpc/pseries: Use stop machine to
update cpu maps") from the powerpc tree interacting with (probably)
commit ff794dea52ea ("cpuset: remove include of cgroup.h from cpuset.h")
from the cgroup tree. Removing includes from header files is fraught
with danger ...
PR15445: fix kernel panic due to hardware-breakpoint callback abi incompatibility
* tapsets.cxx (hwbkpt_derived_probe_group::emit_module_decls): Add support for
non-STAPCONF_PERF_HANDLER_NMI kernels.
* testsuite/systemtap.examples/memory/hw_watch*.meta: Use a more likely-to-trigger
target variable, to make it more likely that this problem doesn't reoccur.
David Smith [Tue, 7 May 2013 21:21:03 +0000 (16:21 -0500)]
Fix PR15408. Create top-level procfs directory in init_module, where we're root.
* translate.cxx (emit_kernel_module_init): New function.
(emit_kernel_module_exit): Ditto.
(translate_pass): Call emit_kernel_module_init() and
emit_kernel_module_exit().
* translate.h: Add prototypes for emit_kernel_module_init() and
emit_kernel_module_exit().
* runtime/linux/runtime.h (init_module): Calls generated
systemtap_kernel_module_init().
(cleanup_module): Calls generated systemtap_kernel_module_exit().
* tapset-procfs.cxx (emit_module_decls): New function.
(emit_kernel_module_exit): Ditto.
* runtime/procfs.c (_stp_rmdir_proc_module): Improve error messages. No
longer use _stp_warn(), since transport won't be available.
(_stp_mkdir_prpoc_module): Improve error messages. Invert return code so
that 0 is success.
(_stp_create_procfs): No longer call _stp_mkdir_proc_module(), which now
gets called from generated systemtap_kernel_module_init().
(_stp_close_procfs): No longer call _stp_rmdir_proc_module(), which now
gets called from generated systemtap_kernel_module_exit().
* elaborate.h (struct derived_probe_group): Added
emit_kernel_module_init() and emit_kernel_module_exit() prototypes.
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.