PR11095: support process(). **provider()** .mark()
For STAP_SDT_V2 only for now.
* NEWS, stapprobes.3stap.in: Mention it.
* Makefile.am (stap_CPPFLAGS): Use -DSTAP_SDT_V2.
* dtrace.in: Preserve provider name, though squash it for STAP_SDT_V1.
* includes/sys/sdt.h: Likewise.
* tapsets.cxx (register_patterns): Accept .provider() probe point piece.
(sdt_*_var_expanding_visotor): Store it.
(sdt_query::*): Extend for provider matching, new magic codes.
* testsuite/systemtap.base/sdt_misc.exp: Use more formal interfaces
to semaphores.
Mark Wielaard [Fri, 4 Jun 2010 09:34:23 +0000 (11:34 +0200)]
Add configure check for xmlto pdf with chapters titles starting with L...
There is a strange bug in older versions of xmlto when generating pdf.
https://bugzilla.redhat.com/show_bug.cgi?id=526273
So make sure to have a chapter title starting with L plus an refentry.
This will make sure the xmlto pdf support test fails on buggy versions.
Mark Wielaard [Thu, 3 Jun 2010 09:26:17 +0000 (11:26 +0200)]
Replace walk_stack field version guard with autoconf test.
The test for whether or not to assign print_context_stack to the
walk_stack stacktrace_ops field depended on the kernel version.
Replace with a proper runtime/autoconf test to make sure the field
always gets assigned when available.
* buildrun.cxx (compile_pass): Add output for STAP_CONF_WALK_STACK.
* runtime/autoconf-walk-stack.c: New test.
* runtime/stack.c (print_stack_ops): Assign walk_stack field
print_context_stack depending on STAP_CONF_WALK_STACK.
Josh Stone [Thu, 3 Jun 2010 00:18:33 +0000 (17:18 -0700)]
PR3672 cont'd: Change pretty-print "depth" to mean substructures
We don't follow pointers anymore within a structure. Now a single '$'
suffix means we print a shallow view of the structure, with {...} and
[...] in place of nested arrays/structs. A double suffix '$$' means we
print everything contained in the struct. Longer suffixes no longer
have meaning, and for now act the same as '$$'.
* tapsets.cxx (dwarf_pretty_print): Lose the "print_depth" field, and
instead just check if this is a "full" print job. Pass a bool
indicating whether we're currently traversing the top-level, so we
know which structs to expand. Also wrap it all in try/catch so bad
pointers don't kill us.
Josh Stone [Thu, 3 Jun 2010 01:37:55 +0000 (18:37 -0700)]
PR11664: Let return/next break out of try/catch
Try-catch works by faking a local "out" label and running the catch
block. In the case of return and next, we have a "goto out" without any
error, so it should be allowed to progress to the real out label.
* translate.cxx (c_unparser::visit_try_block): Reorganize the nested
labels to allow normal-fallthrough, normal-out, and error-out.
* testsuite/systemtap.base/overcatcher.stp: New test.
Josh Stone [Tue, 1 Jun 2010 22:23:48 +0000 (15:23 -0700)]
PR11599: Support the new tracepoints API in 2.6.35
* buildrun.cxx (make_tracequery): Support DECLARE_TRACE_NOARGS.
* tapsets.cxx (tracepoint_derived_probe_group::emit_module_decls): Add
an unused void* parameter for the tracepoint callbacks on 2.6.35+.
Mark Wielaard [Tue, 1 Jun 2010 09:37:59 +0000 (11:37 +0200)]
rhbz #596083 Account for dot and dotless kernel variant in stap-prep.
uname -r can produce different kinds of output:
2.6.32-30.el6.x86_64 (no variant, but including ".arch")
2.6.18-194.3.1.el5debug ("variant", without dot, no arch)
2.6.33.4-95.fc13.i686.PAE (".arch.variant", two dots)
We didn't handle the dot before the variant used in newer distros.
* stap-prep: Remove either ".variant" or "variant" from the end of release
uname string.
Mark Wielaard [Fri, 28 May 2010 21:49:26 +0000 (23:49 +0200)]
PR10665 Make unwinder recognized synthesized debug_frame_hdr.
* runtime/unwind.c (_stp_search_unwind_hdr): Take is_ehframe argument.
Recognize and use debug_hdr for binary searching the FDE.
(unwind_frame): Always try binary hdr search.
Mark Wielaard [Fri, 28 May 2010 21:32:05 +0000 (23:32 +0200)]
PR10665 Create a synthetic binary search table for a debug_frame section.
* runtime/sym.h (_stp_module): Add fields debug_hdr and debug_hdr_len.
* translate.cxx (create_debug_frame_hdr): New function.
(get_unwind_data): Call new function when there is a debug_frame.
(dump_unwindsyms): Output new debug_frame_hdr.
Stan Cox [Fri, 28 May 2010 20:11:24 +0000 (16:11 -0400)]
Implicit *_ENABLED() is no longer the default for sdt.h probes.
Cast V2 probe args.
sdt.h (STAP_SDT_IMPLICIT_ENABLED): New.
(STAP_TYPE): New.
(STAP_CAST): New.
(STAP_PROBE*_): Use STAP_TYPE and STAP_CASE.
sdt_misc.exp: Use -DSTAP_SDT_IMPLICIT_ENABLED
Here is a patch implements a way for uprobes to skip single step
when a probe in on a nop instruction.
Currently its implemented for nop on x86/x86_64 and s390.
For powerpc, its implemented on all instructions that can be emulated.
(For this emulation code is borrowed from arch/powerpc/lib/sstep.c)
I havent tested it on s390. Updated with comments from Jim.
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Reported-by: Josh Stone <jistone@redhat.com>
This is still a work in progress, but I deemed it now useful enough to
share. See PR3672 for discussion of work remaining.
* parse.cxx (parser::parse_target_symbol_components): Parse the trailing
$s as a new comp_pretty_print entry in the target_symbol.
* staptree.cxx (target_symbol::assert_no_components): Add a flag to
assert whether pretty-printing is supported.
(target_symbol::component::print): Support comp_pretty_print.
* dwflpp.cxx (dwflpp::translate_components): Skip the actual translation
if the obstack "pool" is NULL.
(dwflpp::type_die_for_local): Dig through a local and its components
to get the type DIE that the pretty printing can start from.
(dwflpp::type_die_for_return): Ditto for return values.
(dwflpp::type_die_for_pointer): Ditto for pointers.
* tapsets.cxx (dwarf_pretty_print): New struct for recursing over a type
DIE and producing a string representation. (The real meat lies here!)
(dwarf_var_expanding_visitor::visit_target_symbol): Determine when to
use dwarf_pretty_print instead of the normal path.
(dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_context): Ditto.
(dwarf_cast_query, dwarf_cast_expanding_visitor): Move the function
generation from the visitor to the query, and also support using
dwarf_pretty_print as needed.
Josh Stone [Wed, 26 May 2010 19:39:31 +0000 (12:39 -0700)]
tracequery build fix
Similar to commit 392e08b7 -- we need to #undef TRACE_INCLUDE_FILE
before each header in the tracepoint query module, so they can be
queried all at once.
The side effect was that the all-inclusive tracequery build would fail,
so we'd fall back to building a separate tracequery for each header.
It's much faster when we can build them together.
* buildrun.cxx (make_tracequery): #undef TRACE_INCLUDE_FILE before each
tracepoint header to prevent macro redefinition.
Mark Wielaard [Wed, 26 May 2010 10:24:21 +0000 (12:24 +0200)]
rhbz #596083 Make stap-prep resolve kernel-debuginfo-common package name.
The kernel-debuginfo-common package name is slightly different on different
distros. But the correct name is always required by the kernel-debuginfo
package. So don't add it to the CANDIDATES list, but let the yumdowloader
--resolve it. Tested on f13, rhel5 and rhel6 beta.
* stap-prep: Remove kernel-debuginfo-common from CANDIDATES, add --resolve
to yumdownloader.
Adrien Kunysz [Tue, 25 May 2010 15:03:41 +0000 (11:03 -0400)]
PR11609: --all-options stap option to -d ALL_LOADED_MODULES
* session.cxx (insert_loaded_modules): Parse /proc/modules
to populate unwindsym_modules ...
(parse_cmdline): ... if --all-options was given.
* stap.1.in: Document it.
Stan Cox [Tue, 25 May 2010 02:13:30 +0000 (22:13 -0400)]
Add debuginfoless static uprobe handling.
The .probes section now contains the assembler asm equivalent of each
probe argument. stap parses this and generates the equivalent stap code
to access each argument.
Josh Stone [Sat, 22 May 2010 01:32:46 +0000 (18:32 -0700)]
PR11617: Move string literal gluing from lexer to parser
* parse.cxx (lexer::ate_comment): New flag if we just passed a comment.
(lexer::scan): Set ate_comment, remove string gluing.
(parser::parse_literal): Glue strings if not comment-separated.
* testsuite/semok/thirtyfive.stp: Extend test.
Josh Stone [Fri, 21 May 2010 22:32:10 +0000 (15:32 -0700)]
Quiet the "checking uprobes" pass-4 messages
For session.verbose=1, we mostly only print the result of the pass. We
had a uprobes "preamble" though in pass 4, which IMO was a misleading
break in convention. It gave the impression that all the building time
for the actual script was part of the uprobes work.
* buildrun.cxx (verify_uprobes_uptodate, make_uprobes): Only print the
preamble message for verbose > 1.
Josh Stone [Thu, 20 May 2010 01:02:04 +0000 (18:02 -0700)]
PR10025: Don't read ahead tokens within preprocessor blocks
Since some aspects of the lexer are contextual, like wildcards in
probepoint identifiers, we need to wait for the right context in the
preprocessor rather than reading a bunch of tokens at once.
* parse.h (parser): Replace enqueued_pp with a pp_state stack.
* parse.cxx (parser::scan_pp): Use pp_state to decide if the current
token should be kept or skipped, and transition states as the various
%( %? %: %) are encountered.
(parser::skip_pp): Helper to leap over skipped tokens.
David Smith [Tue, 18 May 2010 18:19:23 +0000 (13:19 -0500)]
Fixed BZ 592830 by fixing signal.check_ignored.return for newer kernels.
* tapset/signal.stp (signal.check_ignored.return): Provide an alternative
for newer kernels where the sig_ignored() function has been inlined.
* tapset/errno.stp (return_str): New function.
* testsuite/buildok/signal-detailed.stp: Made the
signal.check_ignored.return test non-optional.
David Smith [Mon, 17 May 2010 20:45:32 +0000 (15:45 -0500)]
Added RHEL4 support to socket.stp and more testing.
* tapset/socket.stp: Removed kernel version checks and now works on RHEL4.
Tested on RHEL4, RHEL4, RHEL6(beta), f11, f12, and rawhide.
* testsuite/buildok/socket-detailed.stp: Renamed from socket.stp and updated.
* testsuite/buildok/socket-embedded.stp: Updated.
David Smith [Fri, 14 May 2010 18:03:53 +0000 (13:03 -0500)]
Update the ioblock and scheduler tapsets and testcases.
* tapset/ioblock.stp: Fixed several problems where the ioblock_trace
probes didn't all export the same convenience variables. Works on
RHEL4, RHEL5, RHEL6(beta), f11, f12, and rawhide.
* tapset/scheduler.stp: Fixed several problems where the kprobes backup
probes for tracepoints didn't work. Works on RHEL4, RHEL5, RHEL6(beta),
f11, f12, and rawhide.
* testsuite/buildok/ioblock-all-probes.stp: New testcase.
* testsuite/buildok/ioblock-detailed.stp: New detailed test of all ioblock
probes and convenience variables.
* testsuite/buildok/ioblock-embedded.stp: Added bio_rw_str() test.
* testsuite/buildok/ioblock_test.stp: Deleted old ioblock test.
* testsuite/buildok/scheduler-embedded.stp: New testcase.
* testsuite/buildok/scheduler-detailed.stp: New detailed test of all
scheduler probes and convenience variables.
* testsuite/buildok/scheduler-cpu_off.stp: New detailed test which can
fail on some platforms because we can't find inline function arguments.
* testsuite/buildok/scheduler-ctxswitch.stp: Ditto.
* testsuite/buildok/scheduler-migrate.stp: Ditto.
* testsuite/buildok/scheduler-test-tracepoints.stp: Deleted old test.
* testsuite/buildok/sched_test.stp: Ditto.
* testsuite/systemtap.pass1-4/buildok.exp: Kfail the scheduler
single-probe tests.
Josh Stone [Thu, 13 May 2010 22:01:13 +0000 (15:01 -0700)]
PR11598: Allow "&" address-of in @defined()
* parse.cxx (parser::parse_target_symbol): Do addressof parsing here.
(parser::parse_value): Yield addressof parsing to parse_target_symbol.
(parser::parse_defined_op): Don't insist on an identifier, could be &.
* testsuite/semok/thirtysix.stp: Add tests for @defined(&...).
David Smith [Wed, 12 May 2010 17:49:03 +0000 (12:49 -0500)]
PR 9871 (partial) fix. Removed some embedded-C in context.stp and task.stp.
* tapset/context.stp: Converted several functions from embedded-C to
script language.
* tapset/task.stp (task_parent): Converted from embedded-C to script
languange.
* testsuite/buildok/context-embedded.stp: Moved function tests not
actually present in context.stp to their own files.
* testsuite/buildok/context-symbols-embedded.stp: New testcase (includes
some tests from context-embedded.stp).
* testsuite/buildok/context-unwind-embedded.stp: Ditto.
* testsuite/buildok/ucontext-symbols-embedded.stp: Ditto.
* testsuite/buildok/ucontext-unwind-embedded.stp: Ditto.
* testsuite/systemtap.pass1-4/buildok.exp: Kfails the ucontext tests if
the system doesn't support uprobes.
Pretending that pre/postfix ++/-- operations only writes to its argument
messes up the optimization of a variable that is assigned and then
only used through post/prefix ++/--operators.
David Smith [Tue, 11 May 2010 20:05:14 +0000 (15:05 -0500)]
Updated networking.stp and added full testing.
* tapset/networking.stp: For RHEL4, marked netdev.hard_transmit and
netdev.change_mac probes as optional.
* testsuite/buildok/netdev.stp: Deleted old networking test.
* testsuite/buildok/networking.stp: Ditto.
* testsuite/buildok/networking-all-probes.stp: New basic test of
networking.stp.
* testsuite/buildok/networking-embedded.stp: New test of functions in
networking.stp.
* testsuite/buildok/networking-detailed.stp: New detailed test of all
netdev probes and convenience variables.
* testsuite/buildok/networking-change_rx_flag.stp: New detailed test which
can fail on some platforms because we can't find inline function
arguments.
David Smith [Tue, 11 May 2010 17:58:17 +0000 (12:58 -0500)]
PR 9871 (partial) fix. Removed all remaining embedded-C in vfs.stp.
* tapset/vfs.stp: Large update to get working on RHEL4, RHEL5,
RHEL6(beta), f11, f12, and rawhide. Removed all remaining embedded-C.
* testsuite/buildok/vfs-embedded.stp: Updated with more functions.
* testsuite/buildok/vfs-detailed.stp: New detailed test of all vfs probes
and convenience variables.
* testsuite/buildok/testsuite/buildok/vfs_testcase.stp: Deleted (replaced
by vfs-detailed.stp).
David Smith [Mon, 10 May 2010 20:32:28 +0000 (15:32 -0500)]
Updated ioscheduler.stp and tests.
* tapset/ioscheduler.stp: Large update to get working on RHEL4, RHEL5,
RHEL6(beta), f11, f12, and rawhide.
* testsuite/buildok/ioscheduler-all-probes.stp: New test.
* testsuite/buildok/ioscheduler-detailed.stp: New detailed test of all
ioscheduler probes and convenience variables.
* testsuite/buildok/ioscheduler.stp: Deleted, since no longer needed with
the addition of ioscheduler-detailed.stp.
Josh Stone [Fri, 7 May 2010 19:07:26 +0000 (12:07 -0700)]
PR11266: Catch target_symbols as non-assignment lvalues
There are more ways to modify values than just assignment;
"struct visitor" knows this, but var_expanding_visitor needs
a lesson.
* tapsets.cxx (var_expanding_visitor::rewrite_lvalue): New, factored out
of visit_assignment to change various lvalues into function calls.
(var_expanding_visitor::visit_assignment): Use rewrite_lvalue.
(var_expanding_visitor::visit_pre_crement): New.
(var_expanding_visitor::visit_post_crement): New.
(var_expanding_visitor::visit_delete_statement): New.
* testsuite/semko/target_lvalue.stp: Test for exit-1 without crashing.
On jistone's advice, tested the code on rhel4 where there is no
utrace. print_ubacktrace() works only on incoming kernel state
(which shouldn't really work anyway). Forcing uprobes for these
ubacktrace() type calls is therefore not a problem.
* buildrun.cxx (uprobes_pass): If uprobes still needed, probably
due to /* pragma:uprobes */, rejectfor utrace-less kernels.
PR11573: infer need for uprobes from special embedded-c markup tag
* tapset/ucontext-unwind.stp: Mark up these babies with /* pragma:uprobes */.
* elaborate.cxx (typeresolution_info::visit_embeddedcode): Look for that
and activate session.need_uprobes if found.
docs: clean up stapfuncs/stapprobes man pages, deprecate probefunc()
* probefuncs.3stap.in: Remove most sections that are redundant with
automatically extracted documentation in individual function::*(stap)
man pages.
* probeprobes.3stap.in: Ditto for probes::*(stap).
* tapset/context-symbols.stp (probefunc): Describe as deprecated.
Change default timeout for global variable locks to apprx. 1 ms,
in 10us chunks. TRYLOCKDELAY now measures microseconds.
* translate.cxx (translate_pass): Change TRYLOCKDELAY and
MAXTRYLOCK default values.
* runtime/probe_lock.h (stp_lock_probe): Use udelay() rather than
ndelay().
* runtime/time.c (STP_TIMELOCK*): New macros just for time seqlock
timeout purposes. Expected contention is negligible here.
Josh Stone [Wed, 5 May 2010 23:47:19 +0000 (16:47 -0700)]
PR11556: Support array indexing on @cast pointers
It's a bit of a special case, because we don't have a pointer DIE for
the named type in @cast expressions. However, we can read the element
size manually and still simulate an array access.
* loc2c.c (pointer_stride): New, factored out of array_stride.
(c_translate_array_pointer): New, performs the pointer math based on
the element size of the pointee type.
* dwflpp.cxx (dwflpp::translate_components): Take a starting component.
(dwflpp::literal_stmt_for_pointer): If the initial type is not already
a pointer or array, we can fake an array access on the input pointer.
* testsuite/semok/cast.stp: Add an array access test on a @cast.
* testsuite/systemtap.base/cast.stp: Ditto.
* testsuite/systemtap.base/cast.exp: Ditto.
Josh Stone [Wed, 5 May 2010 22:52:55 +0000 (15:52 -0700)]
Straighten out die/attr use in dwflpp translation
It was confusing (to me) what was the expected state of each die_mem and
attr_mem passed around in dwflpp translation. I've changed it now so
that we pass just a vardie and typedie, which I think is clearer. This
is also nicer for @cast where we don't have any attr for the initial
type.
* dwflpp.cxx (dwarf_die_type): Helper to get the type, throw on error.
(dwflpp::translate_components): Just update a vardie and typedie.
(dwflpp::translate_final_fetch_or_store): Use a vardie and typedie.
(dwflpp::resolve_unqualified_inner_typedie): Update dies, not attrs.
(dwflpp::literal_stmt_for_local): Update calls to above.
(dwflpp::literal_stmt_for_return): Ditto.
(dwflpp::literal_stmt_for_pointer): Ditto.
David Smith [Wed, 5 May 2010 17:32:21 +0000 (12:32 -0500)]
PR 11338 (partial): Used @defined in tcp.stp and new test cases.
* tapset/tcp.stp: Removed kernel version check. Made other small
improvements.
* testsuite/buildok/tcp-detailed.stp: New detailed test of all tcp probes
and convenience variables.
* testsuite/buildok/udp-detailed.stp: New detailed test of all udp probes
and convenience variables.
* testsuite/buildok/tcp-embedded.stp: Added rest of the tcp embedded-C
functions.
David Smith [Tue, 4 May 2010 21:39:52 +0000 (16:39 -0500)]
Updated context tapset (for RHEL4) and updated the context testcase.
* tapset/context.stp: Added RHEL4 fixes.
* tapset/context-embedded.stp: Added rest of the context embedded-C
functions and renamed from context-test.stp.