Felix Lu [Fri, 18 Mar 2016 18:11:05 +0000 (14:11 -0400)]
Add some monitor mode improvements.
Added an option to pause and resume the script while running to
allow the user to review the output. Previously, a synthetic probe
was being displayed in the probe list, this is now removed.
* elaborate.cxx:
- monitor_mode_write: skip generating probe point
condition for synthetic probes. Add command to resume
and pause all probes.
- semantic_pass: call monitor_mode_{read, write} in init
* staprun/monitor.c: Bind keys for pause and resume.
Frank Ch. Eigler [Fri, 18 Mar 2016 01:24:50 +0000 (21:24 -0400)]
PR19802: hashbench.stp
Rework into the beginning of a hash benchmark suite.
The first test is for plotting 1/2/3-d hash value distributions,
with a bunch of modifiable parameters (use stap "-G param=value").
Frank Ch. Eigler [Thu, 17 Mar 2016 20:19:21 +0000 (16:19 -0400)]
stap dyninst: allow -B option to pass CFLAGS
Formerly, -B (session.kbuildflags) was only used during runtime=kernel
builds. Now it can be used to pass CFLAGS to the compiler run that
builds the generated dyninst-bound stap_FOO.so shared library.
Frank Ch. Eigler [Thu, 17 Mar 2016 20:04:51 +0000 (16:04 -0400)]
dyninst runtime: make ilog2 evaluable even with -O0
While debugging a generated dyninst module, it became an obstacle that
the __builtin_constant_p-guarded ilog2() macro expression failed down
to a ____ilog2_NaN dummy function. With -O0, that function is at least
referenced, thus blocking linkage. We ditch the constant-p checking,
and provide an abort()ing fallback.
Frank Ch. Eigler [Thu, 17 Mar 2016 19:25:19 +0000 (15:25 -0400)]
PR19802: inline murmurhash3 into map-gen.h
Instead of calling into the distributed murmurhash3 function, break it
up so that the map-gen.h hash function inlines it. Each index
(integer or string) is mixed into the hash naturally as though it were
copied into one large contiguous block.
The results show very good dispersion when compared with the kernel
hash_64() function. Evaluating the hash function is somewhat slower
(30%-ish). (Dumbing it down a little bit was attempted a couple of
ways; none were superior enough in dispersion/performance.)
Frank Ch. Eigler [Mon, 14 Mar 2016 01:33:51 +0000 (21:33 -0400)]
PR19802 prototype: switch to murmurhash3
Instead of the kernel's hash_64 and our poor multi-index hash-mixing
function, use a minutely adapted version of Austin Appleby's 32-bit
MurmurHash3 computation. It spreads keys and especially vectors of
keys much better.
Abegail Jakop [Tue, 15 Mar 2016 20:08:20 +0000 (16:08 -0400)]
PR13608: poll checking if the stap server started
systemtap.exp: in proc setup_server, instead of sleeping for 1 second
between starting the server and checking if it started, which
sometimes fails on rhel7, wait and poll whether the stap server has
started.
Abegail Jakop [Tue, 1 Mar 2016 21:14:27 +0000 (16:14 -0500)]
PR13608: --max-compressed-request ## server option
add --max-compressed-request compile server option that takes a value
for the maximum compressed client request size allowed in bytes. The
default, if this option is not used is 5000 bytes.
move the compressed client request size check from check_request_size()
to readDataFromSocket() which will check the expected request size
before the request transmits. Then rename check_request_size()
to be more specific, so check_uncompressed_request_size(). Default
max compressed request size if 5000 bytes.
Abegail Jakop [Thu, 25 Feb 2016 20:28:33 +0000 (15:28 -0500)]
PR13608: add --max-request-size ## option for server
Add an option in the stap server to set the max (uncompressed)
request size in bytesreceived from the client. If it's not set,
the default max request size is 50KB. Then the max compressed
request size is set to be 10% of the max uncompressed size, making
the default 5KB.
Martin Cermak [Mon, 14 Mar 2016 07:39:22 +0000 (08:39 +0100)]
Preserve the working directory within the test.
Test must not change the working directory. Without this update,
when target_compile() failed, test finished with working directory
set to $tmpdir instead of $curdir breaking all subsequent tests:
=====
Running ./systemtap.base/utrace_syscall_args.exp ...
UNTESTED: 64_BIT_UTRACE_SYSCALL_ARGS
Running ./systemtap.base/valid_pid.exp ...
ERROR: ./systemtap.base/valid_pid.exp does not exist.
...
=====
David Smith [Fri, 11 Mar 2016 18:36:18 +0000 (12:36 -0600)]
Fixed PR19799 by making deleting from aggregate arrays more reliable.
* runtime/pmap-gen.c (_stp_pmap_del): Be sure to delete keys from all
cpu's maps.
* runtime/map-gen.c (_stp_map_del_hash): New function.
* testsuite/systemtap.maps/agg_delete.exp: New test case.
* testsuite/systemtap.maps/agg_delete1.stp: Ditto.
* testsuite/systemtap.maps/agg_delete2.stp: Ditto.
Felix Lu [Wed, 9 Mar 2016 14:22:40 +0000 (09:22 -0500)]
Use function overloading in some tapset functions
Documentation for overloaded functions are now merged into
one entry. Some tapset functions are now simplified through
overloading. Instead of having new function names with suffixes
such as "2" or "pid" to indicate extra arguments, the functions
now seem to have optional arguments.
* doc/SystemTap_Tapset_Reference/overload.py: New script to resolve
documentation for overloaded functions.
* tapset/*: Rename some functions.
* testsuite/*: Rename functions in tests.
Remove call to create_tmp_dir() from the main systemtap_session
constructor and call it slightly later, after the cmdline parsing
is finished. Plus modify create_tmp_dir() so that it only creates
the tmpdir if --tmpdir has not been set on the cmdline.
David Smith [Fri, 4 Mar 2016 15:42:34 +0000 (09:42 -0600)]
Make "monitor" mode working with "interactive" mode.
* interactive.cxx (forked_parse_pass): Make sure "monitor" mode is off
while running the parser. Otherwise we can end up with multiple copies
of the monitor synthetic probes.
(forked_semantic_pass): Ditto.
(interactive_mode): Make sure "monitor" mode is off while dumping probe
types.
David Smith [Thu, 3 Mar 2016 19:58:56 +0000 (13:58 -0600)]
Make utrace_syscall_args.exp pass when run on an NFS filesystem.
* testsuite/systemtap.base/utrace_syscall_args.exp: Put all temporary
files in a temporary directory and run the script from there. This makes
the test pass when run from an NFS filesystem.
David Smith [Thu, 3 Mar 2016 19:56:39 +0000 (13:56 -0600)]
Make sure the "dump" options can't be used with -i or --monitor.
* session.cxx (check_options): Make sure the dump options (-l/-L/--dump-*)
can't be used with interactive mode (-i) or monitor mode (--monitor).
* testsuite/parseko/cmdline25.stp: New test.
* testsuite/parseko/cmdline26.stp: Ditto.
David Smith [Wed, 2 Mar 2016 19:27:53 +0000 (13:27 -0600)]
In interactive mode, run the user's script through -p2 after each change.
* interactive.cxx (auto_analyze_opt): Added new class to handle the
"auto_analyze" option. If non-zero, the user's script is run through
pass 2 after every command that modifies the script.
(add_cmd::handler): Added logic to call forked_semantic_pass() if the
auto_analyze option is set.
(edit_cmd::handler): Ditto.
(delete_cmd::handler): Ditto.
(forked_semantic_pass): New function to run the user's script through
pass 2.
(interactive_mode): Add new "auto_analyze" option.
Felix Lu [Tue, 23 Feb 2016 20:38:00 +0000 (15:38 -0500)]
PR18431: Function overloading
A functioncall may now have a variety of implementations
and have the selection happen during runtime. Overloading
by number of parameters during compile time is also
available.
* elaborate.cxx:
- no_var_mutation_during_iteration_check::visit_functioncall:
Adapt to referents list.
- symresolution_info::visit_functioncall: Likewise + sort functioncalls.
- symresolution_info::find_function -> find_functions: Likewise.
- void_statement_reducer::visit_functioncall: Likewise.
- duplicate_function_remover::visit_functioncall: Likewise.
- autocast_expanding_visitor::resolve_functioncall: Likewise.
- typeresolution_info::visit_arrindex: Likewise.
- get_functionsig: Use unmangled name.
* elaborate.h: find_function -> find_functions.
* main.cxx: Set parser user_file indicator flag.
* parse.cxx: Parser user_file flag, accept function declaration
priority label syntax, remove duplicate function name checking,
allow next in functions.
* parse.h: pf_user_file flag.
* common_probe_context.h: New "next" flag.
* session.h: New overload_count map for overload name resolution.
* staptree.cxx:
- functioncall::functioncall: Remove referent initializer list.
- functiondecl::functiondecl: Initialize default function priority.
- functioncall_traversing_visitor::visit_functioncall:
Adapt to referents list.
- deep_copy_visitor::visit_functioncall: Likewise.
* staptree.h:
- functioncall: Now holds list of referents.
- functiondecl: New priority value.
- function_priority_order: New functor for sorting.
* tapset-method.cxx: Adapt to referents list.
* tapsets.cxx: Adapt to referents list.
* parseko/eleven.stp: Invalidated.
* parseko/nineteen.stp: Invalidated.
* parseko/private02.stp: Invalidated.
* semko/fifty.stpL Invalidated.
* systemtap.base/optim_arridx.exp: Make compatible with overloading.
* translate.cxx:
- c_unparser: New fc_counter to generate functioncall end labels.
- c_unparser::emit_function: Reset context next flag, output STAP_NEXT
macro.
- c_unparser::visit_next_statement: Set context next flag, allow next
in functions.
- c_unparser::visit_functioncall: Main overloading logic.
- recursion_info::visit_functioncall: Adapt to referents list.
David Smith [Tue, 1 Mar 2016 19:34:59 +0000 (13:34 -0600)]
Improve the interactive mode "add" command by prompting for more input.
* interactive.cxx (add_cmd::handler): If the user doesn't enter a complete
function or probe definition on the command line, keep prompting him to
do so. We know he's finished when the definition can be parsed without
an error.
(forked_parse_pass): New function.
* tapset/print_stats.stpm: Add prints[1-9] macros.
* parse.cxx (parser::slurp_pp1_param): Also track [ ] nesting
when slurping macro parameters, as commas might appear in there
that need to be relayed rather than interpreted as macro-param
separators.
* testsuite/systemtap.printf/printf_stats.*: New test.
David Smith [Fri, 26 Feb 2016 19:32:27 +0000 (13:32 -0600)]
Add multiarch testing to testsuite/systemtap.base/callee.exp.
* testsuite/systemtap.base/callee.exp: Revamp test case to test all
supported executable sizes on multiarch systems. Standardize on a
4-character indent.
David Smith [Wed, 24 Feb 2016 22:10:16 +0000 (16:10 -0600)]
Fix the threadstacks.stp example and testcase for ppc64.
* testsuite/systemtap.examples/process/threadstacks.stp: Add ppc64 support
by also probing "/lib*/*/libpthread.so.*", since RHEL7 ppc64 puts the
pthread library in /lib64/power8/.
* testsuite/systemtap.base/pthread_stacks.exp: Choose the new stack size
based on architecture, since 0x10000 is invalid for ppc64.
David Smith [Wed, 24 Feb 2016 19:02:55 +0000 (13:02 -0600)]
Update 2 test cases to work on ppc64, which can inline vfs_{read,write}.
* testsuite/systemtap.base/onoffprobe.stp: Switch from probing the return
of vfs_write() (which can be inlined) to probing the return of
syscall.write.
* testsuite/systemtap.base/listing_mode_sanity.exp: Make sure we use
'.call' when listing kernel.function("vfs_read"), since on some kernels
that function can be inlined.
David Smith [Wed, 24 Feb 2016 17:14:41 +0000 (11:14 -0600)]
Get more passes in semok.exp and semko.exp on ppc64.
* dwflpp.cxx (build_kernel_blacklist): Add ppc64-specific
include/asm/io-defs.h file to the blacklist.
* testsuite/systemtap.pass1-4/semko.exp: Make sure vfs_read() doesn't have
an inlined version before running twentytwo.stp.
* testsuite/systemtap.pass1-4/semok.exp (dyninst_kfails): Check for plt
probe support before running plt[12].stp.
David Smith [Tue, 23 Feb 2016 19:23:14 +0000 (13:23 -0600)]
Fix rawhide compile problems in aux_syscalls.stp.
* tapset/linux/aux_syscalls.stp (_stp_siginfo_u): Removed extra "break"
statements that gcc version 6 complains about on rawhide.
(_stp_compat_siginfo_u): Ditto.
William Cohen [Thu, 18 Feb 2016 22:08:12 +0000 (17:08 -0500)]
Accept other error codes returned by socket syscall in socket.c syscall test
On aarch64 the last socket syscall in socket.c return EINVAL rather
than EPROTONOSUPPORT. Adjust the test to be a bit more flexible. An
error is an error.
David Smith [Tue, 16 Feb 2016 20:54:49 +0000 (14:54 -0600)]
Make some small improvements to systemtap.base/callee.exp.
* testsuite/systemtap.base/callee.exp: Made the test more verbose for
debugging purposes. Reports the desired output and shows the compile
commands used.
* testsuite/systemtap.base/callee.inlined.c: Has a better return status so
stap doesn't complain about the target exiting with a non-zero status.
David Smith [Tue, 16 Feb 2016 17:06:58 +0000 (11:06 -0600)]
Fix PR19644 by updating the runtime to handle linux 4.5 commit 8244062ef1.
* runtime/transport/symbols.c (_stp_module_update_self): Handle kernel
change moving module symbol table information into a 'struct
mod_kallsyms'.
* runtime/linux/autoconf-mod_kallsyms.c: New autoconf test.
* buildrun.cxx (compile_pass): Add autoconf test for 'struct
mod_kallsyms'.
Nikolay Borisov [Thu, 11 Feb 2016 15:34:50 +0000 (17:34 +0200)]
Add ability to override kernel release check
In some situation it might be useful to disable checking the
kernel release. This happens when a kernel module is being rebuilt
and then probed. Without this override one has to reboot the machine
with the new kernel (and module) and then use systemtap.
To rectify the situation add a new define STP_NO_VERREL_CHECK,
which disables the relevant code in the resulting systemtap module.
This can be used with the following syntax:
stap -DSTP_NO_VERREL_CHECK script.stp
Signed-off-by: Nikolay Borisov <n.borisov@siteground.com>
David Smith [Fri, 12 Feb 2016 14:42:58 +0000 (08:42 -0600)]
Add a couple of dyninsg KFAILs to buildok-dyninst.exp and semok.exp.
* testsuite/systemtap.pass1-4/buildok-dyninst.exp: Add
buildok/profiletimer.stp as a dyninst KFAIL.
* testsuite/systemtap.pass1-4/semok.exp (dyninst_kfails): Add
semok/transko.stp as a dyninst KFAIL.
David Smith [Fri, 12 Feb 2016 14:21:53 +0000 (08:21 -0600)]
Improve tracepoint support on systems with self-built kernels.
* tapsets.cxx (header_exists): New function
(tracepoint_extra_decls): Look for headers in the kernel build tree and
kernel source tree (instead of just the kernel source tree). On systems
with self-built kernels, we were failing to find tracepoint headers.
* buildrun.cxx (compile_pass): Add kernel build tree directory to include
path.
(make_tracequeries): Ditto.
David Smith [Wed, 10 Feb 2016 19:06:51 +0000 (13:06 -0600)]
Fix PR19560 by improving the relay code.
* staprun/relay.c (reader_thread): Use mutex when accessing state
variable.
(switchfile_handler): Ditto. Also don't send the USR2 signal to the same
thread running the signal handler.
(init_relayfs): Initialize the mutexes.
(close_relayfs): Destroy the mutexes.
David Smith [Wed, 10 Feb 2016 18:49:09 +0000 (12:49 -0600)]
Better test for hardware breakpoint support in the examples.
* testsuite/systemtap.examples/memory/hw_watch_addr.meta: Move the
hardware breakpoint test to the associated tcl file.
* testsuite/systemtap.examples/memory/hw_watch_sym.meta: Ditto.
* testsuite/systemtap.examples/memory/hw_watch_addr.tcl: New file.
* testsuite/systemtap.examples/memory/hw_watch_sym.tcl: New file.