David Smith [Thu, 9 Feb 2017 18:39:17 +0000 (12:39 -0600)]
Fix/update the cast-scope testcase for gcc 7.
* testsuite/systemtap.base/cast-scope.exp: Update expected output for
cast-scope.cxx change. This way we're depending on our own class instead
of the internal details of the std::string class (which changed with gcc
7).
* testsuite/systemtap.base/cast-scope.cxx: Instead of using the
std::string class, define our own test class.
* testsuite/systemtap.base/cast-scope.stp: Update for cast-scope.cxx change.
David Smith [Tue, 7 Feb 2017 16:01:22 +0000 (10:01 -0600)]
Update systemtap.base/utf_kernel_trunc.exp test case for gcc 7.
* testsuite/systemtap.base/utf_kernel_trunc.exp: Lengthen MAXSTRINGLEN
value to 41 characters to ensure that systemtap's error buffer is large
enough to handle the "read fault" error messages (for
example). Otherwise the test will fail when gcc 7 rightly complains that
the error buffer isn't big enough.
* testsuite/systemtap.base/utf_kernel_trunc.stp: Ditto.
Passing $CFLAGS with embedded \" sequences is OK, so tune the previous
CFLAGS sanitization logic to nuke only backslash-newline sequences.
Modified dtrace.exp test covers this case as well as previous one.
David Smith [Thu, 2 Feb 2017 18:25:14 +0000 (12:25 -0600)]
Fix PR21102 by updating the ioblock tapset.
* tapset/linux/ioblock.stp: Update tapset for newer kernels. Upstream
kernel commits (like commit 1eff9d322a444245c67515edb52bc0eb68374aa8)
renamed and reworked the 'bi_rw' field of the bio structure.
The new python expanding visitors take probe-python bodies and intend
to generate probe-process bodies, expanding python $var references to
uprobe marker $var ones. During the expansion process however, the
code can get confused as to whether the new $arg3 is fish or foul.
If asked, it will map $arg3 -> foo($arg3, "arg3"), then recurse,
which is a recipe for stack exhaustion.
So now we map the generated $arg3 with a new hacky target_symbol flag,
"synthetic", to prevent infinite recursion there. (Note that using
the recently added abort_provide() response from the expander is not
enough, because an outer relaxation loop would then trigger infinite
looping rather than infinite recursion.)
A better solution could be to have a *not-in-place* rewriting visitor,
so that the output tree is never reprocessed by the invoking visitor.
Frank Ch. Eigler [Wed, 25 Jan 2017 15:00:11 +0000 (10:00 -0500)]
PR20627: rework several code rewriting passes
The translator depends on some staptree rewriting passes not only for
optimization but also for correctness.
The @defined() construct is one where its timely execution and
implication handling is important, so that other constructs protected
by false-valued if(@defined()) guards are not even processed. In
other places, @defined() nodes are collapsed to zero under heuristic
conditions. This has all been a mash of uncomfortable probe-specific
and probe-independent code, running the same visitors in different
modes at different times, looping or not.
So we take a step forward in recognizing that some visitors
necessarily operate partially, and must be rerun, interleaved with
others. New functions in tapsets.h:
update_visitor_loop() -- given a vector of update_visitors, loop till relaxed
var_expand_const_fold_loop() -- same specialized to const-folder
... are now used from general elaborator driver as well as
probe-derivation logic. Some heuristic code regarding @defined()
can be removed.
This extends the update_visitor base template with its own notion of
relaxed-ness, which is naturally that if a staptree node/pointer has
been replaced (changed to a different value) during the visiting
traversal, then it is -not- relaxed yet, and this is saved in a new
instance variable. (A reset() function resets this so the same
visitor object can be reused.)
This makes it unnecessary to track count_replaced_defined_ops()
separately. It should make it possible to drop some other bool& flags
in some other older optimization passes; this is left for later.
Frank Ch. Eigler [Wed, 25 Jan 2017 15:36:57 +0000 (10:36 -0500)]
testsuite: tweak bz1027459
On a multi-CPU box, it's possible for two syscall.* probes to start
firing at the same time, this print two or more "hi"s, before the
exit() stops further new probes.
David Smith [Tue, 24 Jan 2017 16:44:12 +0000 (10:44 -0600)]
Update lookup_bad_addr() to avoid a kernel warning.
* runtime/linux/addr-map.c (lookup_bad_addr): Handle kernel commit 7c4788950ba which adds a kernel warning if access_ok() is called when
not in task context.
Allow our /usr/bin/dtrace-impersonating usdt-.d file parser to take in
those .d files that use the "arguments passed to probe consumers"
extended syntax:
Frank Ch. Eigler [Fri, 20 Jan 2017 03:04:48 +0000 (22:04 -0500)]
runtime/unwind: don't warn about self-unwinding
If a kernel backtrace traversed the stap module itself, until this
patch, the runtime emitted a pair of _stp_warn()'s complaining about
not-quite-perfect unwind data. This is noisy and unhelpful, since a
user can't do anything about it, so we switch over to a dbug(1) type
message.
David Smith [Fri, 20 Jan 2017 19:06:40 +0000 (13:06 -0600)]
Handle F24 dropping ppc64 32-bit exe support in the testsuite.
* testsuite/lib/compile_flags.exp (arch_compile_init): New
function. Fedora 24 ppc64 has dropped 32-bit exe support. Now on ppc64
systems, we test the 32-bit support. If it doesn't work (or isn't
present), assume only 64-bit exe support.
(arch_compile_flags): For ppc64, return the number of compile flags
arch_compile_init() determined for this system.
(arch_compile_flag): Ditto.
* testsuite/lib/systemtap.exp (setup_systemtap_environment): Call
arch_compile_init().
Frank Ch. Eigler [Mon, 16 Jan 2017 18:23:57 +0000 (13:23 -0500)]
tweak python helper installation paths
Since our python helper includes C shared libraries, all the files
(including .egg-info) will get put under %python_sitearch
(/usr/lib64/...) rather than %python_sitelib (/usr/lib/...).
The translate-time stap-resolve-module-function* file belongs in
the -devel subrpm, not -runtime.
David Smith [Mon, 16 Jan 2017 15:29:38 +0000 (09:29 -0600)]
Fix the python helper module compiliation.
* python/Makefile.am: Fix a problem where we were using the system's copy
of sdt.h, instead of the source tree's copy of sdt.h.
* python/Makefile.in: Regenerated.
Frank Ch. Eigler [Mon, 16 Jan 2017 15:24:45 +0000 (10:24 -0500)]
testsuite infrastructure: change stap_run api
Formerly, the stap_run tcl proc accepted a target stap script file
name both as its first argument, as well as in the general stap
argument list at the end. It passed the former name as an extra file
name iff it existed in the $srcdir/$testdir. Some tests happened to
use test names that matched files, so triggered this stap_run
heuristic, even if the .stp files were specified some other way. This
led to extra stap arguments, leading to "unused $0/@0 ..." warnings,
leading to test failures.
Now, stap_run never does anything clever with its first parameter - it
just uses it to construct the dejagnu test case id/name. The .stp
file name (if any - if not using -e SCRIPT for example) is now
expected to be included by the testcase.exp as arguments at the end.
Frank Ch. Eigler [Mon, 16 Jan 2017 15:23:23 +0000 (10:23 -0500)]
tweak unused $n/@n warning for argv tapset users
Use the demangled (original) names in s.globals[] rather than mangled
name to heuristically identify use of the argv tapset (and thus
suppression of the warnings).
Martin Cermak [Fri, 13 Jan 2017 10:09:54 +0000 (11:09 +0100)]
PR20333: Add new convenience variables to the buildok tests.
* nd_syscalls2-detailed.stp, syscalls2-detailed.stp: Drop the
compat_pselect7a versus compat_pselect7 typo handling which was
systemtap_v <= "1.3".
* nd_syscalls2-detailed.stp: Add nd_syscall.sched_yield and
nd_syscall.userfaultfd test to align with syscalls2-detailed.stp
* The rest of the changes is adding new convenience variables.
David Smith [Thu, 12 Jan 2017 20:31:29 +0000 (14:31 -0600)]
Add support for python 2 unicode objects.
* tapset/python2.stp: Add support for the unicode type. Move the python
module list into a macro, so we've only got one copy.
* testsuite/systemtap.python/python2.exp: Expect working unicode strings.
Tetsuo Handa [Wed, 11 Jan 2017 02:38:15 +0000 (21:38 -0500)]
PR21020: allow --compatible=3.0 java probe string $args without leaks
With some extra work, one can track which individual java parameters
were stringified & need free()ing, and which don't. That way,
--compatible=3.0 java probes can take string arguments again,
leaklessly.
Frank Ch. Eigler [Tue, 10 Jan 2017 20:16:58 +0000 (15:16 -0500)]
testsuite: suppress warnings from empty strings passed to stap
A test case passed a ""-valued tcl variable to a stap command line,
which due to tcl quoting rules means passing an empty string (rather
than nothing). Use some harmless real option for the empty case,
since we don't want the "" passed through to stap.
David Smith [Tue, 10 Jan 2017 19:21:22 +0000 (13:21 -0600)]
Swap python marker arguments around.
* python/HelperSDT/_HelperSDT.c (trace_callback): Swap the argument order
around so that the module name and key are always first.
* tapset-python.cxx: Expect the new marker argument order.
David Smith [Tue, 10 Jan 2017 18:35:25 +0000 (12:35 -0600)]
Handle python3 class variable references, like '$class->member'.
* tapset/python3.stp: Add support for most python objects (such as
classes), which use the same internal function to get their attributes.
* python/HelperSDT/_HelperSDT.c (PyInit__HelperSDT): For python version 3,
add an 'Init' marker.
* tapset-python.cxx (build): Add code to hook up to the new 'Init' marker.
* tapset/python2.stp: Added small simplification.
* testsuite/systemtap.python/python3.exp: Increase timeout values and
update.
PR21020: reorganize data passing abi for java method parameters
Under a new ABI, all java object types are supported for passing to
java-method probes, by converting them all within the JVM to strings.
The systemtap script side now gets $argX being all utf-char-pointers,
which are loaded into script-side string variables with synthetic
user_string_warn() function calls.
A backward compatibility ABI is preserved in the java helper class
as well as the translator, under --compatible=3.0.
The java testsuite is drastically simplified (and execution time
shortened) to one class. These now test string and object passing
too, with it and stapbm extended to be able to locate the HelperSDT
jar / .so files within the systemtap installation $prefix. This way,
the system /usr/lib/jvm/.... path does not need to be populated just
for stap tests to run. (We should sometime extend the tests to cover
all the argument arities, but eyeballing looks OK for now.)
elaborate.cxx: optimizations should elide elision warnings for synthetic probes
We need to check not only whether a token is associated with a
user-vs-tapset file, but also whether the file is entirely synthetic.
We don't want to warn users about the latter. Relevant to the
new java method probes' argXXX synthetic script variables.
The implementation of the system() tapset function involves sending a
ctl message via the runtime transport system, which can impose smaller
string length limits (STP_CTL_BUFFER_SIZE) than the usual systemtap
strings (MAXSTRINGLEN). Conditions like that resulted in a kernel
message (printk) being printed, which is a quiet failure.
New code increases the ctl-buffer-size from 256 to 384, and tweaks
_stp_ctl_send() to send an _stp_warn() in case of an overlength input.
The system() tapset function docs point out this possibility.