Eliminating the timer.s() wait, putting in a fixed 'sleep NN'
into the -c CMD string makes stopping condition clearer and
overall CMD exit value fixed (0).
On a rawhide smp box, it was possible to see corrupted lines of text
from this test's multiple concurrent outputs, and thus lose counts.
The strings are revised, and exit timing managed mroe carefully,
to make the run more repeatable.
David Smith [Fri, 25 Sep 2015 17:25:41 +0000 (12:25 -0500)]
Set up kfails for testsuite/buildok/stap_staticmarkers-detailed.stp.
* testsuite/systemtap.pass1-4/buildok.exp: For
buildok/stap_staticmarkers-detailed.stp, kfail if we don't have uprobes
or if we're not running as root. Only root can read "staprun".
Martin Cermak [Fri, 25 Sep 2015 14:20:20 +0000 (16:20 +0200)]
Add explicit typecasts ensuring buildability of json_set_prefix().
Without this update json_set_prefix() doesn't compile on rhel[56]
i686 systems due to "format ‘%lu’ expects type ‘long unsigned int’,
but argument 4 has type ‘size_t’". The reproducer is as follows:
`stap -wge 'probe oneshot {println(json_set_prefix("blah"))}'`
David Smith [Thu, 24 Sep 2015 21:01:57 +0000 (16:01 -0500)]
Refix PR18999 by changing the way we check last_error.
* tapsets.cxx (common_probe_entryfn_epilogue): Only check to see if
'last_error' isn't NULL, don't check to see if it isn't empty.
* tapset/logging.stp (error): Don't provide a default error message.
lberk noticed that our examples, and especially their listings at
sourceware.org/systemtap/examples/ may mislead people who run older
versions of systemtap that can't run all modern samples. We now
add a brief version header to tip people off.
work for PR18455 now produces a mismatch error in the case that
some binary expression has a long expression and a string expression,
meaning the string+long binary expression no longer gets optimized out.
elaborate.cxx: stop analyzing the script if an error was generated in
the initial type pass to avoid generating a duplicate error in the
main type resolution pass
elaborate.cxx: in const_folder::visit_binary_expression() if one
side is a literal number and the other is not pe_long or pe_unkown,
produce a type mismatch
PR18455: globals type_details are null in initial typres
elaborate.cxx: in the intial type pass, follow semantic_pass_types()
and set globals' type_details to null, since globals are not supposed
to have detailed types. this fixes the semko/autocast05.stp failure.
elaborate.cxx: since some visit* functions in the typeresolution_info visitor
just throw errors, create an initial_typeresolution_info visitor that
overwrites those functions to account for substitutions/replacements not being
done. semko tests autocast05 and binexpr_infer_type fail with theses changes.
Abegail Jakop [Wed, 26 Aug 2015 21:36:31 +0000 (17:36 -0400)]
PR18455: use an initial type resolution pass
elaborate.cxx: for the const_folder visitor attempt to resolve some
times before the const_foler visitor is called. this is to try to
propogate an expression's type that is implied by what expression it's
in, up to the vardecl, to avoid unresolved type errors in cases like:
{println(i*0)}
Abegail Jakop [Tue, 25 Aug 2015 15:09:39 +0000 (11:09 -0400)]
PR18455: testcases for type inference changes
semok/*: if some part of a binary expresion is elided in the const_folder
visitor, the type inference is still passed on.
semko/*: if some part of a binary expression, where one expression is a
string and the other is a long, gets elided in the const_folder visitor,
the type inference is still passed on, and stap reports a type mismatch.
Abegail Jakop [Tue, 25 Aug 2015 15:00:51 +0000 (11:00 -0400)]
PR18455: suggest type in const_folder binary expr
elaborate.cxx: within const_folder::visit_binary_expression(), for cases
like {println(i+0)} where part of the binary expression is elided, suggest
what the type (pe_long) should be to the remaining part of the expression.
Fix BZ1264678 by updating the networking tapset for the 4.1 kernel.
* tapset/linux/networking.stp (netdev.transmit): Prefer
__dev_queue_xmit() if available.
(netdev.hard_transmit): Handle the change in argument name from 'skb' to
'first'.
David Smith [Mon, 14 Sep 2015 15:35:36 +0000 (10:35 -0500)]
Fix PR18944 by updating runtime/linux/autoconf-blk-types.c.
* runtime/linux/autoconf-blk-types.c: Add linux/blkdev.h that hopefully
includes linux/rh_kabi.h. We can't include it directly since it doesn't
exist on non-RHEL kernels.
David Smith [Wed, 9 Sep 2015 15:47:57 +0000 (10:47 -0500)]
Fixed PR18942 by avoiding the inclusion of unused global variables.
* tapset/linux/aux_syscalls.stp (__count_envp): Changed the name of the
'argc' local variable to '__argc' to avoid confusing the translator with
the global 'argc' variable from tapset/argv.stp.
(__count_compat_envp): Ditto.
Josh Stone [Tue, 8 Sep 2015 21:24:36 +0000 (14:24 -0700)]
PR18936: extend the lifetime of synthesized DW_OP_addr
In dwflpp::literal_stmt_for_local(), a fake addr_loc is created for
variables we find in the symbol table. But this addr_loc had tight
scope on the stack, and its contents were clobbered by the time the
pointer was read by emit_header().
Just extending the lifetime to the whole function scope is enough.
Josh Stone [Fri, 4 Sep 2015 18:11:53 +0000 (11:11 -0700)]
Switch to SSL_GetImplementedCiphers()
When nss rebases, the size of SSL_ImplementedCiphers[] may change. If
we have a copy relocation, this could mean we'll get an incomplete copy
of the array. Use the accessor function instead for a simple pointer.
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=496993
Martin Cermak [Fri, 4 Sep 2015 07:38:45 +0000 (09:38 +0200)]
PR18649: Add tests for the new --prologue-searching option
* NEWS: Add entry describing the new option.
* hash.cxx: Add the option index into the script hash.
* testsuite/parseko/cmdline23.stp: New testcase.
* testsuite/parseok/cmdline03.stp: Ditto.
* testsuite/systemtap.base/pr18649.exp: Ditto.
PR18889: switch to STP_TRACEPOINT* frontend for kernel tracepoint registration
jistone kindly reminded that the runtime/stp_tracepoint.[ch] machinery
allows us to attach to kernel tracepoints, whether on string- or
tp*-based kernel APIs, and whether or not the tp* objects are
EXPORT_TRACEPOINT_SYMBOL_GPL'd. Let's use those; presto we get
module-init probing back on kernels oldish and newish.
Frank Ch. Eigler [Mon, 31 Aug 2015 21:46:43 +0000 (17:46 -0400)]
PR18889 part: module-init notification via module_{load,free} tracepoints
Investigating RHBZ1257399 et al., we found that module_notifier is
being called too early after kernel commit #4982223e51. This
precludes normal module section-address computation and thus kprobe
emplacement. This patch adds hooking into the module_{load,free}
tracepoints in parallel, because on some kernels (RHEL7.1.Z+) they
occur at just the right time.
On the downside, on recent LKML kernels, attaching to those
tracepoints requires EXPORT_TRACEPOINT_SYMBOL_GPL's, so until that is
done (or another workaround made), LKML kernels will still miss out on
module-init probing.
Jose Castillo [Wed, 22 Jan 2014 10:40:27 +0000 (10:40 +0000)]
Add a new command line option to enable print backtraces under some conditions.
Most of the times, when we use bkl.stp to investigate BKL issues, we've found useful to have
the backtrace of the function that holds the BKL. This patch adds a new command line option,
"backtrace=N", that when used enables the use of print_backtrace(). The value of <N>, if present,
is taken as useconds, and it is the limit of time the task or tasks have been waiting to acquire
the lock i.e.:
# stap blk.stp backtrace=100
That would enable printing of backtrace on all tasks holding the kernel
big lock for more than 100us.
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
David Smith [Thu, 20 Aug 2015 16:27:53 +0000 (11:27 -0500)]
Fix PR18856 by making nfsd.close optional.
* tapset/linux/nfsd.stp: Make nfsd.close optional in nfsd.entries (and add
it optionally to nfsd.return), since the underlying probe point no
longer exists in kernels 4.2+. Also add nfsd.proc.commit.return to
nfsd.proc.return (to match nfsd.proc).
* testsuite/buildok/nfsd-detailed.stp: Make nfsd.close tests optional.
Josh Stone [Thu, 20 Aug 2015 01:38:08 +0000 (18:38 -0700)]
runtime: only compare line records at "commit" states
The state machine for line records may go through intermediate states
which are not proper to compare address against. Only at DW_LNS_copy,
DW_LNE_end_sequence, and special opcodes are we supposed to "append a
row to the matrix", as the DWARF specification tells us.
The usymfileline testcase didn't hit problems, because its C target only
outputted a simple sequence of special opcodes. It's now C++, as that's
a very easy way to get code generated from a lot of different files and
lines. A simple std::find creates pretty complicated line records, even
in an unoptimized build.
Abegail Jakop [Wed, 19 Aug 2015 22:04:36 +0000 (18:04 -0400)]
stringtable.h: add logical ops and to_string if needed
when it comes to string_ref, boost 1.53 doesn't contain all the
logical operations that we need, nor to_string(). so we'll fill in
the gaps with our own defintions for interned_string.
Martin Cermak [Wed, 19 Aug 2015 18:20:36 +0000 (20:20 +0200)]
Update syscall tapset documentation to use cached content.
Before this update syscall tapset autodocumentation has been
generated dynamically at the build time using stap -L call.
This way stap requires kernel-devel RPM matching `uname -r`
which is tricky to achieve in koji. For this reason the content
is cached from now on:
jistone pointed out a possible problem in the interned_string
implementation; we break the tie in favour of trivial c_str()
(since commit 3e4547ad096d showed its value).
Abegail Jakop [Fri, 14 Aug 2015 20:42:33 +0000 (16:42 -0400)]
alternate interned_string if no boost::string_ref
string_ref was only introduced in boost 1.53, meaning rhel 5 and 6
might not have a recent enough version. to account for this, if
string_ref is not available, fall back on an alternate definition
of interned_string that uses std::string instead.
Some of the tapset*cxx functions were used to representing empty
function / file names with NULL char*s. As these are transitioned to
interned_strings, the latter's ctors must be willing to accept those
NULLs and convert them to empty strings. (Adjusting all the callers
to pass "" instead of NULL in those slots is also possible.)
interned_string: drop magic c_str() implementation
It turns out that while it was right for boost::string_ref not to
provide it, we can, because our interned_string's backing stores
are full (read-only) std::strings, which always carry a \0. This
shrinks down our interned_string to 2*sizeof(void*) bytes.
With the richer interned_string API, one can return to the previous
way of finding line boundaries in the input string. While in the
area, we tweak spacing of parse error message lines.
With INTERNED_STRING_INSTRUMENT set, a /tmp/hash.log file is written
out to record each string being interned. Looking through that is a
good way of tuning the hash function, as well as what
staptree/etc. variables are reverted to std::string form. (The hint
is that if strings are hardly ever interned in the log, then maybe
they are not reused either. But that could instead be because they're
being reused exclusively in interned string_ref form, so don't need to
be rehashed.)