Josh Stone [Mon, 20 Apr 2009 23:45:26 +0000 (16:45 -0700)]
PR10055: generate dummy modules w/ types for @cast
The module field in @cast can now also be "kmod<path/to/header.h>" or
"umod<path/to/header.h>" to generate a kernel or user module which
includes the specified header. The appropriate compiler flags are used
to save all possible type debuginfo from the header.
Josh Stone [Mon, 20 Apr 2009 23:43:15 +0000 (16:43 -0700)]
Suppress module-loading errors in @casts
If a @cast encounters a module that it can't load, it should just go on
to the next module instead of throwing an exception. If there is no
next module, we'll get a better "type not found" exception anyway.
David Smith [Mon, 20 Apr 2009 18:54:51 +0000 (13:54 -0500)]
Uses upstream ia64 syscall functions.
2009-04-20 David Smith <dsmith@redhat.com>
* runtime/syscall.h (syscall_get_nr): Uses upstream version of
syscall_get_nr() for ia64.
(syscall_get_arguments): Ditto.
(in_syscall): New ia64-only function from upstream.
(syscall_get_set_args_cb): Ditto.
(ia64_syscall_get_set_arguments): Ditto.
* runtime/task_finder.c (stap_register_task_finder_target):
Removed ia64 register cache.
Tim Moore [Mon, 20 Apr 2009 10:56:51 +0000 (12:56 +0200)]
fix a bug with %% in format strings
* translate.cxx (c_unparser::visit_print_format): Always use
_stp_printf if a format string contains "%%". Previously a format
string with no arguments would always be printed with _stp_print.
* testsuite/systemtap.printf/basic6.stp: New test for %% in format
strings.
* testsuite/systemtap.printf/basic6.exp: test driver
* testsuite/systemtap.examples/grapher.stp: Remove workaround for
"%%" literal problem.
Tim Moore [Mon, 20 Apr 2009 07:08:08 +0000 (09:08 +0200)]
Finish moving grapher into a subdirectory
* configure.ac (GRAPHER): Configuration prefix for variables defined by
PKG_CHECK_MODULES macro.
(BUILD_GRAPHER): New conditional variable
(enable-grapher): New option
(AC_CONFIG_FILES): Add grapher/Makefile
* Makefile.am (SUBDIRS): Add grapher
* grapher/Makefile.am: New file
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.