Josh Stone [Sat, 18 Apr 2009 03:22:29 +0000 (20:22 -0700)]
Remove module boilerplate from tracequery
Kernel modules will actually build just fine with none of the module
boilerplate code. We don't care about ever actually loading the
tracequery module that we make, so don't bother emitting code we don't
need.
David Smith [Fri, 17 Apr 2009 14:37:00 +0000 (09:37 -0500)]
Added new utrace syscall argument test.
2009-04-17 David Smith <dsmith@redhat.com>
* systemtap.base/utrace_syscall_args.c: New test file.
* systemtap.base/utrace_syscall_args.exp: New test file.
* systemtap.base/utrace_syscall_args.stp: New test file.
Josh Stone [Thu, 16 Apr 2009 22:20:02 +0000 (15:20 -0700)]
Keep up with tracepoint changes in kernel-tip
- Define TRACE_HEADER_MULTI_READ to allow re-pulling headers that were
already included indirectly elsewhere.
- Some tracepoint headers were moved down to include/trace/events/,
so add that to our glob paths.
- Add ftrace.h as a header that we should never include.
Josh Stone [Thu, 16 Apr 2009 22:07:42 +0000 (15:07 -0700)]
Privatize MAX_STACK_DEPTH
The kernel-tip tree also has a MAX_STACK_DEPTH defined in
perf_counter.h, so we need to separate our definition. I've changed the
definition in our unwinder to STP_MAX_STACK_DEPTH.
Stan Cox [Thu, 16 Apr 2009 14:25:05 +0000 (10:25 -0400)]
Use iterate_over_srcfile_lines for function("func@file:N").label
* tapsets.cxx (dwflpp::iterate_over_labels): Renamed from
iterate_over_cu_labels, method signature simplified.
(query_srcfile_label): New.
(query_cu): Use above.
* labels.exp: New tests for above.
Josh Stone [Tue, 14 Apr 2009 19:34:12 +0000 (12:34 -0700)]
PR9953: split up the two process.* tapsets
The overlapping process.* tapsets are now separated. Those probe points
documented in stapprobes(3stap) remain the same. Those that were formerly
in stapprobes.process(3stap) have been renamed to kprocess, to reflect
their kernel perspective on processes.
Andre Detsch [Tue, 14 Apr 2009 17:23:59 +0000 (14:23 -0300)]
Add new TCP and IP functions
This patch adds some basic functions to the IP and TCP tapsets.
Mainly, it's possible to get the iphdr and tcphdr from a sk_buff structure.
As a consequence, a TCP probe called tcp.receive() was created and
is probed every time a TCP packet is received, and a lot of
useful fields is available, as the TCP flags.
Also a small example that works like tcpdump for received TCP packets was
created.
This patch was tested on x86 and ppc machines, on 2.6.18 kernel and also on
mainline one.
Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com> Signed-off-by: Andre Detsch <adetsch@br.ibm.com> Signed-off-by: Josh Stone <jistone@redhat.com>
Mark Wielaard [Tue, 14 Apr 2009 17:30:56 +0000 (19:30 +0200)]
Keep track of relocation section sizes.
* runtime/sym.h (_stp_section): Add size field.
* translate.cxx (dump_unwindsyms): Get start of module address space,
turn seclist into vector of secname, size pairs, track relocation section
size, or add module address range if no sections, output size in
_stp_section list.
Josh Stone [Tue, 14 Apr 2009 02:50:23 +0000 (19:50 -0700)]
PR10067: fix bitfield access
* tapsets.cxx (dwflpp::translate_components): Eliminate the extra
die-dereference at the end of the loop (a regression from @casts).
* runtime/loc2c-runtime.h (store_bitfield): Use the target as the
representative type, since the base is always int64_t. Also be a
bit more aggressive with masking and parentheses.
* testsuite/systemtap.base/bitfield.*: New test for R/W bitfields.
Josh Stone [Mon, 13 Apr 2009 21:46:54 +0000 (14:46 -0700)]
PR10049: Restore better errors for $return
In commit c4ce66a1 I shifted some of the variable accesses around, and
that caused the error messages for $return variables to lose context.
The root problem in this case was that dwarf_attr didn't find the type
attribute, and that failure wasn't immediately caught. Now that result
is checked so we can provide a proper error message.
While I'm at it, changing that lookup to dwarf_attr_integrate is enough
to make the $return value usable again, at least for the reported test
case.
Mark Wielaard [Thu, 9 Apr 2009 21:18:46 +0000 (23:18 +0200)]
Cleanup symbol table sanity checking.
* translate.cxx (dump_unwindsyms): Get and check against module end, only
check STT_FUNC && SHN_ABS for kernel, check shndxp for non-allocated
section.
David Smith [Thu, 9 Apr 2009 17:06:05 +0000 (12:06 -0500)]
Uses <asm/syscall.h> when available.
2009-04-09 David Smith <dsmith@redhat.com>
* buildrun.cxx (compile_pass): Compile autoconf test for
<asm/syscall.h>.
* runtime/autoconf-asm-syscall.c: New "autoconf" test the presence
of <asm/syscall.h>.
* runtime/syscall.h: If <asm/syscall.h> exists, use it.
Otherwise, use our private copy of the functions for each
architecture.
(syscall_get_nr): Renamed from __stp_user_syscall_nr().
(syscall_get_return_value): Renamed from
__stp_user_syscall_return_value().
(syscall_get_arguments): Renamed from __stp_user_syscall_arg().
* runtime/task_finder.c
(__stp_utrace_task_finder_target_syscall_exit): Uses new syscall.h
functions.
* tapset/utrace.stp: Ditto.
Mark Wielaard [Thu, 9 Apr 2009 16:20:32 +0000 (18:20 +0200)]
Make simple probes work even without KPROBES in the kernel.
Without KPROBES very little works atm. But stack.c file is unconditionally
imported, while these two functions are only used through context-unwind.stp.
This at least lets us do simple sanity checks on "plain" kernels.
* runtime/stack.c (_stp_stack_print, _stp_stack_snprint):
Wrap in #if defined (CONFIG_KPROBES).
Mark Wielaard [Wed, 8 Apr 2009 21:35:21 +0000 (23:35 +0200)]
Make sure code using the vma tracker compiles again.
* runtime/runtime.h: Include task_finder.c.
* runtime/sym.c: Always define task_finder callbacks for usage in tapsets.
* runtime/task_finder.c: Define dummy stap_task_finder_target when
! defined(CONFIG_UTRACE).
* tapsets.cxx: Never include task_finder.c directly.
Mark Wielaard [Wed, 8 Apr 2009 16:11:34 +0000 (18:11 +0200)]
Add main executable symbol uprobe to uprobes_lib.exp test.
There was nothing wrong with the probe itself, but because the body
was empty the compiler optimised away the actual call...
* testsuite/systemtap.base/uprobes_lib.exp: Activate main exe probe, expect
more output.
* testsuite/systemtap.base/uprobes_lib.stp: Also probe main and main_lib.
* testsuite/systemtap.base/uprobes_exe.c: Put some code in main_func.
* testsuite/systemtap.base/uprobes_lib.c: Likewise for lib_func.
Stan Cox [Wed, 8 Apr 2009 21:19:04 +0000 (17:19 -0400)]
Consider function when handling .label
* tapsets.cxx(dwflpp::iterate_over_cu_labels): New parameter function.
Do wildcard match for function.
* testsuite/systemtap.base/labels.exp: Test .label function handling.
David Smith [Wed, 8 Apr 2009 17:41:55 +0000 (12:41 -0500)]
Only includes task_finder.c when needed.
2009-04-08 David Smith <dsmith@redhat.com>
* tapsets.cxx (itrace_derived_probe_group::emit_module_decls):
Added inclusion of task_finder.c back. Unconditionally including
it when not needed causes all systemtap scripts to fail on kernels
with no utrace support.
(utrace_derived_probe_group::emit_module_decls): Ditto.
(uprobe_derived_probe_group::emit_module_decls): Ditto.
* runtime/runtime.h: Removed unconditional inclusion of
task_finder.c.
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.