David Smith [Thu, 5 Jan 2012 17:16:27 +0000 (11:16 -0600)]
Fix gcc 4.7 compile issues (most related to gcc PR49745).
* cache.cxx: Include <unistd.h>
* session.cxx: Ditto.
* setupdwfl.cxx: Ditto.
* translate.cxx (emit_symbol_data): Set correct type on structure
initialization to avoid gcc 4.7 error.
* runtime/autoconf-fs_supers-hlist.c: New test.
* buildrun.cxx (compile_pass): Run it.
* runtime/transport/transport.c (_stp_get_root_dir): Use
hlist_entry etc. if needed.
* runtime/autoconf-relay-umode_t.c: New test.
* buildrun.cxx (compile_pass): Run it.
* runtime/transport/relay_v2.c (__stp_relay_create_buf_file_callback):
Change int -> umode_t if needed.
Mark Wielaard [Sun, 25 Dec 2011 19:56:53 +0000 (20:56 +0100)]
Use function.call and function.return in all thread_indent() examples.
If the .call modifier isn't used the function probes will match both .call
and .inline, but .return doesn't match any inlined functions leading to
unbalanced thread_indent output.
Frank Ch. Eigler [Fri, 23 Dec 2011 19:49:56 +0000 (14:49 -0500)]
$SYSTEMTAP_SYNC: new environment variable for staprun
If set, it runs a sync(2) before the stap init_module(2)s. This is
only for helping bring up stap on unstable environments, so is not
formally documented.
Frank Ch. Eigler [Thu, 22 Dec 2011 02:06:24 +0000 (21:06 -0500)]
tapset: separate env_var() from context.stp
If it's left in context.stp, it will drag in tokenize.stp, which in
turns drags in an unoptimizable %{ #define STAP_NEED_CONTEXT_TOKENIZE 1 %}
which in turns enlarges the context.
* tapset/context-envvar.stp: New file. Steal env_var() from ...
* tapset/context.stp: ... from here.
(Note that there is no security impact to this change. The worst that
could happen before were unnecessary staprun startup errors.)
* runtime/staprun/staprun_funcs.c (insert_module): Return a nontrivial
error return code in some cases. (More needed!) Don't kvetch about
a failing init_module(2).
* runtime/staprun/staprun.c (enable_uprobes): Don't grep kallsyms for
an optimistic early abort. Just call insert_module. Don't freak upon
an EEXIST.
(insert_stap_module): Kvetch about a failing insert_module().
* testsuite/systemtap.base/buildid.exp: Stop using that profane artefact
of an obsolete past, "staprun -u".
Chris Meek [Tue, 20 Dec 2011 22:14:50 +0000 (17:14 -0500)]
PR13274 related: Added class to save and restore variables
Added a class save_and_restore to automatically save the value of
a variable, and restore it and the end of the calling function.
Can optionally take a variable to initialize the value to something
after saving it.
Changed warning printing to use session.print_warning(),
and cleaned up warnings being printed.
Also changed the logic in semantic_pass_optimize1 and 2
to either print all warnings if the verbosity is high enough
or suppress all warnings after the 1st itteration.
Changed it so we always use session.print_warning() rather than
an explicit call to clog or cerr. (There are a few cases where
the session is not available, so they were left as is, but
marked up with an // XXX needs-session comment.)
Also changed print_warning() to check for suppress_warnings, so
we no longer have to explicitly check for it when calling
print_warning(). There are a few cases where I left in the
explicit check, specifically when there was more code than
just a simple call to print_warning() within it.
Also standardized the use of "WARNING:". All warnings should now
use "WARNING:" rather than "Warning:" or "warning:".
Frank Ch. Eigler [Tue, 20 Dec 2011 20:49:35 +0000 (15:49 -0500)]
PR13489: don't confuse staprun's "is uprobes in the kernel?" logic
After recent commits associated with PR13489, a stap module may
include a few symbols named kallsyms_*, specifically
*unregister_uprobe. This confused staprun's simpleminded grep on
/proc/kallsyms to guess that uprobes per se was in the kernel, even
though it was just some peer stap module. So now grep for a more
picky regexp, including all-important whitespace.
* runtime/staprun/staprun.c (enable_uprobes): Look for
" unregister_uprobe\t" instead of "unregister_uprobe".
William Cohen [Fri, 16 Dec 2011 18:40:01 +0000 (13:40 -0500)]
Add the speculative.stp tapset
The speculative.stp tapset allow one to speculative add things to
output buffers and then later commit or discard the information in the
buffers. Four functions in the tapset:
speculation() - function to give an id for speculative buffer
speculate() - add output to a speculative buffer
discard() - remove output for a speculative buffer
commit() - output data for a speculative buffer
Frank Ch. Eigler [Mon, 19 Dec 2011 14:03:58 +0000 (09:03 -0500)]
PR13489, the neverending kludge story. Resolve RHEL5's old utrace conflicts.
RHEL5's old utrace uses utrace_native_view() instead of
task_user_regset_view(), so we shouldn't be so stuck on trying to find
it. To add insult to injury, any attempt to use kallsyms* to look up
the latter results in an unloadable module since kallsyms* is not
exported in these old kernels.
* transport/transport.c (_stp_transport_init): Only look for
task_user_regset_view for other than old rhel5 utrace.
Frank Ch. Eigler [Sun, 18 Dec 2011 16:50:14 +0000 (11:50 -0500)]
PR13489 finale (?): tolerate non-existent task_user_regset_view
* runtime/loc2c-runtime.h: Tweak task_user_regset_view-substitute macro
to return 0 on failed kallsyms.
* runtime/transport/transport.c: Don't have a cow if task_user_regset_view
is missing, like on older ARM kernels.
David Smith [Fri, 16 Dec 2011 20:32:20 +0000 (14:32 -0600)]
Rename tapset/rpc.stp variable to indicate its internal-only nature.
* tapset/rpc.stp (_sunrpc.clnt.create_client.rpc_new_client_inline):
Rename 'args' to '__args' to indicate that '__args' is an internal-only
variable. Deprecate old name.
* NEWS: Mention 'args' variable deprecation.
* stap.1: Ditto.
Mark Wielaard [Fri, 16 Dec 2011 18:25:32 +0000 (19:25 +0100)]
task_finder_vma.c (__stp_tf_vma_new_entry): No unnecessary atomic allocs.
We can be a little nicer when allocating kernel memory under the
traditional task_finder which uses utrace. See
http://sourceware.org/ml/systemtap/2011-q4/msg00357.html
Mark Wielaard [Fri, 16 Dec 2011 15:59:00 +0000 (16:59 +0100)]
modname/symdata: Try harder to retrieve module name when requested.
When the user really wants a kernel module name with an address and
we are unable to map it to any existing one then fall back on using
__module_text_address() with appropriate locking.
Mark Wielaard [Fri, 16 Dec 2011 15:43:04 +0000 (16:43 +0100)]
_stp_vma_mmap_cb: Also extend mapping that don't overlap but are connected.
If a vma mapping for a module already exist but a new mapping for the module
is added that is connected right at the end of it, then just extend the
existing vma mapping. This fixes the exelib.exp testcase on s390x for PIE
executables.
William Cohen [Thu, 15 Dec 2011 16:27:45 +0000 (11:27 -0500)]
Adjust periodic.stp example to run on kernels without struct delayed_work
RHEL-5 kernels have the timer_expire_entry tracepoint, but do not have
struct delayed_work. Some @defined magic is used to select the
fallback if struct delayed_work is not around.
Dave Brolley [Tue, 13 Dec 2011 21:08:38 +0000 (16:08 -0500)]
PR 13496: stap could show some progress of the communication with the server
- Moved "Using a compile server" message to -v level
- Moved details of automatic server detection to -vv level
- Moved reasons for server acceptance/rejection to -vvv level
- Moved details of clent/server request/response packaging to -vvvv level.
David Smith [Tue, 13 Dec 2011 17:33:38 +0000 (11:33 -0600)]
Add HAVE_TASK_FINDER define to simplify some code.
* runtime/runtime.h: Add HAVE_TASK_FINDER define if we've got any form of
utrace.
* runtime/task_finder.c: Use HAVE_TASK_FINDER to know whether to define
dummy functions.
* runtime/vma.c (_stp_vma_init): Use HAVE_TASK_FINDER define.
Frank Ch. Eigler [Mon, 12 Dec 2011 22:50:59 +0000 (17:50 -0500)]
configury: fix make -j all install
Due to an autoconf weirdness, make -j all install would run make
all-recursive and make install-recursive in parallel, and let the two
builds step on each others' toes.
* Makefile.am (install): Explicitly require all. Recurse by hand.
* Makefile.in: Regenerated.
Mark Wielaard [Mon, 12 Dec 2011 21:52:18 +0000 (22:52 +0100)]
PR13467 Provide alternative testcase for pointer_array.exp.
pointer_array.exp depends on indexing an array from a user pointer in
kernel context. This doesn't work on s390x, which has separate user and
kernel space addresses. kallsyms_expand_symbol.exp decodes the kallsyms
table from kernel space using various array pointer manipulations.
Mark Wielaard [Mon, 12 Dec 2011 14:54:59 +0000 (15:54 +0100)]
Protect just the transport state with _stp_transport_mutex.
_stp_transport_mutex was held over the whole of _stp_handle_start()
and _stp_cleanup_and_exit(). This is unnecessary and dangerous since
some functions that get called could sleep. Add a new state variable
_stp_start_called and protect just that together with _stp_exit_called
to make sure _stp_handle_start() and _stp_cleanup_and_exit() are only
executed once.
Frank Ch. Eigler [Mon, 12 Dec 2011 14:28:23 +0000 (09:28 -0500)]
PR13489: support inode-uprobes without EXPORT_SYMBOL*'s
Until lkml sees fit to EXPORT_SYMBOL* various inode-uprobes related
symbols, we must kludge around this.
* buildrun.cxx (compile_pass): Track export status for
register_uprobe, unregister_uprobe, task_user_regset_view.
* runtime/runtime.h: Declare void* versions if needed.
* runtime/transport/transport.c: kallsyms_lookup_name them if needed.
* runtime/loc2c-runtime.h, runtime/uprobes-inode.c: Use them.