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.
Josh Stone [Thu, 7 Feb 2013 21:02:30 +0000 (13:02 -0800)]
PR14706: Add proto-exec support in stapdyn
This adds preliminary support for stapdyn to follow execs, but the code
it instrument the new process is currently blocked out. I'm seeing
dyninst hang during loadLibrary, waiting for IRPC, but haven't yet
figured out why.
* stapdyn/mutatee.cxx (mutatee_freezer): New helper to automatically
stop a process and then continue it when leaving that scope.
(mutatee::begin_callback): Use a mutatee_freezer.
(mutatee::thread_callback): Use a mutatee_freezer.
(mutatee::copy_forked_instrumentation): Use two mutatee_freezers.
(mutatee::instrument_dynprobes): Support a flag to indicate this is
post-exec, so first run any process.end probes from before exec.
(mutatee::exec_reset_instrumentation): New, clear all members that are
invalidated by the process exec.
* stapdyn/mutator.cxx (g_exec_callback): New global callback for execs.
(mutator::exec_callback): New specific callback for execs. Clear old
instrumentation, then instrument it anew (buggy, #if 0 for now).
David Smith [Thu, 7 Feb 2013 17:52:06 +0000 (11:52 -0600)]
Clean up mutatee::stop_execution() logic.
* stapdyn/mutatee.cxx (mutatee): Removed unneeded 'patch' argument.
(stop_execution): Remove logic that waited on the process to stop, since
process->stopExecution() is synchronous.
* stapdyn/mutatee.h: Update prototypes.
* stapdyn/mutator.cxx: Update mutatee constructor calls.
David Smith [Wed, 6 Feb 2013 22:18:23 +0000 (16:18 -0600)]
Save and restore 'errno' in dyninst probes.
* tapsets.cxx (common_probe_entryfn_prologue): In dyninst mode, save errno
at the start of the probe.
(common_probe_entryfn_epilogue): In dyninst mode, restore errno at the
end of the probe.
Josh Stone [Tue, 5 Feb 2013 21:17:16 +0000 (13:17 -0800)]
Add kprobe.function.call, and squash nd_syscall.exit.return
* tapsets.cxx (register_standard_tapsets): Bind kprobe .call variants.
* man/stapprobes.3stap: Document this new possibility.
* tapset/linux/nd_syscalls.stp: Use .call to make sure that alias
suffixes can't tack a .return on nd_syscall.exit and .exit_group.
Josh Stone [Tue, 5 Feb 2013 19:31:37 +0000 (11:31 -0800)]
Add [nd_]syscall.ustat32.return
This adds the proper .return aliases for the syscall.ustat32 entry
aliases, rather than having them as part of syscall.ustat.return, so
way the entry/return probes are properly balanced. It also makes sure
that wildcards like syscall.ustat** don't end up in an incomplete
ustat.return probe due to implicit alias suffixes.
I considered wrapping this with version-compatibility checks, but IMO
the former behavior was broken enough that it isn't worth it.
* tapset/linux/syscalls2.stp: Split out syscall.ustat32.return.
* tapset/linux/nd_syscalls2.stp: Split out nd_syscall.ustat32.return.
* testsuite/buildok/syscalls2-detailed.stp: Test ustat32.return.
* testsuite/buildok/nd_syscalls2-detailed.stp: Test ustat32.return.
David Smith [Fri, 1 Feb 2013 17:01:40 +0000 (11:01 -0600)]
Fixed PR11955 by updating the signal tapset.
* tapset/linux/signal.stp (signal.send): Now uses the 'signal_generate'
tracepoint where available. Deprecated the 'send2queue' variable.
(signal.send.return): Deprecated.
(signal.handle): Now uses the 'signal_deliver' tracepoint where
available. Deprecated the 'oldset_addr' and 'regs' variables.
(signal.handle.return): Deprecated.
* testsuite/buildok/signal-detailed.stp: Updated with 'signal.send',
'signal.send.return', and 'signal.handle.return' deprecations.
* NEWS: Added deprecation notes.
Josh Stone [Thu, 31 Jan 2013 02:52:09 +0000 (18:52 -0800)]
PR14574 partial: Let stapdyn tests run despite the kernel
Some tests are guarded by [uprobes_p] or [uretprobes_p] before they're
allowed to run, but --runtime=dyninst cares not for such features.
Rework these tests so the kernel features are more tightly considered
only right before running in kernel mode.
Josh Stone [Wed, 30 Jan 2013 20:20:41 +0000 (12:20 -0800)]
PR14705: Modify SDT semaphores in stapdyn
For SDT probes which are guarded by a semaphore, stapdyn needs to update
the value to show when the probes are active.
* stapdyn/mutatee.h (mutatee::semaphores): New vector of variables in
this mutatee which represent active semaphores.
* stapdyn/mutatee.cxx (mutatee::update_semaphores): New, used to
increment or decrement the value of semaphores in this mutatee.
(mutatee::instrument_dynprobe_target): When a probe has a semaphore,
create a variable representation of it.
(mutatee::instrument_object_dynprobes): Increment semaphores in bulk.
(mutatee::copy_forked_instrumentation): Copy semaphore variables too.
(mutatee::remove_instrumentation): Decrement semaphores in bulk.
* tapsets.cxx (sdt_query::handle_query_module): Calculate the difference
in load addresses between .text and .data as semaphore_load_offset.
(sdt_query::record_semaphore): Subtract the semaphore_load_offset for
dyninst to get a file-based offset of the semaphore.
David Smith [Wed, 30 Jan 2013 21:11:48 +0000 (15:11 -0600)]
Add better cleanup to a setjmp.exp and statement.exp.
* testsuite/systemtap.base/setjmp.exp: Cleanup test programs. Allow the
user to override this using the '-v' vebose flag.
* testsuite/systemtap.base/statement.exp: Ditto.
Frank Ch. Eigler [Wed, 30 Jan 2013 14:41:34 +0000 (09:41 -0500)]
testsuite: conditionalize client-server tests on feature: NSS
* testsuite/lib/systemtap.exp (nss_p): New test proc.
(dyninst_p): Switch to globals instead of $env().
(setup_server): Use it.
* testsuite/systemtap.server/*.exp: Do an [nss_p] test early on.
Frank Ch. Eigler [Tue, 29 Jan 2013 21:25:03 +0000 (16:25 -0500)]
testsuite: fix systemtap.examples/check.exp to properly CHDIR back & forth
A failed test_check fragment (such as from virtualization/*.meta)
could result in loss of the original pwd=$builddir/testsuite, because
the loop neglected to restore the old pwd ($curdir) before
"continue"'ing. We now save & restore $pwd outside the loop in
addition to the intra-loop cwd twitchery.
Serguei Makarov [Fri, 25 Jan 2013 19:18:06 +0000 (14:18 -0500)]
PR11334: testsuite tweaks for merge
Keeping the separate re2c-migrate testsuite at the moment.
(I tried putting together a systemtap script with the testsuite,
but it winds up being too unwieldy, and I couldn't figure out
a good way to be able to switch it to 'one Expect test per regex'
mode on demand. Will get rid of separate regcomp testsuite once
I figure it out.)