William Cohen [Fri, 12 Mar 2010 16:31:24 +0000 (11:31 -0500)]
langref.tex editing
Reviewed the language reference manual and made editing changes:
-Reorderd sections for better grouping
-Added description of the @defined operation
-Corrected limits for MAXSTRENLEN and number of indices in associate array
-Adjusted language in aggregates section
-Corrected @hist example writeup.
-Make output for @hist avoid page breaks
-Updated information about manpages in "For Futher References" section
Josh Stone [Fri, 12 Mar 2010 01:14:59 +0000 (17:14 -0800)]
Fix the edge-case of MAXTRYLOCK=0
We didn't really have good semantics for what is meant by MAXTRYLOCK=0,
so when skipped.exp tried it, we ended up locking the variable and then
reporting a skip without ever unlocking it.
This is now cleaning up the semantics such that MAXTRYLOCK defines how
many times we should loop if the lock is busy. Thus MAXTRYLOCK=0 means
we try only once and fail immediately.
The testcase was accidentally creating contention due to the broken
unlock behavior. We now have to try a bit harder to create real
contention, so some lengthy delays are inserted to hoard the lock.
* runtime/probe_lock.h (stp_probe_lock): Fix the skip behavior.
* testsuite/systemtap.base/skipped.exp: Add a big udelay.
Josh Stone [Thu, 11 Mar 2010 03:17:40 +0000 (19:17 -0800)]
PR11370: Add multi-header @casts
Sometimes you need multiple headers to fully describe a type, so we now
permit them to be listed together, e.g. "kernel<foo.h><bar.h>".
* buildrun.cxx (make_typequery): Split the input string into a vector.
(make_typequery_kmod, make_typequery_umod): Use the vector of headers.
* testsuite/semok/cast.stp: Add a multi-header case.
* stap.1.in, NEWS: Document it.
William Cohen [Wed, 10 Mar 2010 20:53:32 +0000 (15:53 -0500)]
PR 11210 move stapprobe.* man pages to tapset::*
make on RHEL-5 and earlier cannot deal with the :: in the man page names.
This work around uses the install-data-local rule to install the
manpages to avoid confusing the older versions of make.
Josh Stone [Tue, 9 Mar 2010 23:32:58 +0000 (15:32 -0800)]
PR11360: Make @defined and -L play nice
The constant-folding is now enabled for s.listing_mode_vars, despite all
other optimizations being disabled. This is needed so we can prune any
invalid branches that are gated by @defined.
* elaborate.cxx (semantic_pass): Leave the optimization decision to the
optimization passes themselves.
(semantic_pass_optimize1): Predicate most optimizations, but enable the
constant-folding for listing_mode_vars too.
(semantic_pass_optimize2): Predicate all (1) optimizations.
* testsuite/semok/defined_list_vars.stp: New test.
David Smith [Tue, 9 Mar 2010 17:51:10 +0000 (11:51 -0600)]
Fix PR 11363 by using logrotate to ensure logfile doesn't grow too large.
* initscript/logrotate.stap-server: Add logrotate config file to make sure
stap-server logfile doesn't grow too large.
* systemtap.spec: Install logrotate config file. Also follow
<https://fedoraproject.org/wiki/PackagingDrafts/Logfiles> to correctly
create the logfile.
William Cohen [Tue, 9 Mar 2010 16:05:25 +0000 (11:05 -0500)]
PR 11210 Eliminate man page collisions
The various man pages for each systemtap probe and function
are prepended with "probe::" and "function::" respectively to avoid
collisions with other man3 pages with the same name. For example
systemtap's strlen function was colliding with glibc's strlen function.
Dave Brolley [Mon, 8 Mar 2010 19:37:06 +0000 (14:37 -0500)]
PRs 11205, 11309: Specfile problems for stap-server:
- Use assigned gid/uid of 155/155 for stap-server.
- Create stap-server group in main systemtap rpm.
- Make uprobes runtime directory read/write/search by members
of stap-server group in main systemtap rpm.
- Keep stap-server log in %{_localstatedir}/log/stap-server/log
David Smith [Mon, 8 Mar 2010 19:38:51 +0000 (13:38 -0600)]
PR 11338 (partial): Used '@defined()' in tty, scheduler, and vfs tapsets.
* tapset/tty.stp: Used '@defined()' to remove kernel version checks.
* tapset/scheduler.stp: Ditto.
* tapset/vfs.stp: Used '@defined()' to remove kernel version checks. Also
made several probe points optional instead of using kernel version
checks to know when to include them.
* testsuite/buildok/vfs_testcase.stp: Removed stap '-u' (unoptimized mode)
switch, since '@defined()' doesn't work in unoptimized mode.
Josh Stone [Sat, 6 Mar 2010 21:08:22 +0000 (13:08 -0800)]
Move semko/nineteen.stp to semok
The *ko tests are for things that SHOULD fail, but semko/nineteen is a
test that should pass but often doesn't (due to inline var trouble). It
should be in semok to set the expectation properly.
It does pass on F12 now, but if we want to silence the error for older
gcc, setup_kfail is the right approach.
Josh Stone [Sat, 6 Mar 2010 19:41:49 +0000 (11:41 -0800)]
PR11352: Assign tokens to all SDT-synthesized elements
* tapsets.cxx (sdt_query::convert_probe): Fix a few missing tokens.
(sdt_var_expanding_visitor::visit_target_symbol): Ditto.
* translate.cxx (c_unparser::record_actions): Add a defensive check,
which perhaps someday can be an assertion instead.
Josh Stone [Sat, 6 Mar 2010 01:24:41 +0000 (17:24 -0800)]
PR11342: Ensure that last_stmt is always set
* translate.cxx (c_unparser::record_actions): Take a token to fill in
last_stmt for MAXACTION errors.
(c_unparser::*): Pass a token to record_actions.
(c_unparser::visit_try_block): The try/catch blocks are also basic
blocks, so they should flush record_actions when done.
(c_unparser_assignment::c_assignop): Set last_stmt for /= and %=.
(c_unparser::visit_foreach_loop): Set last_stmt for agg. overflow.
(c_unparser::visit_print_format): Set last_stmt for %m errors.
David Smith [Fri, 5 Mar 2010 19:31:12 +0000 (13:31 -0600)]
Improved 'mm_struct' casting for RHEL5.
* tapset/context.stp: Improved casting to 'mm_struct' on RHEL5 by changing
the header file referenced from '<linux/mm_types.h>' to
'<linux/sched.h>' (since mm_types.h doesn't exist on RHEL5). On newer
kernels, sched.h includes mm_types.h.
* tapset/proc_mem.stp: Ditto.
David Smith [Fri, 5 Mar 2010 17:14:46 +0000 (11:14 -0600)]
PR 11338 (partial): Used '@defined()' in syscall tapsets.
* tapset/syscalls.stp: Used '@defined()' to remove kernel version checks.
* tapset/syscalls2.stp: Ditto.
* tapset/x86_64/syscalls.stp: Ditto.
* tapset/nd_syscalls.stp: Updated to match tapset/syscalls.stp.
* tapset/nd_syscalls2.stp: Updated to match tapset/syscalls2.stp.
* tapset/x86_64/nd_syscalls.stp: Updated to match
tapset/x86_64/syscalls.stp.
Mark Wielaard [Thu, 25 Feb 2010 21:06:42 +0000 (22:06 +0100)]
git_version.sh: Don't unnecessarily write to builddir during make install.
Ideally make install wouldn't touch the src or build dirs. When the build
dir is mounted so root cannot write to it a make install would fail
because git_version.sh tried to create a temporary file. Fix by creating
temporary git_version.h.new file in temp dir.
* git_version.sh: Create temp dir and git_version.h.new outside src
and build dir. Change all occurances of $outfile.new to $outfilenew.
Josh Stone [Tue, 2 Mar 2010 23:57:58 +0000 (15:57 -0800)]
PR11246 cont'd: Add options for cache control
--disable-cache : turn off all caching
--clean-cache : clean up stale entries and then quit
--poison-cache : force regeneration of items that would have hit the cache
These are undocumented for now, until we decide whether they are
generally useful.
* main.cxx (main): Parse the new options.
* session.h (systemtap_session): Add poison_cache; document the others.
* clean.cxx (clean_cache): No longer static.
(get_stapconf_from_cache, get_script_from_cache): Respect poison.
* tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto.
(dwarf_cast_expanding_visitor::filter_special_modules): Ditto.
Josh Stone [Tue, 2 Mar 2010 02:42:18 +0000 (18:42 -0800)]
PR11246 cont'd: Separate script/stapconf caching
I'm separating the caching and creation logic for stapconf, so it can be
conditionalized on s.use_cache instead of s.use_script_cache.
* session.h (systemtap_session): Store base_hash for better reuse.
* hash.cxx (get_base_hash): Get the base from the session, or build it.
(find_hash): Split into separate script/stapconf versions.
* cache.cxx (add_to_cache, get_from_cache): Ditto.
* main.cxx (main): Adapt caller, and delay stapconf until pass-4.
Josh Stone [Tue, 2 Mar 2010 01:27:53 +0000 (17:27 -0800)]
PR11246: Add more granular cache control
There are some module options that require us to disable caching for the
script, but before now this had a global effect. There are some cache
objects, like tracepoint and @cast query modules, which we would like to
cache even when the script itself needs to be uncached.
* session.h (systemtap_session): New use_script_cache flag.
* main.cxx (main): -m & -k can just disable the script cache. Failure to
create the cache directories still disables all caching.
* hash.cxx (create_hashdir): Failure disables all caching.
* cache.cxx (add_to_cache): Failure only toggles the script caching. If
the stapconf fails though, we don't need to block the .ko reuse.
David Smith [Mon, 1 Mar 2010 21:17:09 +0000 (15:17 -0600)]
Fixed PR 11336 by using a wait queue to wait on procfs file availability.
* runtime/procfs-probes.c: Removed old kernel 2.6.16 code. Simplified
_spp_lock macros.
(_stp_proc_open_file): If file is busy, use a wait queue to wait on it
being available.
(_stp_proc_release_file): Decrease open count.
* tapset-procfs.cxx (emit_module_init): Updated procfs probe
initialization/shutdown routine names.
(emit_module_exit): Ditto.
Josh Stone [Sat, 27 Feb 2010 00:25:45 +0000 (16:25 -0800)]
Squash elision warnings on synthetic functions
* staptree.h (functiondecl): Add a synthetic flag.
* elaborate.cxx (semantic_pass_opt1): Don't warn about synthetic funcs.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Mark
the new function as synthetic.
(dwarf_cast_expanding_visitor::visit_cast_op): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
* tapset-perfmon.cxx
(perfmon_var_expanding_visitor::visit_target_symbol): Ditto.
* tapset-procfs.cxx (procfs_var_expanding_visitor::visit_target_symbol):
Ditto.
* testsuite/semok/thirtyeight.stp: New check with -W and @defined.
Josh Stone [Fri, 26 Feb 2010 00:20:50 +0000 (16:20 -0800)]
Expand @defined to support more cases
* tapsets.cxx (var_expanding_visitor::visit_defined_op): If no error was
raised or replacement made on a target_symbol, then its @defined state
is still indeterminate. Some later pass (like @cast) might handle it.
* elaborate.cxx (const_folder::visit_defined_op): Squash any escapees.
* testsuite/semok/thirtysix.stp: Add more variants.
Josh Stone [Thu, 25 Feb 2010 23:15:19 +0000 (15:15 -0800)]
PR11326: Make an early check for saved-return-$var validity
We now check validity *before* the entry-probe is generated, so invalid
$vars have a chance to be properly optimized without error.
* tapsets.cxx
(dwarf_var_expanding_visitor::visit_target_symbol_saved_return):
Attempt variable expansion immediately, and skip out on failure.
* testsuite/semok/thirtysix.stp: unblock the previously broken part.
Josh Stone [Thu, 25 Feb 2010 00:43:06 +0000 (16:43 -0800)]
PR10719 cont'd: const-fold logical ops
We can compute results between two literals, we can short-circuit some
literals on the left ("0&&x", "1||x"), and we can simplify literals on
the right if the left has no side effect ("x&&0", "x||1").
Josh Stone [Sat, 20 Feb 2010 02:32:52 +0000 (18:32 -0800)]
PR10719 part 1: Partial constant folding
This implements constant folding for if/for/foreach, unary expressions,
and ternary expressions. Binary expressions are TODO...
* elaborate.cxx (const_folder): New visitor to collapse constants.
(semantic_pass_const_fold): Drive everything through const_folder.
(semantic_pass_optimize1): Call it.
David Smith [Tue, 23 Feb 2010 21:57:25 +0000 (15:57 -0600)]
Fixed PR 11269 by properly handling mmap syscall 'fd' argument.
* testsuite/systemtap.syscall/mmap.c (main): Added mprotect and mremap
testing (along with testing of anonymous maps).
* tapset/i386/syscalls.stp: In mmap probes, handle the fact that the
kernel gets an unsigned long 'fd', but the user-side passes a signed
int.
* tapset/i386/nd_syscalls.stp: Ditto.
* tapset/ia64/syscalls.stp: Ditto.
* tapset/powerpc/nd_syscalls.stp: Ditto.
* tapset/powerpc/syscalls.stp: Ditto.
* tapset/x86_64/nd_syscalls.stp: Ditto.
* tapset/x86_64/syscalls.stp: Ditto.
David Smith [Tue, 23 Feb 2010 18:48:49 +0000 (12:48 -0600)]
PR 10690 (partial fix). Handle '.=' operator in procfs probes.
* tapsets.h (var_expanding_visitor): Add 'valid_ops' and 'op' member
variables.
* tapsets.cxx (var_expanding_visitor::var_expanding_visitor): Set
'valid_ops' to '='. By default, var_expanding_visitor classes only
handle the '=' operator.
(var_expanding_visitor::visit_assignment): Remember what operator we're
handling. When an operator is found that isn't in the 'valid_ops' set,
error.
* tapset-procfs.cxx
(procfs_var_expanding_visitor::procfs_var_expanding_visitor): Add '.='
to the 'valid_ops' set.
(procfs_var_expanding_visitor::visit_target_symbol): Handle the '.='
operator when the target variable is an lvalue.