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.
Mark Wielaard [Tue, 21 Feb 2012 14:08:58 +0000 (15:08 +0100)]
PR13714 - Make sure REG_STATE.cfa_is_expr is always set correctly.
runtime/unwind.c (processCFI): Always set REG_STATE.cfa_is_expr and
add new sanity checks to make sure the cfa definition rules are sane.
Since the cfa expr pointer and cfa register/offset rule shared a union
not setting REG_STATE.cfa_is_expr could result in compute_expr ()
wrongly being called and using the register/offset as expr pointer.
David Smith [Mon, 20 Feb 2012 22:48:38 +0000 (16:48 -0600)]
Fix PR13646 (partial) by adding a testcase and some fixes.
* tapset/ip.stp (format_ipaddr): Marked as 'pure' so that it can be
optimized away. Fixed handling of IPv6 addresses.
(__ip_sock_saddr): Added support for IPv6 sockets.
(__ip_sock_daddr): Ditto.
* tapset/tcp.stp: Added 'family' variable to tcp.recvmsg and
tcp.recvmsg.return probes.
* tapset/nfs_proc.stp (AF_INET): Marked as 'pure' so that it can be
optimized away.
(AF_INET6): New function.
* testsuite/buildok/nfs_proc-embedded.stp: Added AF_INET6() compile test.
* testsuite/buildok/tcp-detailed.stp: Prints 'family' variable in
tcp.recvmsg and tcp.recvmsg.return probes.
* testsuite/systemtap.base/ipaddr.exp: New testcase.
* testsuite/systemtap.base/ipaddr.txt: Ditto.
* testsuite/systemtap.base/ipaddr1.stp: Ditto.
* testsuite/systemtap.base/ipaddr2.stp: Ditto.
David Smith [Wed, 15 Feb 2012 22:04:47 +0000 (16:04 -0600)]
Fix PR13646 (partial) by properly converting IPv6 addresses to strings.
* tapset/ip.stp: Added the format_ipaddr() function to handle converting
an IP address to a string. The ip_ntop() function now just calls
format_ipaddr(). Added the __ip_sock_family() function to return the IP
address family for a 'struct inet_sock'.
* tapset/inet_sock.stp: The inet_get_ip_source() function uses
format_ipaddr() to format an IP address as a string. The
daddr_to_string() function has been deprecated.
* tapset/rpc.stp: Make addr_from_rqst_str() handle IPv6 addresses.
* tapset/tcp.stp: Use format_ipaddr() instead of ip_ntop() to convert IP
adresses to strings.
* runtime/loc2c-runtime.h (kderef_buffer): New function.
* testsuite/buildok/inet_sock-embedded.stp: Deprecated daddr_to_string()
function test.
* testsuite/buildok/ip-embedded.stp: Added format_ipaddr() and
__ip_sock_family() tests.
* NEWS: Mention daddr_to_string() deprecation.
* stap.1: Ditto.
David Smith [Wed, 15 Feb 2012 15:20:57 +0000 (09:20 -0600)]
Update 3 semok tests for RHEL4.
* testsuite/semok/entry01.stp: Added 'kernel.function("filp_open")' probe
point for RHEL4 (which doesn't have 'kernel.function("do_filp_open")'.
* testsuite/semok/entry03.stp: Ditto.
* testsuite/semok/kretprobe-data.stp: Added
'kernel.function("path_lookup")' probe point for RHEL4 (which doesn't
have 'kernel.function("do_path_lookup")'.
William Cohen [Tue, 14 Feb 2012 16:02:51 +0000 (11:02 -0500)]
Make sure that procfs.c runtime code include <linux/mount.h>
On the arm architecture the <linux/mount.h> isn't pulled in by other
code. This one line change makes sure that the include file gets
pulled in. This allows the test using the procfs to build on arm.
David Smith [Fri, 10 Feb 2012 21:45:20 +0000 (15:45 -0600)]
(Fixed PR13681) Bulk mode scripts no longer leave the module behind on rhel4.
* runtime/staprun/relay_old.c (close_relayfs_files): 0 can be a valid
relay_fd[cpu] value.
(open_relayfs_files): On error, initialize relay_fd[cpu] to -1, not 0.
(init_oldrelayfs): Initialize relay_fd[cpu] to -1, not 0.