Dave Brolley [Thu, 12 Mar 2009 17:38:51 +0000 (13:38 -0400)]
2009-03-12 Dave Brolley <brolley@redhat.com>
* util.cxx (remove_file_or_dir): New function.
* util.h (remove_file_or_dir): New function.
* systemtap.spec (stap): Add stap-env, stap-gen-cert, stap-authorize-cert,
and stap-authorize-signing-cert.
(stap-client): Remove stap-find-or-start-server, stap-add-server-cert.
Add stap-authorize-server-cert.
(stap-server): Add stap-find-servers, stap-find-or-start-server,
stap-authorize-server-cert. Remove stap-gen-server-cert.
* stap-find-servers: Source stap-env. Use $stap_avahi_service_tag.
(initialization): Set timeout to 10.
(find_servers): Run avahi-browse in the background and wait for it.
Use a temp file for the output of avahi-browse. Kill avahi-browse if
the timeout expires.
(match_server): Set read timeout.
(fatal): New function.
* stap-find-or-start-server: Source stap-env. Use $stap_exec_prefix. Always
exit with 0.
* stap-start-server: Source stap-env. Check for the server PID as a running
process and for avahi-publish-service running as a child in order to
verify that the server is ready.
* stap-add-server-cert: Renamed to stap-authorize-server-cert. Source
stap-env. Call stap-authorize-cert.
* stap-client: Source stap-env. Use $stap_user_ssl_db and
$stap_root_ssl_db. Use $stap_tmpdir_prefix_client,
$stap_tmpdir_prefix_server. Use $stap_exec_prefix.
(configuration): Removed.
(staprun_running): Removed.
(interrupt): Don't kill staprun.
* stap-server: Source stap-env. Use $stap_user_ssl_db and
$stap_root_ssl_db. Use $stap_tmpdir_prefix_client,
$stap_tmpdir_prefix_server. Use $stap_exec_prefix.
(configuration): Removed.
* session.h (systemtap_session): Add cert_db_path.
* runtime/staprun/staprun_funcs.c (config.h): #include it.
(modverify.h): #include it.
(check_signature): New function.
(check_groups): New function extracted from check_permissions.
(check_permissions): Call check_groups and check_signature.
* runtime/staprun/mainloop.c (cleanup_and_exit): Pass modpath to staprun,
not modname.
* main.cxx (main): Initialize cert_db_path. Handle LONG_OPT_SIGN_MODULE.
Save the module signature if the module was signed and is being saved.
(LONG_OPT_SIGN_MODULE): #define it.
(long_options): Add --sign-module.
* cache.cxx (config.h): #include it.
(add_to_cache): Add the module signature file to the cache if the module
has been signed.
* buildrun.cxx (modsign.h): #include it.
(compile_pass): Call sign_module, if requested.
* configure.ac: Define HAVE_NSS if NSS libraries are available.
* Makefile.am (AM_CPPFLAGS): Add -DSYSCONFDIR.
(bin_SCRIPTS): Add stap-env, stap-gen-cert, stap-authorize-cert,
stap-authorize-signing-cert, stap-authorize-server-cert. Remove
stap-gen-server-cert, stap-add-server-cert.
(stap_SOURCES): Add nsscommon.c, modsign.cxx
(stap_CPPFLAGS): Add $(nss_CFLAGS), $(nspr_CFLAGS).
(stap_LDADD): Add -lnss3.
(staprun_SOURCES): Add nsscommon.c.
* modsign.cxx: New file.
* modsign.h: New file.
* nsscommon.c: New file.
* nsscommon.h: New file.
* runtime/staprun/modverify.c: New file.
* runtime/staprun/modverify.h: New file.
* stap-authorize-cert: New file.
* stap-authorize-signing-cert: New file.
* stap-env: New file.
* Makefile.in: Regenerated.
* aclocal.m4: Regenerated.
* config.in: Regenerated.
* configure: Regenerated.
* doc/Makefile.in: Regenerated.
* doc/SystemTap_Tapset_Reference/Makefile.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
* testsuite/aclocal.m4: Regenerated.
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.
David Smith [Tue, 17 Feb 2009 14:32:43 +0000 (08:32 -0600)]
Reduced control channel code duplication.
2009-02-17 David Smith <dsmith@redhat.com>
* control.c: Contains generic control channel functions.
* procfs.c: Specific procfs control channel functions. All generic
control channel functions moved to control.c.
* debugfs.c: New file containing debugfs specific control channel
functions.
* control.h: New file.
* transport.c: Updated file inclusion.
David Smith [Thu, 12 Feb 2009 20:52:40 +0000 (14:52 -0600)]
Cleanup. Renamed _stp_{un}lock_debugfs() to _stp_{un}lock_transport_dir().
2009-02-12 David Smith <dsmith@redhat.com>
* transport.c (_stp_lock_transport_dir): Renamed from
_stp_lock_debugfs(), since on older kernels this actually uses
procfs.
(_stp_unlock_transport_dir): Renamed from _stp_unlock_debugfs(),
since on older kernels this actually uses procfs.
(_stp_lock_transport_dir): Changed
_stp_lock_debugfs()/_stp_unlock_debugfs() to
_stp_lock_transport_dir()/_stp_unlock_transport_dir().
* transport.h: Ditto. Also added _stp_transport_init()
prototype.
* utt.c (utt_remove_root): Changed
_stp_lock_debugfs()/_stp_unlock_debugfs() to
_stp_lock_transport_dir()/_stp_unlock_transport_dir().
* relayfs.c (_stp_remove_relay_root): Ditto.
2009-02-12 David Smith <dsmith@redhat.com>
* procfs.c (_stp_rmdir_proc_module): Changed
_stp_lock_debugfs()/_stp_unlock_debugfs() to
_stp_lock_transport_dir()/_stp_unlock_transport_dir().
(_stp_mkdir_proc_module): Ditto.
Josh Stone [Wed, 11 Feb 2009 04:10:33 +0000 (20:10 -0800)]
Merge branch 'update_visitor'
This brings a new update_visitor that makes it easier to traverse the
parse tree and modify parts of it as necessary. I wrote this as part of
my in-progress work to allow @cast() expansion, but I was able to apply
it to the dwarf/etc. target variable expanders and to the optimization
stages. I think the resulting code is more predictable and easier to
follow...
Conflicts:
ChangeLog (bumped my commit dates to push dates...)
Josh Stone [Wed, 11 Feb 2009 02:29:55 +0000 (18:29 -0800)]
Simplify dead_stmtexpr_remover
* staptree.h (update_visitor::require): Add a clearok parameter for
optimizing traversers to signal that they're ready for NULL back.
* elaborate.cxx (dead_stmtexpr_remover): Convert to an update_visitor.
Josh Stone [Fri, 6 Feb 2009 04:04:56 +0000 (20:04 -0800)]
Expand probe variables without a deep copy
* tapsets.cxx (var_expanding_copy_visitor): This struct becomes
var_expanding_visitor and inherits from update_visitor instead of
deep_copy_visitor. Each of the probe-type variants of this are also no
longer copiers.
Josh Stone [Fri, 6 Feb 2009 04:02:35 +0000 (20:02 -0800)]
Create update_visitor for modifying trees
* staptree.h (update_visitor): A new visitor to make it easier to
rewrite parts of a probe or function without making a full copy.
* staptree.cxx (update_visitor::*): Each child is recursed with a
require() call, and then the parent returns itself with provide().
* staptree.h (deep_copy_visitor): Inherit from update_visitor to get
the recursive descent while updating nodes.
* staptree.cxx (deep_copy_visitor::*): Use the implicit copy
constructors to copy all fields, then defer to update_visitor for the
recursion. Referents are still cleared from the copies of symbols and
function calls.