Josh Stone [Tue, 12 Mar 2013 02:08:49 +0000 (19:08 -0700)]
Add options to help benchmark SDT
These are secret, undocumented, for developer use only. Use stap
inception-style as the -c CMD of a stap which probes the SDT mark
process.provider("stap").mark("benchmark").
--benchmark-sdt-loops=N
Loop over the SDT probe point N times.
--benchmark-sdt-threads=N
Run the loop simultaneously in N threads.
Josh Stone [Tue, 12 Mar 2013 02:01:27 +0000 (19:01 -0700)]
stapdyn: fix the context->data_index
This regressed in commit c08bf9de, which lost the initialization of that
field. Thus there was a data race in pmaps, stats, etc. in writing to
data_index 0, rather than the true index of the currently-owned context.
Lukas Berk [Fri, 8 Mar 2013 20:47:27 +0000 (15:47 -0500)]
Allow spin-rawhide to update systemtap.spec with upstream changes
*scripts/spin-rawhide: add diff between spec files and prompt if
there are changes and if the user would like
to patch the sytemtap.spec file. Alter
changelog entry accordingly
systemtap.spec: move some -server install scripting to %post
Specifically, the creation of the ~stap-server/.systemtap/rc file
should be attempted only after the files/directories have been created
and the stap-server account made. Also, rpm-visibly create the
~stap-server/.systemtap subdirectory.
testsuite: impose stap --rlimit-cpu=300 throughout
Use the testsuite/.systemtap-*/rc file to impose cpu limits on stap
processes, considering PR15144 (which results in a spinning/hung
stapdyn child process).
* runtime/linux/autoconf-hlist-4args.c: New test.
* buildrun.cxx (compile_pass): Run it to set STAPCONF_HLIST_4ARGS.
* runtime/linux/runtime.h: Use it to define stap_hlist_* the old way
or the new.
* runtime/*: Adapt by going through new stap_hlist* iterators.
* runtime/uprobes*/*: Don't bother adapting this old-kernel-only code base.
These were found empirically. Some of the functions look innocent but
they are called from functions marked with __kprobes so they still
cause crashes. Further analysis is available at
https://lkml.org/lkml/2013/2/27/82 ("kprobing "hash_64.constprop.26"
crashes the system, recursion through get_kprobe?").
David Smith [Thu, 28 Feb 2013 16:50:18 +0000 (10:50 -0600)]
Fix PR15211 by updating the testsuite for kernel 3.8.
* testsuite/systemtap.syscall/openclose.c: Handle 'creat()' being mapped
to 'creat()' or 'open(FILE, O_CREAT)' in the kernel.
* testsuite/systemtap.syscall/stat.c: Ditto.
* testsuite/systemtap.syscall/test.tcl: Map '!!!!' to '|'.
* testsuite/systemtap.syscall/README: Document the new '!!!!' substitute
for '|'.
David Smith [Tue, 26 Feb 2013 20:21:00 +0000 (14:21 -0600)]
Fix PR15198 by handling new kernel option CONFIG_GENERIC_SIGALTSTACK.
* tapset/linux/syscalls2.stp: Added generic 'sigaltstack' probe alias for
when CONFIG_GENERIC_SIGALTSTACK is set.
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/s390/nd_syscalls.stp: Added 'nd_syscall.sigaltstack',
'nd_syscall.sigaltstack.return', 'nd_syscall.sys32_sigaltstack', and
'nd_syscall.sys32_sigaltstack.return' probe aliases.
* tapset/linux/i386/syscalls.stp: Only use arch-specific 'sigaltstack'
probe alias if CONFIG_GENERIC_SIGALTSTACK isn't set. Deprecate 'regs'
variable.
* tapset/linux/ia64/syscalls.stp: Ditto.
* tapset/linux/powerpc/nd_syscalls.stp: Ditto.
* tapset/linux/powerpc/syscalls.stp: Ditto.
* tapset/linux/s390/syscalls.stp: Ditto.
* tapset/linux/x86_64/nd_syscalls.stp: Ditto.
* tapset/linux/x86_64/syscalls.stp: Ditto.
* tapset/linux/i386/nd_syscalls.stp: Only use arch-specific 'sigaltstack'
probe alias if CONFIG_GENERIC_SIGALTSTACK isn't set.
* tapset/linux/ia64/nd_syscalls.stp: Ditto.
* testsuite/buildok/syscalls-arch-detailed.stp: Only test
the arch-specific 'sigaltstack' probe alias if
CONFIG_GENERIC_SIGALTSTACK is not set. Handle 'regs' deprecation.
* testsuite/buildok/syscalls-arch-detailed.stp: Ditto.
* testsuite/buildok/syscalls2-detailed.stp: Added generic 'sigaltstack'
probe alias test for when CONFIG_GENERIC_SIGALTSTACK is set.
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto.
* NEWS: Mention 'regs' deprecation.
David Smith [Fri, 22 Feb 2013 20:34:48 +0000 (14:34 -0600)]
Actually deprecate items marked as deprecated in vfs.stp.
* tapset/linux/vfs.stp: Several items in vfs.stp had a comment saying they
were deprecated. Acutally make it happen. Deprecate the 'ppos_pos',
'_dev_minor', and '_dev_major' functions. Deprecate the 'page_index'
variable in the 'vfs.block_sync_page' and 'vfs.buffer_migrate_page'
probe aliases. Deprecate the 'write_from' and 'write_upto' variables in
the '_vfs.block_prepare_write' and '_vfs.block_prepare_write.return'
probe aliases.
* testsuite/buildok/vfs-embedded.stp: Handle 'ppos_pos' deprecation.
* testsuite/systemtap.examples/io/iodevstats.stp: Switch from deprecated
'_dev_minor' and '_dev_major' functions to supported 'MINOR' and 'MAJOR'
functions.
* NEWS: Mention deprecations.
Frank Ch. Eigler [Wed, 20 Feb 2013 02:00:04 +0000 (21:00 -0500)]
translator: tolerate unavailable System.map
On some linux distros, the System.map file is unreadable to unprivileged
users. systemtap should not overreact to this and assume that the whole
kernel-devel/header world is uninstalled. Just print a warning and move on.
Josh Stone [Tue, 19 Feb 2013 01:55:46 +0000 (17:55 -0800)]
PR15162: Don't output anything at all for skipped unwind tables
* translate.cxx (dump_unwindsym_cxt_table): New common function to
output an unwind table. It checks against MAX_UNWIND_TABLE_SIZE and
nulls out those that are skipped, so they're truly skipped everywhere.
(dump_unwindsym_cxt): Use dump_unwindsym_cxt_table for all four unwind
tables: debug_frame, debug_frame_hdr, eh_frame, and eh_frame_hdr.
Josh Stone [Sat, 16 Feb 2013 20:26:04 +0000 (12:26 -0800)]
PR11341: Fix two improper update_visitor assignments
Both are cases where a too-specific require<target_symbol> was used,
inferred by the parameter type. The result is immediately saved as a
generic expression pointer, so require<expression> is appropriate.
I believe this case is such that there was actually no harm caused here
by the formerly blithe static_cast, but it's still nice to see that such
improprieties are now detected.
Josh Stone [Sat, 16 Feb 2013 03:05:25 +0000 (19:05 -0800)]
PR11341: Add type safety to update_visitor::require()
This uses dynamic_cast<T*> to make a runtime check that the pointer that
was given to update_visitor::provide() is compatible with what the
caller required. Such a cast can't be used on void*, so the ::stack is
now composed of 'visitable' pointers - a new base class for expressions
and statements.
In the process, 'indexable' is now also brought into the expression
hierarchy. This looks a little odd since hist_op isn't really an
expression on its own, but otherwise this change untangles a lot of code
trying to deal with hist_op as an outlier, especially visit and print.
* staptree.h (update_visitor::require): Use dynamic_cast<> instead of a
dangerous static_cast<>, and throw exceptions for bad cases.
(struct visitable): New base class for expression and statement.
(struct indexable): Use expression as a base class, and get rid of the
now-unnecessary visit/print/tok middleman methods.
* staptree.cxx: Use direct indexable->visit/print/tok throughout.
* elaborate.cxx, parse.cxx: Ditto.
Frank Ch. Eigler [Fri, 15 Feb 2013 21:41:19 +0000 (16:41 -0500)]
systemtap.spec: hard-code systemtap instead of most usese of %{name}
... since we'll never change the project name, ever, ever, ever.
(And those special software-collection builds that do change %{name},
we don't want effecting these derived rpm strings, mostly.)
Lukas Berk [Fri, 15 Feb 2013 21:44:23 +0000 (16:44 -0500)]
Still install systemtap rc.d files when systemd is enabled
*systemtap.spec: remove systemtap portions from 'with_systemd'
conditionals so they are still installed even if
stap-server is using systemd. They should not be
combined.
Josh Stone [Thu, 14 Feb 2013 03:54:13 +0000 (19:54 -0800)]
Abstract the synthesizing of deref functions
Frank first noted the duplication in how we synthesize functions for
derefs, and I found there were four sites doing nearly the same thing.
A quick bit of abstraction relieves this.
* tapsets.cxx (synthetic_embedded_deref_call): New common code to create
a functiondecl for a code block and the functioncall to use it.
(dwarf_pretty_print::deref, dwarf_cast_query::handle_query_module,
tracepoint_var_expanding_visitor::visit_target_symbol_arg,
dwarf_var_expanding_visitor::visit_target_symbol): Use it.
Frank Ch. Eigler [Wed, 13 Feb 2013 02:32:30 +0000 (21:32 -0500)]
PR15123: work around broken gcc debuginfo for -mfentry functions
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54793 interferes with the
calm zen-like state of probing function parameters in programs built
with CFLAGS=-mfentry, due to a dwarf location-list problem. This
patch adds a heuristic function dwflpp::pr15123_retry_addr() that
offers callers a post-mfentry-address alternative for locating
variables. Will they use it, or not? Join us next week, as our
heroes encounter ... angry mr. dwarf, five steps away.
* dwflpp.cxx (pr15123_retry_addr): New function.
(translate_location): Call it, in order to enable $var
and $$parms resolution.
* tapsets.cxx (saveargs): Call it, in order to enable
stap -L <probe> listings.
Dave Brolley [Tue, 12 Feb 2013 19:33:26 +0000 (14:33 -0500)]
RHBZ 906061, PR15112: Fix handling of scope specifiers/ids for IPv6 addresses.
- Do not assume a scope specifier of "%eth0" when one is not specified.
- Copy the scope_id to addresses which don't have one when merging server
information.
- Provide additional diagnostic when a link-local IPv6 address is used
without a scope specifier.
- Don't reqauire a server specified by address and port to be previously known
by avahi.
- Add informational messages tracing server resolution at various -v levels.
Josh Stone [Mon, 11 Feb 2013 22:30:48 +0000 (14:30 -0800)]
stap: Add shorthand option --dyninst for --runtime=dyninst
* cmdline.cxx: Define --dyninst as LONG_OPT_RUNTIME_DYNINST.
* session.cxx (systemtap_session::parse_cmdline_runtime): Pull out the
code to set the runtime option.
(systemtap_session::parse_cmdline): Use parse_cmdline_runtime for both
LONG_OPT_RUNTIME and LONG_OPT_RUNTIME_DYNINST.
(systemtap_session::usage): Document --dyninst.
* man/stap.1: Document --dyninst.
Josh Stone [Fri, 8 Feb 2013 20:58:56 +0000 (12:58 -0800)]
stapdyn: Validate that probe flags are known
If we see unknown flags, we don't want to do the wrong thing with a
probe. So just warn about it and move on without it.
* runtime/dyninst/stapdyn.h: Introduce STAPDYN_PROBE_ALL_FLAGS combining
all the currently-known flags. Also, shift the values of the utracey
flags to leave some room for more uprobey flags.
* stapdyn/dynprobe.cxx (dynprobe_location::validate): New, make sanity
check on the probe. For now, this just means checking that the flags
are within those we know about.
Josh Stone [Fri, 8 Feb 2013 00:43:21 +0000 (16:43 -0800)]
stapdyn: Make sure interprocess maps share hash seeds
We were using a random stap_hash_seed that was initialized separately in
each process. This meant that different processes would compute
different hashes for the same keys. Now the hash seed is stored in the
shared memory, so all participating processes can use maps together.
* runtime/dyninst/common_session_state.h: Add the hash seed to struct
stp_runtime_session, and provide _stap_hash_seed() to read it.
Initialize it one time only in stp_session_init().
* runtime/dyninst/runtime.h: Define the former stap_hash_seed to use
_stap_hash_seed() from shared memory instead.
* testsuite/systemtap.maps/map_hash_interprocess.*: Test the specific
interprocess, manually-keyed conditions that revealed the bug.
Josh Stone [Thu, 7 Feb 2013 23:42:47 +0000 (15:42 -0800)]
stapdyn: Seed _stp_random_u with more "precision"
Use clock_gettime() rather than time(). It's still not necessarily
great to seed from a time-based source, but at least nanosecond
resolution is a little better.