David Smith [Tue, 7 Apr 2009 13:23:14 +0000 (08:23 -0500)]
PR 9940. Rearchitected task_finder.c a bit.
2009-04-07 David Smith <dsmith@redhat.com>
PR 9940.
* tapsets.cxx (emit_vma_callback_probe_decl): Initialized new
callbacks.
(utrace_derived_probe_group::emit_probe_decl): Ditto.
(uprobe_derived_probe_group::emit_module_decls): Uses new
callback. Makes sure mapping is executable before trying to set a
probe in it.
(itrace_derived_probe_group::emit_module_init): Calls
_stp_sym_init().
(utrace_derived_probe_group::emit_module_init): Ditto.
(uprobe_derived_probe_group::emit_module_init): Ditto.
* runtime/sym.c: Moved task_finder_vma.c inclusion here from
task_finder.c.
(_stp_sym_init): New function.
(_stp_tf_mmap_cb): New function that replaces _stp_tf_vm_cb.
(_stp_tf_munmap_cb): Ditto.
* runtime/task_finder.c: Removed task_finder_vma.c inclusion.
Split vm_callback into 3 callbacks: mmap_callback,
munmap_callback, and mprotect_callback.
(stap_register_task_finder_target): Initializes new events
variables for the new callbacks.
(__STP_TASK_VM_BASE_EVENTS): No longer specifies syscall entry
events.
(__stp_call_mmap_callbacks): New function.
(__stp_call_mmap_callbacks_with_vma): Ditto.
(__stp_call_munmap_callbacks): Ditto.
(__stp_call_mprotect_callbacks): Ditto.
(__stp_call_vm_callbacks): Removed.
(__stp_utrace_task_finder_target_quiesce): Calls
__stp_call_mmap_callbacks() instead of __stp_call_vm_callbacks().
(__stp_utrace_task_finder_target_syscall_entry): Removed
function.
(__stp_utrace_task_finder_target_syscall_exit): Reports raw
mmap()/mprotect()/munmap() events.
Josh Stone [Mon, 6 Apr 2009 23:11:30 +0000 (16:11 -0700)]
PR10026: Read marker/tracepoint args directly
We already stash the context variables for markers and tracepoints into
the locals for the probe body, but then we were using separate functions
to read those locals for each particular probe body.
This patch instead teaches the unparser how to emit the local name
directly for those context variables. The resulting code from the
translator is much simpler now.
Josh Stone [Fri, 3 Apr 2009 21:50:18 +0000 (14:50 -0700)]
PR5163: Assign need_uprobes during pass-2
We were doing this in pass-3, which means it was never set for cached
runs, and so staprun didn't get the -u flag. Now need_probes is set as
soon as a uprobe_derived_probe is saved into the session in pass-2.
Josh Stone [Fri, 3 Apr 2009 20:32:22 +0000 (13:32 -0700)]
PR10032: Trigger cleanup after relay thread errors
When the relay threads encounter an error, they now send SIGTERM to the
rest of the process before the thread exit, so we get a clean shutdown.
For EPIPE in particular, error messages are also suppressed.
This updates the example scripts to use the new ANSI escape sequences
tapset. It also adds the copyright header that was missing in
ansi_colors.stp for a long time.
This adds a new tapset for ANSI escape sequences. It is based on an
existing tapset that was written by Masami Hiramatsu for the stapgames
project. This also adds a version of ansi_color.stp script that displays
other attributes other than the bold effect.
This adds an errno_p() function that will return an absolute errno if it
is valid, or zero if it is not. It also simplifies the if statement in
the errno_str() function.
This fixes a bug in stapio, which checks written data size and switches
new file when it exceeds a limit. The problem is that written-data-size
counter ignores the first written-data size when switching files. So,
actual file size always exceeds the limit. This changes stapio to
initialize written-data-size counter with the size of the data which
will be written in new file.
Josh Stone [Thu, 2 Apr 2009 19:16:12 +0000 (12:16 -0700)]
Disable ccache during kernel module builds
Our module builds always have a 0% ccache hit rate, because the compiler
commands always include the randomized tmpdir. Thus, I'm setting
CCACHE_DISABLE=1 so ccache never saves these one-use objects.
(Besides, we already have our own caching in place for this stuff...)
Mark Wielaard [Thu, 2 Apr 2009 16:42:38 +0000 (18:42 +0200)]
PR6580: Implement symname, symdata and modname context functions.
This adds a couple of the suggested context/stack revamp functions
from PR6580. In particular it replaces the symbolname() function that
sneaked in with the pr6866 branch merge with the suggested symname().
* runtime/sym.c (_stp_mod_sec_lookup): Make section optional.
(_stp_symbol_snprint): Provide a way to get optional module info.
* tapset/context-symbols.stp: Replace symbolname() with symname(),
add modname() and symdata().
(probemod): Implement pc based fallback.
* tapset/context-unwind.stp (caller): Adjust for _stp_symbol_snprint
change.
* testsuite/systemtap.context/usymbols.exp: Use new symname.
* testsuite/buildok/modname.stp: New test.
* testsuite/buildok/symdata.stp: Likewise.
* testsuite/buildok/symname.stp: Likewise.
Mark Wielaard [Thu, 2 Apr 2009 11:49:12 +0000 (13:49 +0200)]
Make task_finder.c compiler if ! defined (CONFIG_UTRACE).
* runtime/task-finder.c: If ! defined (CONFIG_UTRACE) define dummy noop
API for sym.c consisting of struct stap_task_finder_target,
stap_add_vma_map_info, stap_remove_vma_map_info and
stap_find_vma_map_info.
Josh Stone [Thu, 2 Apr 2009 00:01:53 +0000 (17:01 -0700)]
Move testcase itrace3's warning into expect
As it was, the ATTENTION was causing expect mismatches even when the
test worked fine. The warning is served just as well from the expect
script before starting the test.
Maynard Johnson [Wed, 1 Apr 2009 16:22:53 +0000 (11:22 -0500)]
Add insn.block testcase to itrace.exp in testsuite
Earlier today, I posted a runtime patch for the insn.block probe point.
Once that patch is committed, the insn.block probe can be safely tested
on any architecture. The attached patch adds such a testcase to the
testsuite.
Maynard Johnson [Wed, 1 Apr 2009 14:51:57 +0000 (09:51 -0500)]
Fix runtime/itrace.c to call arch_has_*_step() prior to calling utrace_control
As Roland pointed out in his Mar 31 reply to a posting of mine (subject:
Re: Testing insn.block probe point uncovers possible utrace bug),
utrace_control() documents that the caller must ensure that
arch_has_single_step and arch_has_block_step are defined before trying
to use those step modes. The attached patch addresses that issue. I've
tested this patch on x86_64 arch, and a block step test runs
successfully, since block step is supported on that arch. Testing on
ppc64 arch, the test fails as expected (since block step is not
supported on ppc64 yet) with:
"ERROR: callback for <pid> failed: 1"
which is sent to stdderr and
"usr_itrace_init: arch does not support block step mode"
which is sent to the system log.
This isn't the most user-friendly way of surfacing an error. Perhaps
the stap runtime could have a set of defined return codes that would be
mapped to strings so the user can get an idea of what the error is
without looking in the system log. But that's a side issue, of course.
Josh Stone [Wed, 1 Apr 2009 21:49:12 +0000 (14:49 -0700)]
PR10016: Purge stap of all pgrp and system() usage
We hereby no longer try to manipulate process groups in any way. We
don't set a private process group, and we never kill() our entire group
either. Instead of using system(), we now have a stap_system() which
saves the child PID, so when we get a terminating signal we can pass it
along to the child.
Signals sent through the TTY have always worked, since the TTY sends it
to the entire pgrp. However, if we're running as part of a wrapper
script or GUI, which may not have a separate process group for stap, we
still would like to allow "kill -TERM $STAPPID" to terminate stap
nicely.
There's still a short window of failure in the time that staprun is
active, because we can't kill a setuid process from a user process.
Once staprun drops privileges and execs to stapio though, everything
should work fine.
The new code uses a %( kernel_v < "2.6.29" %) conditional to look at
the passed pt_regs instead of named *bx parameters. A more general
solution will be needed at some point.
Mark Wielaard [Wed, 1 Apr 2009 20:40:04 +0000 (22:40 +0200)]
Wrap vma callbacks in STP_NEED_VMA_TRACKER.
Will be defined by new ucontext symbol stapset.
* tapset.cxx: Wrap all vma callbacks in STP_NEED_VMA_TRACKER.
* testsuite/systemtap.context/usymbols.exp: Define STP_NEED_VMA_TRACKER
explicitly for now.
Stan Cox [Tue, 31 Mar 2009 15:54:26 +0000 (11:54 -0400)]
Customize .mark -l output.
* tapsets.cxx (dwarf_builder::build): Add .mark name wildcard check.
Customize -l handling.
* testsuite/systemtap.base/static_uprobes.exp: Test .mark name wildcard.
Mark Wielaard [Tue, 31 Mar 2009 10:15:09 +0000 (12:15 +0200)]
PR10016: Run stap in its own process group with waiter process for signals.
* main.cxx (runner): New main function.
(waiter_handler): Signal handler for waiter process.
(waiter): Waiter process waitpid function.
(main): Fork and run wait and runner in their own processes.
Stan Cox [Mon, 30 Mar 2009 14:23:27 +0000 (10:23 -0400)]
Test marker probe parameter types.
* testsuite/systemtap.base/sdt_types.c: New file.
* testsuite/systemtap.base/sdt_types.stp: New file.
* testsuite/systemtap.base/static_uprobes.exp: Use sdt_types for type testing.
Frank Ch. Eigler [Fri, 27 Mar 2009 15:54:42 +0000 (11:54 -0400)]
PR10000: emit _stp_relocate* calculations correctly for kernel/module global $data
* translate.cxx (dump_unwindsyms): Also emit STT_OBJECT symbols,
therefore .data etc. sections into stap-symbols.h.
* tapsets.cxx (iterate_over_modules): Omit a dwfl_getmodules()
RC-checking assertion that blocked meaningful $context var
error messages.
(dwflpp::emit_address): Bypass dwfl_module_relocate_address()
for kernel symbols as it has been unreliable; subtract sess.sym_stext
manually.
* testsuite/buildok/seventeen.stp: Extend test with module $global.
Josh Stone [Thu, 26 Mar 2009 21:09:43 +0000 (14:09 -0700)]
Skip the git-rev in the hash for now (from a5e8d632)
It may be potentially expensive to fork-exec a git call to get the HEAD
revision, and it's not clear whether it's even needed. We can always
throw this back on if we find a meaningful usage scenario.
Josh Stone [Thu, 26 Mar 2009 16:20:16 +0000 (09:20 -0700)]
PR10001: Use the kernel's strlcpy & strlcat
We had our own implementations of these which were triggering gcc
bug38480 in some particular cases. It's easier for us to use the
kernel's strlcpy and strlcat anyway, which avoids the bug.
Josh Stone [Wed, 25 Mar 2009 22:47:21 +0000 (15:47 -0700)]
Add more file stats to the hash
For kernel developers, it may be common practice to reuse the same
kernel build tree for several kernel variants. Our previous hashing
only considered the release version, architecture, and build path, which
may all remain constant for such a developer.
This change adds the file size and mtime of several kernel version files
to the hash, so it should be a bit more robust against collisions.
Rajan Arora [Wed, 25 Mar 2009 02:30:37 +0000 (22:30 -0400)]
PR 9922 fix, make --disable-pie the configure default
*configure.ac: Change the default to compiling without fPIE.
*systemtap.spec: Add --enable-pie as the default option (set
pie_supported to 1).
*configure: Regenerated with autoconf 2.61.