Stan Cox [Sun, 8 Mar 2009 23:55:05 +0000 (19:55 -0400)]
Fix and add tests for function(".so").statement(N)
* tapsets.cxx (query_dwarf_func): die_has_pc (dwarf_haspc) does not expect a
module_start for shared objects so don't call module_address_to_global for the
statement address.
* testsuite/systemtap.base/labels.exp: Add tests for executable .statement(N),
shared object .label("L") and so .statement(N).
If stap is run with "-t -DDEBUG_REENTRANCY", additional warnings will
be printed for every reentrancy event, including the probe points of
the resident and interloper probes.
* tapsets.cxx (common_probe_entryfn_prologue): Add "new_pp" argument,
update all callers. Print reentrancy details if needed.
Josh Stone [Sat, 7 Mar 2009 03:30:39 +0000 (19:30 -0800)]
Ensure tracepoints are synchronized after unreg
The tracepoint API provides tracepoint_synchronize_unregister() as a way
to guarantee that all tracepoint handlers are inactive. This is
necessary after unregistering to allow the module to safely unload.
* tapsets.cxx (tracepoint_derived_probe_group::emit_module_init):
Call synchronize after unregistering tracepoints.
(tracepoint_derived_probe_group::emit_module_exit): Ditto.
Josh Stone [Fri, 6 Mar 2009 23:44:50 +0000 (15:44 -0800)]
Support older tracepoints using DEFINE_TRACE
At one point, the tracepoints API didn't have DECLARE_TRACE, and the
trace headers all used DEFINE_TRACE. This is what got pulled into RHEL,
so we need to support this older usage. The rest of the API stays the
same though.
* buildrun.cxx (make_tracequery): Redefine DEFINE_TRACE as well.
Josh Stone [Thu, 5 Mar 2009 05:07:54 +0000 (21:07 -0800)]
Enable tracepoint target variables
This uses a similar mechanism as marker probes for storing target
variables in locals of the probe body.
* tapsets.cxx (tracepoint_arg): Add fields to help $target access.
(tracepoint_var_expanding_visitor): Expand code to access target
variables - a $target for each tracepoint parameter, as well as
the special $$name and $$vars.
(tracepoint_derived_probe::tracepoint_derived_probe): Expand targets
(resolve_tracepoint_arg_type): Determine if a parameter is a type
that we can dereference, and store the underlying type.
(tracepoint_derived_probe::build_args): Resolve the types.
(tracepoint_derived_probe::emit_probe_context_vars): Emit $target
placeholders into the locals of the probe body.
(tracepoint_derived_probe_group::emit_module_decls): Initialize
$targets from the entry point parameters.
Josh Stone [Thu, 5 Mar 2009 04:32:22 +0000 (20:32 -0800)]
Emit code to hook up tracepoint probes
* tapsets.cxx (tracepoint_arg): New
(tracepoint_derived_probe): Add declaring header name and arg vector
(dwarf_type_name): Build a type string for a given type DIE
(tracepoint_derived_probe::build_args): Scan the function DIE for
the name and type of formal parameters required by the tracepoint.
(tracepoint_derived_probe::tracepoint_derived_probe): Call
build_args and determine the relevant header to include.
(tracepoint_derived_probe_group::emit_module_decls): For each
tracepoint, include its header and declare a probe entry point with
the right function signature.
(tracepoint_derived_probe_group::emit_module_init): Call the
registration for each tracepoint, and handle error unwinding.
(tracepoint_derived_probe_group::emit_module_exit): Unregister each.
Josh Stone [Thu, 5 Mar 2009 04:17:38 +0000 (20:17 -0800)]
Build skeleton tracepoint probes
* tapsets.cxx (tracepoint_derived_probe): Create a skeleton probe
(tracepoint_derived_probe_group): Create a skeleton group
(tracepoint_query::handle_query_func): build a probe
Josh Stone [Thu, 5 Mar 2009 03:56:02 +0000 (19:56 -0800)]
Scan tracequery.ko for tracepoints
* tapsets.cxx (tracepoint_query): Iterate over the modules, CUs, and
functions in tracequery.ko looking for our hijacked tracepoint
declarations.
(tracepoint_builder::build): Run a tracepoint_query
Josh Stone [Thu, 5 Mar 2009 03:32:25 +0000 (19:32 -0800)]
Build tracequery to scan for tracepoints
* session.h (systemtap_session): add tracepoint_derived_probes
* buildrun.cxx (make_tracequery): New - builds a kernel module that
hijacks the tracepoint declarations, so we can query debuginfo.
* buildrun.h: declare above
* tapsets.cxx (tracepoint_builder): New builder for tracepoint
probes. For now it just handles the initialization to build the
tracequery kernel module.
Tim Moore [Wed, 4 Mar 2009 10:56:45 +0000 (11:56 +0100)]
stap autoconf test for kernel stack trace support
* buildrun.cxx (compile_pass): Add autoconf line for stack trace
test, which defines STAPCONF_KERNEL_STACKTRACE.
* runtime/autoconf-save-stack-trace.c: New file.
* runtime/stack.c : Use STAPCONF_KERNEL_STACKTRACE instead of
tests for kernel configuration and versions.
* runtime/stack-i386.c : ditto
* runtime/stack-x86_64.c : ditto
Maynard Johnson [Tue, 3 Mar 2009 22:41:48 +0000 (16:41 -0600)]
This patch updates the itrace code to support the new utrace interface.
It also adds a private copy of access_process_vm to runtime/itrace.c
since that function is not consistently exported by all distros.
Mark Wielaard [Fri, 27 Feb 2009 14:16:52 +0000 (15:16 +0100)]
Use @cast where possible for examining inet_sock.
* tapset/inet_sock.stp: Remove includes.
(inet_get_local_port): No embedded C, use @cast.
(inet_get_ip_source): Likewise.
(daddr_to_string): New function, still some embedded C used.
Josh Stone [Mon, 23 Feb 2009 23:08:02 +0000 (15:08 -0800)]
Add a testcase for gtod init/kill
This test simply checks that _gettimeofday_init and _gettimeofday_kill
are pulled in when gettimeofday is used, and also that they are NOT
pulled in when gettimeofday is not used.
Josh Stone [Mon, 23 Feb 2009 22:22:38 +0000 (14:22 -0800)]
Add selective use of _stp_time_init/kill (PR9822)
Our gettimeofday runtime has frequent wakeups to stay in sync with
kernel time, but this is wasted effort if gettimeofday is not used in
the script. This patch moves the calls to _stp_time_init and
_stp_time_kill into begin and end/error probes, which only get pulled in
if one of the gettimeofday variants is called.
Stan Cox [Mon, 23 Feb 2009 22:14:52 +0000 (17:14 -0500)]
Improve static probe: c++ navigation, -l output.
* tapsets.cxx (dwflpp::build): Improve c+ method navigation.
Use .label for listing mode.
* systemtap.base/static_uprobes.exp: Test multiple invocations of the same
probe per block. (SW9770)
Dave Brolley [Fri, 20 Feb 2009 21:58:57 +0000 (16:58 -0500)]
Check for required resources and tools before attempting tests using the client/server.
Ensure that tests run with/without the server have unique names.
Mark Wielaard [Fri, 20 Feb 2009 13:12:19 +0000 (14:12 +0100)]
Ignore kernel functions with "absolute" addresses.
translate.cxx (dump_unwindsyms): Augment the test for creating the
stap-symbols to be STT_FUNC && !(SHN_UNDEF || SHN_ABS). The combination
STT_FUNC && SHN_ABS only seems to occur on older i386 kernels and covers
the vDSO "functions" we were seeing.
Josh Stone [Fri, 20 Feb 2009 04:00:31 +0000 (20:00 -0800)]
Update guidelines for the ChangeLog-less world
Getting rid of ChangeLogs doesn't mean that we get a free ticket -- we
now need to be more diligent about providing meaningful commit messages.
I've updated the HACKING file with a first draft of new guidelines, but
we may still revise what we feel is appropriate detail in the logs.
I removed the ChangeLog section from the tapset/DEVGIDE entirely, and
also fixed the path where examples are stored.
Josh Stone [Fri, 20 Feb 2009 03:06:43 +0000 (19:06 -0800)]
Kill all ChangeLogs
Mark Wielaard, a dear friend of the departed, will be performing a song
and dance at the funeral services to commemorate the joyous times that
they had together.
Josh Stone [Fri, 20 Feb 2009 02:26:47 +0000 (18:26 -0800)]
Clean up extraneous build warnings
The testsuite Makefile doesn't have any useful targets except check and
installcheck, and those two are invoked directly by the top-level
Makefile. So, I'm removing testsuite from automake's SUBDIRS, but
keeping it in DIST_SUBDIRS for cleanup.
I also renamed our top-level check target to check-local, so it
cooperates with automake's check instead of overriding it.
Josh Stone [Wed, 18 Feb 2009 02:15:06 +0000 (18:15 -0800)]
Enable dwarf expansion of @casts
This will iterate over the module and its CUs looking for the type
definition, and then work with loc2c to dereference the pointer.
* loc2c.c (c_translate_argument): Create a dummy location to start
the address computation from a function parameter.
* translate.cxx (base_query, dwarf_query): Move some members from
base_query to dwarf_query, so the former can be more generic. Also
add a constructor using a module string instead of probe parameters.
(dwflpp::query_modules, dwflpp::iterate_over_modules): Use a generic
base_query instead of a dwarf_query.
(dwarf_cast_query): New query to scan the modules and CUs for a
matching type definition, and then produce a code fragment to deref
each component.
(dwarf_cast_expanding_visitor): Tries to replace @casts with a function
call to the result of a dwarf_cast_query.
(dwflpp::declaration_resolve): Search by name instead of by die.
(dwflpp::translate_components): Use the incoming vardie as the first
type die, so we don't assume that attr_mem has a DW_AT_type already.
(dwflpp::literal_stmt_for_pointer): Construct a C fragment that starts
with a pointer argument (THIS->pointer) and dereferences each member
component from there.
(*_derived_probe::register_patterns): Take a session parameter instead
of a match_node, so we can manipulate session-wide data.
(dwarf_derived_probe::register_patterns): Add a session code filter to
expand @casts with a dwarf_cast_expanding_visitor.
Josh Stone [Wed, 11 Feb 2009 23:28:41 +0000 (15:28 -0800)]
Enable session-wide code filtering
This will be used to hook to dwarf_builder to all functions and probes
so it can attempt @cast expansion.
* session.h (systemtap_session): Add a vector of update_visitors
that will act as filters for all probes and functions.
* elaborate.cxx (semantic_pass_symbols): Run probes and functions
through each registered code filter.
Josh Stone [Wed, 11 Feb 2009 22:43:24 +0000 (14:43 -0800)]
Provide dwarf module names as defaults in @cast()s
* tapsets.cxx (dwarf_var_expanding_visitor::visit_cast_op): While
expanding dwarf probes, provide the current module as a default to
@casts without a module name.
Josh Stone [Wed, 11 Feb 2009 22:34:32 +0000 (14:34 -0800)]
Add high-level support for @cast()ing
This handles all of the parsing, traversal, and optimization. It
doesn't actually resolve the cast yet though.
* staptree.h (struct cast_op, visitor::visit_cast_op): New.
* staptree.cxx (cast_op::print/visit, various visitor::visit_cast_op's):
Incorporate cast_op into the basic tree operations.
* parse.cxx (parser::parse_symbol): Parse @cast operator with an
expression operand, type string, and optional module string.
* translate.cxx (c_unparser::visit_cast_op): Error out if a @cast
survives to translation.
* elaborate.cxx (typeresolution_info::visit_cast_op): Error out if a
@cast survives to type resolution.
(symbol_fetcher::visit_cast_op): treat @casts as a symbol target
(void_statement_reducer::visit_cast_op): unused @casts can be discarded,
but the operand should still be evaluated.