David Smith [Wed, 23 Jan 2013 17:59:07 +0000 (11:59 -0600)]
Fix library.exp so it will pass on systems with uretprobes.
* testsuite/systemtap.base/library.exp: Fix a couple of issues. Fix
a regular expression to match the new warning string for no
debuginfo. Don't depend on glibc debuginfo being installed in the
'.exported' test.
David Smith [Tue, 22 Jan 2013 16:26:18 +0000 (10:26 -0600)]
PR14708 partial fix: Get 'process.end' probes (sort of) working.
* stapdyn/mutator.cxx (mutator::exit_callback): Instead of calling letting
the mutatee handle the exit callback, handle it in the mutator. This
means the probe's context is wrong, but it does get called.
* stapdyn/mutator.h: Add 'utrace_enter_fn' variable.
* stapdyn/mutatee.cxx (mutatee::find_attached_probes): New function.
* stapdyn/mutatee.h: Add mutatee::find_attached_probes() function
declaration.
* testsuite/systemtap.base/utrace_p5.exp: Add more tests.
Josh Stone [Sat, 19 Jan 2013 00:04:10 +0000 (16:04 -0800)]
PR14706: Always register the stapdyn fork callback
We need to watch forks regardless of whether we have process.being
probes, because there may still be other types of probes that should be
triggered in child processes.
Josh Stone [Fri, 18 Jan 2013 23:23:12 +0000 (15:23 -0800)]
PR14706: Follow forks in stapdyn and enable process.begin
* stapdyn/mutatee.cxx (mutatee::call_utrace_dynprobe): Newly abstracted
function to call utrace handlers from various contexts.
(mutatee::begin_callback): New, runs process.begin callbacks.
(mutatee::exit_callback): Use call_utrace_dynprobe.
(mutatee::thread_callback): Use call_utrace_dynprobe.
(mutatee::copy_forked_instrumentation): New, set all the member
variables for a newly-forked process.
* stapdyn/mutator.cxx (mutator::run): Trigger process.begin in target.
(mutator::post_fork_callback): Create an attached mutatee for the
fork, copy the instrumentation status, and trigger process.begin.
David Smith [Fri, 18 Jan 2013 22:12:37 +0000 (16:12 -0600)]
PR14574 partial fix: Add dyninst support to several tests.
* testsuite/lib/stap_run.exp (stap_run): Only append the arguments to the
test name if there are arguments.
* testsuite/systemtap.base/be_order.exp: Add dyninst support.
* testsuite/systemtap.base/const_value.exp: Ditto.
* testsuite/systemtap.base/control_limits.exp: Ditto.
* testsuite/systemtap.base/cu-decl.exp: Ditto.
* testsuite/systemtap.base/cxxclass.exp: Ditto.
* testsuite/systemtap.base/div0.exp: Ditto.
David Smith [Fri, 18 Jan 2013 21:38:16 +0000 (15:38 -0600)]
PR14574 (partial): Improve dyninst ctime.stp tapset and test it.
* testsuite/systemtap.base/ctime.exp: Add dyninst support.
* tapset/dyninst/ctime.stp: When an error occurs, return "<invalid time>"
instead of the empty string.
Josh Stone [Fri, 18 Jan 2013 02:04:59 +0000 (18:04 -0800)]
PR14706: Use shared memory between stapdyn and the target
Probes that are not process-specific (begin/end/timers) are now always
handled within stapdyn itself, while the rest (uprobes/utrace) continue
to run in the target process. The shared memory for globals and such is
allocated and initialized in stapdyn, then just mapped by the target.
This paves the way for allowing multiple target process, especially
following fork/exec, as we're no longer tied to a single address space.
* stapdyn/mutator.cxx (mutator::run_module_init): Manually initialize
shm and save the generated name. Run the session init locally, and
then map the shm in the target process too. For compat modules that
don't have shm functions, keep running session init in the target.
(mutator::run_module_exit): Always run the session exit directly for
shm-enabled modules, but still run it in-target for compat modules.
* stapdyn/mutatee.cxx (mutatee::call_function): Add a variant of this
function that takes an argument list.
* runtime/dyninst/runtime.h (stp_dyninst_ctor): Initialize the runtime
contexts and print system here so it happens for all processes, rather
than only once globally in session init. Also save the rc here to be
reported properly by the init call.
* runtime/dyninst/print.c: Add defensive checks for initialization.
* runtime/dyninst/shm.c (_stp_shm_connect): Fix the debug message.
* runtime/common_probe_context.h: Add a probe_index to the context
structure, because we can't directly access e.g. probe_point pointers
that other processes have set. With an index, we can get the same
info from stap_probes[].
* tapsets.cxx (common_probe_entryfn_prologue): Set probe_index.
* translate.cxx (translate_pass): Provide a simple access function for
the probe_point to ease include order, so places that need it don't
have to come after stap_probe is declared. (Even its type is dynamic.)
* runtime/dyninst/runtime_context.h (_stp_runtime_context_wait): Use the
index to indirectly get the stuck probe point, since c->probe_point is
not necessarily in our address space.
David Smith [Thu, 17 Jan 2013 20:07:45 +0000 (14:07 -0600)]
Add dyninst support to more testcases.
* testsuite/lib/stap_run.exp: Append extra arguments to the test name (so
we can tell the difference between tests with different runtimes.
* testsuite/systemtap.base/add.exp: Add dyninst support.
* testsuite/systemtap.base/alias-condition.exp: Ditto.
* testsuite/systemtap.base/alias_suffixes.exp: Ditto.
* testsuite/systemtap.base/arith.exp: Ditto.
* testsuite/systemtap.base/arith.stp: Ditto.
* testsuite/systemtap.base/arith_limits.exp: Ditto.
* testsuite/systemtap.base/array_size.exp: Ditto.
* testsuite/systemtap.base/array_string.exp: Ditto.
* testsuite/systemtap.base/at_var_mark.exp: Ditto.
* testsuite/systemtap.base/beginenderror.exp: Ditto.
* testsuite/systemtap.base/bench.exp: Ditto.
David Smith [Thu, 17 Jan 2013 17:34:37 +0000 (11:34 -0600)]
Improve testsuite by providing a global 5 second wait function.
* testsuite/systemtap.clone/main_quiesce.exp (wait_5_secs): Move function
to stap_run.exp so other tests can use it.
* testsuite/lib/stap_run.exp: Moved 'wait_5_secs' function here.
* testsuite/systemtap.base/utrace_p5.exp: Remove 'wait_5_sec' function and
use global 'wait_5_secs' instead.
* testsuite/systemtap.base/at_var_mark.exp: Use 'wait_5_secs' function to
give test program a chance to run a bit.
* testsuite/systemtap.clone/probe_by_pid.exp (sleep_5_secs): Removed
unused function.
Frank Ch. Eigler [Thu, 17 Jan 2013 04:10:20 +0000 (23:10 -0500)]
runtime: use stp_module ->path instead of abbreviated ->name in messages
One problem is that ->name is ambiguous, e.g. if probe wildcards
expand to different path files, but with the same basename. That
makes e.g. relocation or unwind dbug/diagnostic messages unclear.
So we switch over to using m->path as much as possible.
David Smith [Tue, 15 Jan 2013 22:42:20 +0000 (16:42 -0600)]
PR14708 partial fix: Add more testcases and a couple of small fixes.
* tapset-utrace.cxx (utrace_builder::build): Throw an error if the user
tries process.syscall probes with the dyninst runtime.
(utrace_derived_probe_group::emit_module_dyninst_decls): Correct the
probe type.
* testsuite/systemtap.base/utrace_p5.exp: Add dyninst testcases for thread
begin and end.
* testsuite/systemtap.base/utrace_p5_multi.c (main): Remove debug printfs.
Frank Ch. Eigler [Fri, 11 Jan 2013 21:00:24 +0000 (16:00 -0500)]
examples: tweak deviceseeks.stp
Switch to using the ioblock_trace.request probe point (based on a
kernel tracepoint), which is more reliable than the
kprobe-on-inlined-function ioblock.request one, and makes more
information avilable. (Unfortunately, this makes the script
incompatible with non-tracepoint kernels.)
Also, as per Jeff Moyer's correction, seeks are calculated as relative
to the end position of the prior transfer, not its origin.
Frank Ch. Eigler [Fri, 11 Jan 2013 23:04:28 +0000 (18:04 -0500)]
PR14774: tweak test case
Splitting the test case onto separate lines helps ensure separate line
records. Also, use [utrace_p] instead of CONFIG_UTRACE* tests for
applicability.
translate: for stap -t reports, identify probe index
For probe points that expand to multiple separate low-level kprobes,
e.g. for multiply-inlined functions, the stap -t report doesn't give
any hint as to which of those separate kprobes was invoked how many
times. Normally, a user would not care, so that's fine, but sometimes
for debugging it's nice to match up the stap -t output to the stap -p3
stap_probes[] array elements. So let's extend the -t output with an
undocumented index: NNN ditty.
* loc2c.c (STACK): Change macro to assert stack slot number >= 0.
(DW_OP_rot): Implement last assignment against correct stack slot.
* testsuite/buildok/dw_op_rot.stp: New test.
Emit address constants in loc2c for synthetic addresses always as hex
in translate_constant (). ... but then explicitly typecast it to
(uintptr_t), so that a small negative 32-bit value, rendered as a
64-bit positive hex value is acceptably truncated back down.
the omnibus change act of 2013 for copyright and task_finding excellence
* runtime/linux/task_finder*: Add a 'purpose' filed to the
task_finder_tgt, so that callback errors -- now becoming warnings --
can give a little better hint to the user as to what may have gone
wrong. Updated tapsets-*.cxx and runtime/vma.c generators/users to
set a string.
* bump copyright years nearby
* winnow accidentally cargo-culted copyright line (retained in relevant files)
Serguei Makarov [Fri, 21 Dec 2012 19:27:35 +0000 (14:27 -0500)]
PR14883: add combined error message for task_finder_stubs warnings and 'user-space facilities not available' error.
The basic idea behind the renaming is that, if one manpage explains both
errors and warnings, we title it error::FOO, 'error' being the somewhat
more general term.
Serguei Makarov [Thu, 20 Dec 2012 16:17:01 +0000 (11:17 -0500)]
PR14929: revert earlier manpage-reporting mechanism as too clunky.
Instead of having separate semantic_error_manpage() &c classes,
we can just put a compact [man error::...] reference in the error message.
This does not require additional error reporting machinery.
Frank Ch. Eigler [Thu, 20 Dec 2012 15:02:15 +0000 (10:02 -0500)]
PR12443: skip duplicate tapset files between XDG_DATA_DIRS and $prefix
For a self-built systemtap installation, with a $prefix other than
/usr, run on a system with $XDG_DATA_DIRS set, the tapset *.stp /
*.stpm files will collide between those in the freshly-build one and
the system one. This can result in warning messages, duplicate
probes, and cats and dogs living together.
We try to avoid this by duplicate-elimination based upon the tapset
file name.
* session.cxx (systemtap_session ctor): Put compiled-in / -I tapset
path first.
* main.cxx (passes_0_4): While processing *.stpm and *.stp tapset
files, skip subsequent ones that share same sub-path-name (part
after the -I path/ or XDG_DATA_DIRS=path1/:path2/ elements.
With greater pass-1 verbosity, explain.
Serguei Makarov [Wed, 19 Dec 2012 21:18:23 +0000 (16:18 -0500)]
PR14883: let stuff that demands task_finder, incl. probefunc(), fail gracefully when such is not available
Now, instead of failing pass-4, code demanding task_finder process tracking
functionality on systems where the facility is unavailable will run with
a warning, then silently ignore any task_finder callbacks that the script
attempts to register.
* runtime/vma.c (_stp_vma_init()): return silently without doing anything if HAVE_TASK_FINDER is not set.
* runtime/linux/task_finder3.c: new file.
* runtime/linux/runtime.h: include task_finder3.c if actual task_finder not available.
Lukas Berk [Tue, 18 Dec 2012 21:24:09 +0000 (16:24 -0500)]
PR14714: Introduce --suppress-time-limits flag
This flag enables somewhat heavier weight scripts to be run, disabling
-DSTP_NO_OVERLOAD, -DMAXACTION, and -DMAXTRYLOCK mechanisms. The flag
itself also requires guru mode to be specified.
* cmdline.cxx - add the new long option
* cmdline.h - add the corresponding long option to enum
* hash.cxx - add the option to be hashed
* man/stap.1 - updated man page reflecting new option
* runtime/common_probe_context.h - remove actionremaining declaration if
flag is specified and the variable is no longer needed
* runtime/dyninst/probe_lock.h - remove the check against MAXTRYLOCK if
the flag is specified
* runtime/linux/probe_lock.h - remove the check against MAXTRYLOCK if
the flag is specified
* runtime/runtime_defines.h - remove the declarations of MAXTRYLOCK and
MAXACTION if the flag is specified
* session.cxx - add flag bool for stap proper, stap help message, and
command line option check
* session.h - declare the flag boolean
* tapset-timers.cxx - add conditionals for the module 'actionremaning'
variable if the flag is specified
* tapsets.cxx - add conditionals for the module 'actionremaning'
variable if the flag is specified
* testsuite/systemtap.base/suppress-time-limit.exp - new testcase
* testsuite/systemtap.base/suppress-time-limit.stp - testcase script
* translate.cxx - add conditional based on stap proper boolean to
record_actions function