utrace/ia64: Fix syscall_get_set_args_cb() to handle syscalls via syscall()
* runtime/syscall.h (syscall_get_set_args_cb): Fix to decode user stack
collectly in case of syscall(), and check the maximum number of syscall
arguments.
PR 6930: Add testcases for on-file flight recorder
* testsuite/systemtap.base/flightrec1.exp: New test case for background mode.
* testsuite/systemtap.base/flightrec2.exp: New test case for file switching.
* testsuite/systemtap.base/flightrec2.stp: Test script for file switching.
Rajan Arora [Wed, 22 Apr 2009 16:10:37 +0000 (12:10 -0400)]
PR 9941: Add predicate function callback to check for an early abort
* tapsets.cxx: Add dwfl_report_offline_predicate to check pending
interrupts for an early abort.
* tapsets.h: Declare it.
* translate.cxx: Add callback to function call.
Stan Cox [Wed, 22 Apr 2009 15:34:14 +0000 (11:34 -0400)]
Make sdt.h big endian aware.
* sdt.h: Use .quad instead of .long for .probe section addresses.
ia64 and s390 require 'nop 0' and x86 tolerates it.
* tapsets.cxx (build): Fetch probe_name in a big endian friendly fashion.
Mark Wielaard [Wed, 22 Apr 2009 10:53:39 +0000 (12:53 +0200)]
Simplify section size logic.
* translate.cxx (dump_unwindsyms): Just check that dwfl_module_relocations()
return more than 1 relocation section bases before calling
dwfl_module_address_section().
Josh Stone [Wed, 22 Apr 2009 02:57:59 +0000 (19:57 -0700)]
[tracepoints] Resolve implicit trace_X use
Some of the tracepoints are actually being called in inlines in the
common headers (e.g. trace_kmalloc), which is causing errors about
implicit function declarations. We don't care about ever running the
code in the tracequery module, so I'm just suppressing that error.
Josh Stone [Wed, 22 Apr 2009 02:55:47 +0000 (19:55 -0700)]
[tracepoints] Don't use TRACE_HEADER_MULTI_READ
At one point that macro was needed to get all of the tracepoints on the
tip tree, but now it's causing us to get duplicate stapprobe_X
definitions. AFAICS, we're now getting all tracepoints even without
MULTI_READ, so I'm pulling that workaround out.
Josh Stone [Tue, 21 Apr 2009 19:08:42 +0000 (12:08 -0700)]
Refine the @cast-with-header syntax
The special syntax to generate a module for type information is now:
- "kernel<path/to/header.h>" to use the kernel's build environment
- "<path/to/header.h>" to use no special build environment, and so use
gcc's default parameters only (for user mode).
Mark Wielaard [Tue, 21 Apr 2009 19:33:24 +0000 (21:33 +0200)]
Set MAXSTRINGLEN to 133 for uprobes_ustack.exp test on 64 bit.
Needs extra space since on 64bit the last ubacktrace string is
7 entries * (16 hex + 2 for 0x + 1 space) = 133 chars.
Default MAXSTRINGLEN is 128 chars.
Mark Wielaard [Tue, 21 Apr 2009 17:44:55 +0000 (19:44 +0200)]
Add uprobes_ustack testcase and bug fixlet.
* runtime/stack.c (_stp_stack_print): Use _stp_usymbol_print when tsk given.
* testsuite/systemtap.base/uprobes_ustack.exp: New test file.
* testsuite/systemtap.base/uprobes_ustack.stp: Likewise.
Mark Wielaard [Tue, 21 Apr 2009 15:16:51 +0000 (17:16 +0200)]
Add ubacktrace(), print_ustack() and print_ubacktrace().
* runtime/sym.c (_stp_usymbol_print): New function.
* tapset/ucontext-unwind.stp (print_ubacktrace): New tapset function.
(ubacktrace): Likewise.
* tapset/ucontext-symbols.stp (print_ustack): Likewise.
* testsuite/buildok/ustack.stp: New test for above three functions.
David Smith [Tue, 21 Apr 2009 13:21:34 +0000 (08:21 -0500)]
Correctly handle $syscall in process(PID_OR_PATH).syscall.return probes.
2009-04-21 David Smith <dsmith@redhat.com>
* tapsets.cxx (utrace_derived_probe::utrace_derived_probe): If
during target-variable-expanding the probe, we added a new block
or probe, add them.
(utrace_var_expanding_visitor::visit_target_symbol_cached): New
function to cache target variables in a generated syscall probe to
use in syscall.return probes.
(utrace_var_expanding_visitor::visit_target_symbol_context): In a
syscall.return probe, you can't access $syscall. So use
visit_target_symbol_cached() to cache the value for use here.
* testsuite/systemtap.base/utrace_syscall_args.stp: Test use of
$syscall in syscall.return probes.
Mark Wielaard [Tue, 21 Apr 2009 10:06:53 +0000 (12:06 +0200)]
Don't use stack fallback for user space unwinding when using dwarf unwinder.
It never seems to be anywhere near correct.
* runtime/stack-i386.c (__stp_stack_print): Stop unwinding when dwarf
unwinder fails and we are unwinding user space task.
* runtime/stack-x86_64.c (__stp_stack_print): Likewise.
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.
Mark Wielaard [Mon, 20 Apr 2009 20:43:37 +0000 (22:43 +0200)]
Pass task from tapset, through stack and unwind functions for lookup.
* runtime/stack-arm.c (__stp_stack_print): Take struct task_struct *.
* runtime/stack-ia64.c (__stp_stack_print): Likewise.
* runtime/stack-ppc64.c (__stp_stack_print): Likewise.
* runtime/stack-s390.c (__stp_stack_print): Likewise.
* runtime/stack-i386.c (__stp_stack_print): Likewise.
And add check and pass to unwind() and _stp_func_print().
* runtime/stack-x86_64.c: Likewise.
* runtime/stack.c *_stp_stack_print): Take and pass on task_struct.
(_stp_stack_snprint): Likewise.
* runtime/unwind.c (unwind): Take and use task_struct for
_stp_mod_sec_lookup().
* tapset/context-unwind.stp (print_backtrace): Pass NULL to
_stp_stack_print().
(backtrace): Pass NULL to _stp_stack_snprint().
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.