Frank Ch. Eigler [Wed, 21 Mar 2012 01:02:19 +0000 (21:02 -0400)]
PR13876: avoid miscompilation of duplicated tapset function
It was found that the translator got confused if the same function was
defined by the tapset and the end-user script. The same problem can
also afflict global variables. Along the way, clean up error
formatting.
* staptree.h (semantic_error): Drop msg2 field, which was only ever
used for the perfunctory string "vs".
* elaborate.cxx (semantic_pass_symbols): Perform duplicate
global-variable & function testing and rejection.
(symresolution_info::find_function): Print an extra warning for
the case of mismatched function callee/caller arities.
(derive_probes): Prepare chained "while resolving
probe point" semantic_error instead of msg2 based additions.
* session.cxx (register_library_aliases): Ditto.
(print_error): Adjust to loss of msg2. Print tok1 / tok2
and source-context in a more readable way.
* tapsets.cxx (visit_target_symbol_context): Use const semantic_error*
temps to adjust to chaining changes.
* testsuite/systemtap.base/statement.exp: Adjust to changed error message.
* translate.cxx (*): Adjust to loss of semantic_error msg2.
Josh Stone [Tue, 20 Mar 2012 20:04:18 +0000 (13:04 -0700)]
PR13878: Mention the module in @cast "not found" message
To help understand when @cast fails to find a type, mention the module
that was searched. This may already hinted by the e->tok source
location, but stating the module explicitly is a useful hint if the user
left the module field to be implicitly filled in.
David Smith [Thu, 15 Mar 2012 18:04:35 +0000 (13:04 -0500)]
Fix PR13815 by fixing task_dentry_path() tapset function for RHEL5.
* tapset/dentry.stp (task_dentry_path): Fix for later RHEL5 kernels by
handling 'struct path' renamed to 'struct vfs_path' (problem first
noticed in kernel 2.6.18-308.el5).
Frank Ch. Eigler [Wed, 14 Mar 2012 19:16:37 +0000 (15:16 -0400)]
PR13847: simplify compiled-printf functions
* translate.cxx (emit_compiled_printfs): Emit flatter code, with
fewer { variables; } that a bad compiler can translate to a large
call frame. This appears to allow normal (non-noinline) functions.
Frank Ch. Eigler [Wed, 14 Mar 2012 17:10:38 +0000 (13:10 -0400)]
PR13847: don't build debuginfo for stap modules
Suppressing the -g (by default) for stap_*.ko reduces compile time
and greatly reduces resulting .ko file size. Since stap modules
are not usually probed themselves, this is a good default.
* buildrun.cxx (make_any_make_cmd): Prefix kbuildflags with CONFIG_DEBUG_INFO=.
William Cohen [Wed, 14 Mar 2012 15:43:50 +0000 (11:43 -0400)]
Allow sysroot_sysenv.exp to run correct on machines without uprobes
If the kernel does not have uprobes support, the sysroot_sysenv test
is untested. The catch and wait statements are only needed for the
case where the test is actually run. Having the catch statment run
when the test does not run causes an error.
Stan Cox [Wed, 14 Mar 2012 01:54:15 +0000 (21:54 -0400)]
Make the .library modifier aware of RPATH
* tapsets.cxx (base_query): Treat .library("lib") as a wildcard if it
isn't found in LD_LIBRARY_PATH
(query_modue): Likewise.
(query_one_library): Likewise.
dwarf_builder::build): Likewise.
Josh Stone [Mon, 12 Mar 2012 21:42:28 +0000 (14:42 -0700)]
Adapt to the inode-uprobes name change in tip
We now have the functions register_uprobe -> uprobe_register and
unregister_uprobe -> uprobe_unregister. The client API has otherwise
not changed.
I've made our code reflect the new names as much as possible, treating
the old names as the exceptional case, in case we ever want to remove
that compatibility. For now, it should work in all cases, although I
don't have a full complement of old/new & exported/!exported kernels to
test with.
Josh Stone [Fri, 9 Dec 2011 17:24:31 +0000 (09:24 -0800)]
Preliminary SDT semaphores with inode-uprobes
This adds mmap tracking to our inode-uprobes client, so we may
manipulate SDT semaphores as modules come and go. It seems to work ok,
though remaining sleepiness issues may need to be worked out in
task_finder2.
Wade Farnsworth [Thu, 8 Mar 2012 14:49:04 +0000 (07:49 -0700)]
PR12331: Introduce stap options --sysroot and --sysenv
This adds new command-line options to facilitate different file locations at
compile-time versus run-time when generating stap kernel modules for a remote
system:
1. --sysroot=DIR
Specifies a separate filesystem for the remote system on the local
system. The following stap functionalities will make use of this:
a. When compiling process and library probes with a remote filesystem path
(e.g. process("/bin/foo") with --sysroot=/bar/baz). In this case symbols
will be taken from the local filesystem (/bar/baz/bin/foo), but the
resulting .ko will still contain paths on the remote filesystem
(/bin/foo).
b. When passing a kernel release with -r (not a full path), the kernel
build directory will be expected in the sysroot.
c. When DWARF debug info is contained in a separate file from the
executable, the sysroot is used to find the debug info files.
d. All calls to find_executable() search the path passed in the
argument env_path relative to the sysroot. For example if
PATH=/bin/foo, and --sysroot=/bar/baz is provided, then
find_executable() called with env_path == "PATH" will search
/bar/baz/bin/foo.
e. stap attempts to detect if a path in a probe would be outside of the
sysroot and errors appropriately. This situation may occur, for
example, if the path contains several ".." directories.
2. --sysenv=VAR=VALUE
Specifies a different environment variable for the remote system as opposed
to the local one, and that the value on the remote system should be used.
Currently only valid env_path arguments to find_executable() are handled
(i.e. PATH, LD_LIBRARY_PATH). If --sysroot is provided and --sysenv
is omitted, then the local environment relative to the sysroot will
be used.
Mark Wielaard [Thu, 8 Mar 2012 14:20:08 +0000 (15:20 +0100)]
Select most specific CU srcfile that matches @var("var@src") specification.
dwarf_var_expanding_visitor::getcuscope: If there is a perfect match
select that CU, otherwise, select the CU srcfile that is most specific
(matching path/src file lenght is shortest).
Mark Wielaard [Wed, 7 Mar 2012 18:58:12 +0000 (19:58 +0100)]
PR13784 Allow defining a diffent CU source in @var.
Add cu_name to struct target_symbol. Set it in parse_target_symbol
to the string after @ in @var("somevar@some/src/file.c"). Make
target_symbol::sym_name() aware of @cu_name postfix (don't return it).
Add dwarf_var_expanding_visitor::getcuscope() which figures out the
CU DIE to use as scope if target_symbol has cu_name part. Extend
global_var.exp test to show new capability.
David Smith [Wed, 7 Mar 2012 18:05:39 +0000 (12:05 -0600)]
Remove CONFIG_UTRACE use in testsuite and just depend on utrace_p/uprobes_p.
* testsuite/buildok/pretty.stp: Moved uprobes tests to pretty-uprobes.stp.
* testsuite/buildok/pretty-uprobes.stp: New test.
* testsuite/buildok/ucontext-symbols-embedded.stp: Remove CONFIG_UTRACE
check and let buildok.exp kfail the test if no uprobes.
* testsuite/buildok/ucontext-unwind-embedded.stp: Ditto.
* testsuite/buildok/utrace.stp: Ditto.
* testsuite/semko/utrace.stp: Remove CONFIG_UTRACE check and let semko.exp
handle it.
* testsuite/semok/pretty.stp: Move uprobes tests to pretty-uprobes.stp.
* testsuite/semok/pretty-uprobes.stp: New test.
* testsuite/semok/thirtysix.stp: Move utrace tests to thirtysix-utrace.stp.
* testsuite/semok/thirtysix-utrace.stp: New test.
* testsuite/semok/utrace01.stp: Remove CONFIG_UTRACE check and let
semok.exp handle it.
* testsuite/systemtap.base/bz10294.stp: Remove CONFIG_UTRACE check and let
statement.exp handle it.
* testsuite/systemtap.base/bz6905.stp: Ditto.
* testsuite/systemtap.base/statement.exp: Handle no utrace by marking
tests as untested.
* testsuite/systemtap.base/func_alias.exp: If no utrace, mark test as
untested.
* testsuite/systemtap.pass1-4/buildok.exp: Kfail more utrace/uprobes tests.
* testsuite/systemtap.pass1-4/semko.exp: Ditto.
* testsuite/systemtap.pass1-4/semok.exp: Ditto.
Mark Wielaard [Tue, 6 Mar 2012 16:34:36 +0000 (17:34 +0100)]
Introduce @var("varname") as alternative syntax for $varname.
Adds a field target_name and a method sym_name() to struct target_symbol
to be used by the parser and tapsets translator so $name and @var("name")
can be used interchanably. Adds a testcase at_var.exp to test this for
various combinations of uprobes, kprobes, parameters, variables, arrays,
fields access, pretty printing and taking addresses.
Mark Wielaard [Wed, 7 Mar 2012 14:22:57 +0000 (15:22 +0100)]
Fix kallsyms_expand_symbol.exp regression after commit 4d51e8.
In dwflpp::find_variable_and_frame_base() when we do a search for a search
for an alternative vardie we need to saved the actual vardie content in
case we fail, no just copy the pointer to the vardie data...
Mark Wielaard [Wed, 7 Mar 2012 12:35:56 +0000 (13:35 +0100)]
PR10622. Better workaround for GCC PR51410. Find external var DIE location.
Some GCC versions would output duplicate external variables, one
without a location attribute. If so, try to find the other if it
exists in the same scope. This is a better solution than the previous
fallback solution of just trying to get the address in the symbol table.
That could result in picking the wrong external variable with the same
name (but from a different CU). Add test case to show this works better.
Dave Brolley [Tue, 6 Mar 2012 17:48:32 +0000 (12:48 -0500)]
Long options rework.
- Don't rely on the order of stap_long_options for indexing
- getopt_long now returns all option ids
- Same for options processing in stap-serverd
- Update client_args test suite
Chris Meek [Mon, 5 Mar 2012 21:16:31 +0000 (16:16 -0500)]
PR13661: Relax Server Rlimits (move to stap)
Added rlimit options to stap:
--rlimit-as=NUM
--rlimit-cpu=NUM
--rlimit-nproc=NUM
--rlimit-stack=NUM
--rlimit-fsize=NUM
These options will set the appropriate rlimits to whatever is
provided.
Removed all rlimit handling from stap-serverd.cxx. These values
can be specified in ~stap-server/.systemtap/rc.
Default values are added to ~stap-server/.systemtap/rc on install.
William Cohen [Fri, 2 Mar 2012 17:13:53 +0000 (12:13 -0500)]
Clean out tracking for blocks that are merged into other blocks
The IO system in linux often merges blocks together to reduce the number of
IO operations sent to IO devices. If nothing is done the tracking for
merged IO operations can fill up the associative arrays, causing the script
to fail. This problem was reported in rhbz743591. This commit resolves
this problem.
William Cohen [Fri, 2 Mar 2012 17:07:21 +0000 (12:07 -0500)]
Clean out tracking for blocks that are merged into other blocks
The IO system in linux often merges blocks together to reduce the number of
IO operations sent to IO devices. If nothing is done the tracking for
merged IO operations can fill up the associative arrays, causing the script
to fail. This problem was reported in rhbz743591. This commit resolves
this problem.
Stan Cox [Thu, 1 Mar 2012 04:11:32 +0000 (23:11 -0500)]
Match Requires to existing package layout.
* systemtap.spec (main): Only BuildRequires gcc-c++
(devel): Requires gcc make
(testsuite): Requires gcc gcc-c++ make glibc-devel and possibly glibc-devel.i386
Josh Stone [Wed, 29 Feb 2012 02:48:04 +0000 (18:48 -0800)]
PR13721 (partial): Move cross-file WARNING before setting arity
For PR10799, there is a WARNING check for when globals are used across
different files. However, set_arity was done first, so any exception
there would bypass the check.
* elaborate.cxx (symresolution_info::find_var): Warn before set_arity.
Mark J. Wielaard [Sat, 25 Feb 2012 16:05:48 +0000 (17:05 +0100)]
kernel/sched.c is no more, use kernel/time.c in examples and tests.
kernel commit v3.2-rc1-319-g391e43d
"sched: Move all scheduler bits into kernel/sched/"
removed kernel/sched.c. Use kernel/time.c in langref.tex and
stapprobes.3stap examples and systemtap.stress/current.stp test instead.
Chris Meek [Fri, 24 Feb 2012 19:17:29 +0000 (14:17 -0500)]
PR13609: Fixed interrupts and race conditions
- Interrupts are now handled properly. They
wait for any outstanding threads to finish
before exiting (unless a timeout occurs or
another interrupt happens)
- client_version is now local
- spawned_pids[] is now protected
William Cohen [Fri, 24 Feb 2012 13:32:37 +0000 (08:32 -0500)]
Do not probe ARM assembly language __switch_to function in current.stp test
The systemtap.stress/current.stp test did not work on ARM because the
test was trying to probe a function that is an assembly language function
on ARM. This patch avoids probing assembly language function.
David Smith [Wed, 22 Feb 2012 19:56:31 +0000 (13:56 -0600)]
Fix PR13646 (partial) by updating ipaddr testcase.
* testsuite/systemtap.base/ipaddr.exp: Change start_server() and
stop_server() procedure names to avoid clashing with procedures in
testsuite/lib/systemtap.exp.
David Smith [Tue, 21 Feb 2012 19:22:45 +0000 (13:22 -0600)]
Fix PR13646 (partial) by adding IPv6 support to 'tcp.receive'.
* tapset/tcp.stp: Added IPv6 support to tcp.receive by splitting it into
tcp.ipv4.receive and tcp.ipv6.receive (and making tcp.receive link to
both). Added a 'family' variable.
* testsuite/buildok/tcp-detailed.stp: Added compile testcase for
tcp.ipv4.receive and tcp.ipv6.receive.
* testsuite/systemtap.base/ipaddr.exp: Improved script output regexp.
* testsuite/systemtap.base/ipaddr2.stp: Works for IPv4 and IPv6.
David Smith [Tue, 21 Feb 2012 17:29:29 +0000 (11:29 -0600)]
Fix PR13646 (partial) by improving inline embedded-C expressions using AF_INET.
* tapset/inet_sock.stp: Add '/* pure */' to all inline embedded-C
expressions returning AF_INET/AF_INET6 so they can be optimized away.
* tapset/ip.stp: Ditto.
* tapset/nfs_proc.stp: Ditto.
* tapset/rpc.stp: Ditto.
* tapset/tcp.stp: Ditto.