Merge branch 'master' of git://sources.redhat.com/git/systemtap
* 'master' of git://sources.redhat.com/git/systemtap:
* tapset/syscalls2.stp: Started a pending deprecation of incorrect 'syscall.compat_pselect7a' probe alias name. Correct name is 'syscall.compat_pselect7'. * testsuite/buildok/syscalls2-detailed.stp: Checks for correct probe alias name. * NEWS: Mentioned 'syscall.compat_pselect7a' deprecation. * stap.1: Ditto. * HACKING: Updated deprecation description.
Many small tapset/syscalls2.stp fixups. Added testcase.
Fix spurios testcase failure from systemtap.examples/network/socktop.
added the procfs.umask(UMASK) feature to the NEWS file.
* tapsets.cxx (sdt_uprobe_var_expanding_visitor ctor): Use %-adorned
register names. Accept other architectures.
(visit_target_symbol): Rewrite regexp matching / parsing. Fall back to
DWARF in case of parse failure.
* testsuite/systemtap.base/cxxclass.exp: Use -w to suppress dwarf warning.
* util.cxx (regexp_match): New function.
* util.h: Declare it.
David Smith [Mon, 19 Jul 2010 21:44:20 +0000 (16:44 -0500)]
* tapset/syscalls2.stp: Started a pending deprecation of incorrect
'syscall.compat_pselect7a' probe alias name. Correct name is
'syscall.compat_pselect7'.
* testsuite/buildok/syscalls2-detailed.stp: Checks for correct probe alias
name.
* NEWS: Mentioned 'syscall.compat_pselect7a' deprecation.
* stap.1: Ditto.
* HACKING: Updated deprecation description.
David Smith [Mon, 19 Jul 2010 21:19:49 +0000 (16:19 -0500)]
Many small tapset/syscalls2.stp fixups. Added testcase.
* tapset/syscalls2.stp (syscall.compat_sys_recvmsg): Make sure it supports
the same variables as the non-compat probe.
(syscall.compat_sys_semctl): Ditto.
(syscall.compat_sys_sendmsg): Ditto.
(syscall.sched_setaffinity): At some point, x86_64 kernels couldn't
find $len, so a special version of this probe was written for it. Now
just uses @defined().
(syscall.compat_signalfd): Prefers compat_sys_signalfd4 over
compat_sys_signalfd.
(syscall.ustat32): Merged the 2 probes into 1.
* testsuite/buildok/syscalls2-detailed.stp: New testcase.
David Smith [Wed, 14 Jul 2010 15:33:01 +0000 (10:33 -0500)]
Minor timestamp.stp/timestap_gtod.stp/ucontext.stp buildok test improvements.
* testsuite/buildok/timestamp-embedded.stp: Renamed from
buildok/timestamp.stp. Only covers function from timestamp.stp.
* testsuite/buildok/timestamp_gtod-embedded.stp: New testcase.
* testsuite/buildok/ucontext-embedded.stp: Renamed from ucontext.stp
Josh Stone [Tue, 13 Jul 2010 17:25:48 +0000 (10:25 -0700)]
Allow pretty-printing with partial availability
Especially with local structs, DWARF may only have parts of a variable
available at runtime. This change lets us print '?' for inaccessible
parts, so we can still print the parts we do have.
* tapsets.cxx (dwarf_pretty_print::push_deref): New, try a deref and
push a '?' instead if it fails.
(dwarf_pretty_print::recurse): Use push_deref instead of deref.
(dwarf_pretty_print::recurse_base): Ditto.
(dwarf_pretty_print::recurse_pointer): Ditto.
(dwarf_pretty_print::print_chars): Ditto.
Roland McGrath [Tue, 13 Jul 2010 02:40:15 +0000 (19:40 -0700)]
PR11809: loc2c: handle empty pieces
* loc2c.c (struct location): Add new type loc_unavailable.
(translate): Generate that for an empty DW_OP_piece.
(location_relative): Handle it.
(c_translate_location, c_translate_addressof): Likewise.
(c_translate_array, emit_base_fetch, emit_base_store): Likewise.
Josh Stone [Mon, 12 Jul 2010 22:05:40 +0000 (15:05 -0700)]
Anchor bz10078.exp's regexp patterns
If we are unlucky in buffering, then the test output could be read
into expect as a single buffer. Then one of our regexps could match the
end of the buffer and consume the whole thing, even if we also wanted to
match something earlier in the buffer.
The solution is to anchor the patterns to the beginning of the buffer
with '^', so we're sure to match everything we can.
Josh Stone [Mon, 12 Jul 2010 21:51:10 +0000 (14:51 -0700)]
Better catch server errors in the testsuite
If "avahi-browse ... | grep ..." doesn't find anything, like when a
firewall blocks the way, we should catch that gracefully. Use tcl's
"catch" instead of "set" for this.
* testsuite/lib/systemtap.exp (setup_server): Catch avahi-browse|grep
when it falls.
David Smith [Mon, 12 Jul 2010 20:28:26 +0000 (15:28 -0500)]
Minor task_time.stp and tcpmib.stp buildok test improvements.
* testsuite/buildok/task_time-embedded.stp: Added missing function.
* testsuite/buildok/tcpmib-all-probes.stp: Moved function tests to
tcpmib-embedded.stp.
* testsuite/buildok/tcpmib-embedded.stp: New test.
Josh Stone [Mon, 12 Jul 2010 20:01:51 +0000 (13:01 -0700)]
Add all the weirdness to compat-%p
I thought the old %p behavior was as simple as %#.8x or %#.16x, but it
was even weirder than that, as the ptr.exp test reveals. The compat
path is now able to pass that test, and a new test makes sure of the new
code behaves as expected too.
* runtime/vsprintf.c (_stp_vsnprintf): compat-%p is better preserved.
* testsuite/systemtap.printf/ptr.exp -> ptr-1.2.exp: Keep as a compat
test, and add a check that %.Np precision is ignored.
* testsuite/systemtap.printf/ptr-1.3.exp: New, make sure that %p really
does act like %#x now, with various field_width.precision combos.
Mark Wielaard [Fri, 9 Jul 2010 21:33:48 +0000 (23:33 +0200)]
Keep track of name, not dentry, in vma tracker.
Now even the vdso has a module name.
* runtime/task_finder_vma.c (__stp_tf_vma_entry): Remove dentry, add name.
(stap_add_vma_map_info): Take and store name argument, not dentry.
(stap_find_vma_map_info): Likewise.
(stap_find_vma_map_info_user): Likewise.
* runtime/sym.c (_stp_umod_lookup): Lookup name directly with
stap_find_vma_map_info.
* runtime/vma.c (_stp_vma_match_vdso): Pass "vdso" as name.
(_stp_vma_mmap_cb): Extract and store name from dentry.
David Smith [Fri, 9 Jul 2010 19:19:48 +0000 (14:19 -0500)]
Improvements to the scsi tapset and build testcases.
* tapset/scsi.stp: Added missing convenience variable documentation.
* testsuite/buildok/scsi-detailed.stp: Renamed from buildok/scsi.stp and
updated with the rest of the convenience variables.
* testsuite/buildok/scsi-embedded.stp: Updated with the rest of the
functions.
Mark Wielaard [Fri, 9 Jul 2010 16:02:33 +0000 (18:02 +0200)]
PR10080 Add vdso tracking (x86).
The translator will now pick up all the possible vdso.so files (luckily
they are small). At runtime when the task finder notifies us of a new
process we will check against the build id an add the vdso to the vma map.
* translate.cxx (find_vdso): New function.
(add_unwindsym_vdso): Likewise.
(emit_symbol_data): If vma tracker enabled call add_unwindsym_vdso.
* buildrun.cxx (compile_pass): Check STAPCONF_MM_CONTEXT_VDSO.
* runtime/autoconf-mm-context-vdso.c: New test.
* runtime/vma.c (_stp_vma_match_vdso): New function.
(_stp_vma_exec_cb): Call _stp_vma_match_vdso when register_p && process_p.
Josh Stone [Fri, 9 Jul 2010 00:09:20 +0000 (17:09 -0700)]
PR11785: Fix pretty-printing for tracepoint base types
We need slightly special code to deal with tracepoint base types, which
should not be dereferenced at all, but just used as-is.
* tapsets.cxx (dwarf_pretty_print): Add deref_p, which is usually true,
but is false for tracepoints if "pointer" is really a direct value.
(dwarf_pretty_print::deref): Copy the value directly if !deref_p.
(dwarf_pretty_print::recurse_pointer): Detect void pointees more
reliably, e.g. in case of a const node with no type -> const void.
(dwarf_cast_query::handle_query_module): @cast always has deref_p.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Permit
pretty-printing on !isptr args, and use that to set deref_p.
(tracepoint_derived_probe::resolve_tracepoint_arg_type): Check
pointers more carefully for a pointee type, again for const void.
William Cohen [Thu, 8 Jul 2010 22:50:15 +0000 (18:50 -0400)]
Adjust systemtap.example checks for the current behavior of "stap -l ..."
The -l option only return an error if no matches are found. A number of
the tests would falsely pass because some of the probe points would match.
The tests need to check each probe point individually to avoid missing a
needed probe point.
Josh Stone [Thu, 8 Jul 2010 20:41:47 +0000 (13:41 -0700)]
PR11785: Limit pretty-printing to 32 args
As per PR10750, we can't have an unbounded number of printf arguments.
This change now prevents pretty-printing from generating code that would
be rejected in pass-3. It's still likely that MAXSTRINGLEN will cause
truncation, but users are free to increase that limit if needed.
* tapsets.cxx (dwarf_pretty_print::recurse_array): Break the loop if we
already have reached 32 args in the print_format.
(dwarf_pretty_print::recurse_struct_members): Ditto.
Lukas Berk [Thu, 8 Jul 2010 21:02:04 +0000 (17:02 -0400)]
Addressing bug 11775 which is addressing the need to audit
which tapsets are documented in tapset.tmpl and any tapsets
that may have been removed without removing the documentation.
Stan Cox [Wed, 7 Jul 2010 21:45:33 +0000 (17:45 -0400)]
Switch over to version 2 sdt.h.
* dtrace.in (def_append): Make STAP_SDT_V2 the default.
* sdt.h: Likewise.
* sdt_misc.exp: Likewise.
* tapsets.cxx (sdt_uprobe_var_expanding_visitor): Add need_debug_info.
(sdt_query::handle_query_module): Use dwarf for v2 if a variable ref needs it.
David Smith [Wed, 7 Jul 2010 16:43:16 +0000 (11:43 -0500)]
Fixed semok/entry03.stp on RHEL5 and added more rpc embedded function tests.
* testsuite/semok/entry03.stp: Fixed for RHEL5 systems.
* testsuite/buildok/rpc-embedded.stp: Added the rest of the rpc.stp
embedded functions to the test.
David Smith [Wed, 7 Jul 2010 15:08:41 +0000 (10:08 -0500)]
Fixed PR11663 by using an embedded-C expression to get the marker name/format.
* tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_context):
Instead of calling a tapset function to get the marker name/format, use
an embedded-C expression.
* tapsets.cxx (tracepoint_var_expanding_visitor::visit_target_symbol_context):
Ditto.
* tapset/marker.stp: Removed, since no longer needed.
Mark Wielaard [Wed, 7 Jul 2010 14:51:25 +0000 (16:51 +0200)]
Sanitize before usage in unwinder if they come from task_pt_regs.
Introduce _stp_task_pt_regs_valid() that checks whether a full set
of user registers was saved. Currently assumes yes for i386 and no otherwise.
If not all registers were saved create a copy for the unwinder with
everything zeroed out except the (arch specific, x86_64 only for now)
known to be valid registers (would be nicer to do this as initial
unwinder state, so we could mark them undefined, but the current
form at least prevents leaking any data that might still be saved
in the pt_regs that task_pt_regs() points to).
* runtime/compatdefs.h (_stp_task_pt_regs_valid): New function.
* runtime/stack.c (_stp_stack_print): Take and pass uregs_valid argument.
(_stp_stack_sprint): Likewise.
* runtime/stack-arm.c (__stp_stack_print): Likewise.
* runtime/stack-i386.c (__stp_stack_print): Likewise.
* runtime/stack-ia64.c (__stp_stack_print): Likewise.
* runtime/stack-ppc.c (__stp_stack_print): Likewise.
* runtime/stack-s390.c (__stp_stack_print): Likewise.
* runtime/stack-x86_64.c (__stp_stack_print): Likewise.
* tapset/context-unwind.stp (print_backtrace): Pass zero for valid.
(sprint_backtrace): Likewise.
(backtrace): Likewise.
* tapset/ucontext-unwind.stp (print_ubacktrace): Check and pass uregs_valid.
(sprint_ubacktrace): Likewise.
(print_ubacktrace_brief): Likewise.
(ubacktrace): Likewise.
* runtime/unwind/i386.h (arch_unw_init_frame_info): Accept sanitize argument.
* runtime/stack-x86_64.c (arch_unw_init_frame_info): Likewise and actually
sanitize the pt_regs copy.
Mark Wielaard [Wed, 7 Jul 2010 11:25:47 +0000 (13:25 +0200)]
Keep track of context pt_regs state to distinquish between user/kernel regs.
Although user_mode(regs) can give us a hint as to where the regs are
coming from, it is more reliably to let the probe handler keep track.
All utrace/uprobes based handlers now explicitly set CONTEXT->regflags
_STP_REGS_USER_FLAG. As do the timer probes (based on user_mode).
The perf based handlers don't yet try to determine the regs origin
(but might just use the timer based heuristic). Relevant symbol/unwind
tapset functions now take advantage of this new context flag. The register
tapsets might also benefit from the extra info, but have not been adjusted.
* translate.cxx (c_unparser::emit_common_header): Define _STP_REGS_USER_FLAG
and add regflags field to struct context.
* tapset-itrace.cxx (itrace_derived_probe_group::emit_module_decls):
Set _STP_REGS_USER_FLAG for regflags.
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls):
Add XXX note to investigate.
* tapset-timers.cxx (profile_derived_probe_group::emit_module_decls):
Set _STP_REGS_USER_FLAG for regflags based on user_mode.
* tapset-utrace.cxx (utrace_derived_probe_group::emit_module_decls):
Set _STP_REGS_USER_FLAG for regflags.
* tapsets.cxx (common_probe_entryfn_prologue): Initialize regflags to zero.
(uprobe_derived_probe_group::emit_module_decls):
Set _STP_REGS_USER_FLAG for regflags.
* tapset/context-symbols.stp (probefunc): Check CONTEXT->regflags and use
current task lookup if set.
(probemod): Check CONTEXT->regflags _STP_REGS_USER_FLAG isn't set.
* tapset/context-unwind.stp (print_backtrace): Likewise.
(sprint_backtrace): Likewise.
(backtrace): Likewise.
* tapset/context.stp (user_mode): Just check CONTEXT->regflags.
* tapset/ucontext-unwind.stp (print_ubacktrace): Check CONTEXT->regflags
_STP_REGS_USER_FLAG is set.
(sprint_ubacktrace): Likewise.
(print_ubacktrace_brief): Likewise.
(ubacktrace): Likewise.
* tapset/utrace.stp (_utrace_syscall_nr): Likewise.
(_utrace_syscall_arg): Likewise.
(_utrace_syscall_return): Likewise.
Mark Wielaard [Wed, 7 Jul 2010 09:01:43 +0000 (11:01 +0200)]
Only include unwaddr in context for ia64. Not used on any other arch.
* translate.cxx (c_unparser::emit_common_header): Don't add unwaddr field
to context struct except for ia64.
* tapsets.cxx (common_probe_entryfn_prologue): Only initialized unwaddr
on ia64.
(dwarf_derived_probe::emit_probe_local_init): Only call bspcache on ia64.
* runtime/regs-ia64.c: Don't define (empty) bspcache for other arches.
David Smith [Tue, 6 Jul 2010 19:32:14 +0000 (14:32 -0500)]
Small changes to several buildok testcases.
* testsuite/buildok/logging-embedded.stp: Renamed from logging.stp.
* testsuite/buildok/nfs_proc-embedded.stp: Added the rest of the
nfs_proc.stp embedded functions to the test.
* testsuite/buildok/memory-embedded.stp: Added GFP_KERNEL test.
* testsuite/buildok/irq-all-probes.stp: Added '-w' to avoid empty probe
warnings.
* testsuite/buildok/utrace.stp: Ditto.
Stan Cox [Tue, 6 Jul 2010 13:06:38 +0000 (09:06 -0400)]
Remove implicit static user probe semaphores.
dtrace.in (class provider): Define foo_ENABLED using builtin_expect
sdt.h (STAP_SEMAPHORE): Remove. Explicit foo_ENABLED can be used instead.
(STAP_PROBE): Likewise.
Mark Wielaard [Tue, 6 Jul 2010 10:24:19 +0000 (12:24 +0200)]
Extend context.exp backtrace.tcl test for "perfect" DWARF backtraces.
* testsuite/systemtap.context/backtrace.stp (yyy_func4): Exit at end to not
stall expect.
* testsuite/systemtap.context/backtrace.tcl: Add -d systemtap_test_module1
and -d kernel for "perfect" backtraces. Keep track of module1 and kernel
frames. Do not accept (inexact) anymore - the dwarf unwinder is "perfect"
now. Check stap script did exit (eof).
Mark Wielaard [Mon, 5 Jul 2010 19:14:42 +0000 (21:14 +0200)]
Put generated debug_hdr in _stp_section, add sec_load_offset for adjustment.
Make sure to adjust .debug_frame addresses to section load address.
Which means keeping track of the (synthetic) .debug_frame_hdr index
per section. For now keep track of "magic sections". Will need to
be extended to track all loadable code sections as we do for symbol
tables. See http://sourceware.org/ml/systemtap/2010-q3/msg00012.html
* runtime/sym.h (_stp_module): Remove dwarf_module_base. Move debug_hdr
and debug_hdr_len from here to ...
(_stp_section): ... here. And add sec_load_offset.
* runtime/unwind.c (adjustStartLoc): Don't use m->dwarf_module_base,
use s->sec_load_offset.
(_stp_search_unwind_hdr): Use s->debug_hdr and s->debug_hdr_len.
* translate.cxx (create_debug_frame_hdr): Accept and set debug_frame_off.
(get_unwind_data): Likewise.
(dump_unwindsyms): Keep track of debug_frame_off. Output debug_frame_hdr
per _stp_section if section is ".dynamic", ".absolute", ".text", or
"_stext".
* translate.cxx (emit_symbol_data): Tolerate mystery modules being
listed in -d or via --all-modules. This kind of situation does
not call for freaking out. Wubba wubba.