David Smith [Fri, 18 Jul 2014 20:49:39 +0000 (15:49 -0500)]
Fixed PR17181 by making utrace handle interrupting processes better.
* runtime/stp_utrace.c (utrace_init): Use kallsyms_lookup_name() to lookup
"wake_up_state" if needed.
(stp_task_notify_resume): New function to handle the details of adding a
resume handler.
(utrace_cleanup): Only output debug printk's if STP_TF_DEBUG is defined.
(utrace_set_events): Improve check.
(utrace_do_stop): Call stp_task_notify_resume() instead of inline code.
(utrace_wakeup): Call stp_wake_up_state() instead of wake_up_process()
to avoid a WARN(). Call stp_task_notify_resume() instead of inline
code.
(utrace_control): Call stp_task_notify_resume() instead of inline code.
(finish_report): Ditto.
(finish_resume_report): Add UTRACE_INTERRUPT support.
(utrace_resume): Handle UTRACE_INTERRUPT.
* runtime/linux/task_finder2.c (stap_task_finder_post_init): Go back to
sending UTRACE_INTERRUPT to all tasks.
* buildrun.cxx (compile_pass): Add export tests for 'wake_up_state' and
'try_to_wake_up'.
* runtime/linux/runtime.h: Added 'kallsyms_wake_up_state' declaration when
necessary.
* testsuite/systemtap.base/process_resume.c: New file.
* testsuite/systemtap.base/process_resume.exp: New file.
Jonathan Lebon [Thu, 10 Jul 2014 21:08:23 +0000 (17:08 -0400)]
modules_out_of_tree.exp: adapt for RHEL5
We put the opening braces on the same line as the function declaration
so that the reported lineno in listing mode is the same on RHEL5 GCC
(which considered the opening brace as the decl_line).
We also skip the probing part by checking for module refresh support by
using the new module_refresh_p proc.
Jonathan Lebon [Wed, 9 Jul 2014 14:44:43 +0000 (10:44 -0400)]
PR17073: module probes: support out-of-tree modules
This patch adds support for out-of-tree modules by specifying the
fullpath. This did not work before because both the _stp_module struct
and the stap_dwarf_probe struct were using the full path as the module
name. This caused issues during relocation of module sections/kprobe
addresses.
In this patch, we use the already existing modname_from_path() function
to modify the module member of the dwarf_derived_probe (which later
affects the stap_dwarf_probe struct) and to emit the proper name in
dump_unwindsym_cxt() for the _stp_module struct.
Jonathan Lebon [Wed, 9 Jul 2014 16:01:36 +0000 (12:01 -0400)]
module probes: allow full path to in-tree modules
If the user provided a full path to an in-tree module, then we don't
want to modify the path in any way. The '-' to '_' will be done later on
as needed.
David Smith [Thu, 10 Jul 2014 14:23:12 +0000 (09:23 -0500)]
Update fix for PR17127 by correctly handling TASK_INTERRUPTIBLE flag.
* runtime/linux/task_finder2.c (stap_task_finder_post_init): The 'state'
field of the task structure contains a bitfield, not a singular
value. Properly test for TASK_INTERRUPTIBLE.
listing_mode.c: add in an infinite loop for generating probe points
to a process running this program over the course of the entire
listing_mode test.
listing_mode.exp: edited portions dependent on the line numbers in the
source code. added tests for the new process(PID).* probe points.
David Smith [Wed, 9 Jul 2014 15:47:24 +0000 (10:47 -0500)]
Clean up sdt_misc.exp a bit.
* testsuite/systemtap.base/sdt_misc.exp: Make log output match the
commands being run. Catch errors on "system" calls to avoid the test
aborting with a tcl error. Do an initial cleanup to avoid test
leftovers, which might have been created by another user.
brendang advised his system lacked /usr/bin/msgfmt, which blew up po/
builds. We now detect & reject this regrettable state of existence at
configure time.
Jonathan Lebon [Mon, 7 Jul 2014 18:59:56 +0000 (14:59 -0400)]
listing_mode.exp: use stap instead of nm to get addrs
We previously relied on nm to retrieve the addresses of functions in
the executable and library. This causes issues on ppc64, in which nm
simply returns the function descriptor rather than the actual text
address.
We now instead rely on stap itself to retrieve function addresses. This
should fix all of the FAILs of this testcase on the ppc64 platform.
After collapsing the process., process(STRING), process(NUM) cases
into a single conditional, we must remember to retest the STRING
case so as to extract the parameter.
elaborate*: new function derived_probe_builder::has_param()
tapset*: added a check to make sure the PID in process(PID).*
probes correspond to a running process.
stap samples: tweak process keyword & nd_syscall usage
* process/thread-business.stp: use 'name' from nd-syscall tapset
instead of clumsy computation by hand
* process/syscalls_by_*: use nd_syscall.* instead of syscall.*
David Smith [Thu, 26 Jun 2014 16:32:07 +0000 (11:32 -0500)]
PR16716 partial fix: Fix types in 'syscall.{fdatasync,fstat,fstatat,fsync}'.
* tapset/linux/aux_syscalls.stp (_at_flag_str): Update and improve.
* tapset/linux/syscalls.stp: Fix types in
syscall.{fdatasync,fstat,fsync}. Fixed types and 32-on-64 support in
syscall.fstatat and added 'dirfd_str', 'flags', and 'flags_str'
convenience variables.
* tapset/linux/nd_syscalls.stp: Fixed 32-on-64 bit support in
nd_syscall.fstatat and added 'dirfd_str', 'flags', and 'flags_str'
convenience variables.
* testsuite/buildok/syscalls-detailed.stp: Added compile test for new
syscall.fstatat convenience variables.
* testsuite/buildok/nd_syscalls-detailed.stp: Ditto.
* testsuite/systemtap.syscall/futimes.c: Updated test.
* testsuite/systemtap.syscall/link.c: Ditto.
* testsuite/systemtap.syscall/stat.c: Ditto.
* testsuite/systemtap.syscall/sync.c: Ditto.
Abegail Jakop [Tue, 24 Jun 2014 15:21:33 +0000 (11:21 -0400)]
stmt_counting.exp: nested foreach runtime flag
stmt_counting.exp: combine the four cases for each test
(no flags, -u, low MAXACTION, high MAXACTION) by using
nested foreach loop for the different runtime flags.
Abegail Jakop [Tue, 24 Jun 2014 13:29:46 +0000 (09:29 -0400)]
stmt_counting*: statement counting tests
stmt_counting_*.stp: basic tests containing loops, recursion,
straight through function bodies and straight through probe bodies.
stmt_counting.exp: runs the tests with and without -u, and with a
low and a high MAXACTION.
Mark Wielaard [Sun, 22 Jun 2014 19:23:21 +0000 (21:23 +0200)]
Handle DW_TAG_restrict_type.
C99 keyword restrict is just like const or volatile for pointers. Like
DW_TAG_const_type and DW_TAG_volatile_type just follow through to the
underlying type.
Josh Stone [Fri, 20 Jun 2014 16:45:46 +0000 (09:45 -0700)]
runtime: Add a universal stp_synchronize_sched
The kernel has had synchronize_sched for a while. However, in the RHEL5
era this was merely a #define to synchronize_rcu, which our exportconf
wouldn't detect. RHEL4 only had synchronize_kernel.
Now stp_synchronize_sched covers all of these options, otherwise issuing
an #error message.
Abegail Jakop [Thu, 19 Jun 2014 20:32:14 +0000 (16:32 -0400)]
::functioncall_visitor tracks seen and nested call
this change is for functioncall_traversing_visitor
elaborate.cxx: changed instances of *traversed* to *seen*
staptree.cxx: changed ::functioncall_visitor in
functioncall_traversing_visitor to keep track of nested function calls
and kept the old functionality of keeping track of function calls seen.
staptree.h: remove traversed set from functioncall_traversing_visitor,
replacing it with a seen set, and a nested set.
translate.cxx: edited comment to reflect change in visitor
David Smith [Thu, 19 Jun 2014 17:33:52 +0000 (12:33 -0500)]
Minor testsuite updates.
* testsuite/lib/compile_flags.exp: Added a bit more aarch64 support.
* testsuite/systemtap.base/bz1027459.exp: Only run on make
installcheck. Clean up better after a 'spawn'.
* testsuite/systemtap.base/task_dentry_path.exp: Only run on make
installcheck.
* testsuite/systemtap.base/wordexp.exp: Ditto.
* testsuite/systemtap.server/server_locale.exp: Ditto.
Abegail Jakop [Wed, 18 Jun 2014 14:15:05 +0000 (10:15 -0400)]
translate.cxx: statement counting for functions
translate.cxx: added counting statements to be executed, and a check
against that number with MAXACTION to determine if statement counting
within a function's generated c code gets suppressed. allow users to
turn this off by running script in unoptimized mode.
Abegail Jakop [Tue, 17 Jun 2014 20:16:28 +0000 (16:16 -0400)]
translate.cxx: unoptimized statement counting
translate.cxx: allow for users to turn off the optimized statement
counting, reverting to the statement counting being in generated
c code, through unoptimize mode.
Abegail Jakop [Tue, 17 Jun 2014 14:41:59 +0000 (10:41 -0400)]
translate.cxx: suppress action counting in c code
translate.cxx: moved the statement counting portion to ::emit_probe().
added in a check against MAXACTION, which determines if statement
counting within the generated c code gets suppressed.
Abegail Jakop [Fri, 13 Jun 2014 18:35:07 +0000 (14:35 -0400)]
translate.cxx: fix counting in max_action_info
translate.cxx: removed the creation of temporary visitors to visit
the thenblock and elseblock in visit_if_statement in max_action_info
because of errors with recursive calls. now uses only one visitor
to visit blocks.
Josh Stone [Fri, 13 Jun 2014 23:12:34 +0000 (16:12 -0700)]
runtime: Make sure to free special message buffers too
These special buffers were formerly kept aside, and never released back
to the memory pool, so they weren't freed either. DEBUG_MEM did report
this leak properly. Now these are freed too, and a new debug_mem.exp
test ensures that a simple script doesn't leak any memory.
Josh Stone [Fri, 13 Jun 2014 21:47:54 +0000 (14:47 -0700)]
PR17052: Use RCU-sched for freeing contexts
A context is grabbed from the _stp_ctl_work_callback timer, but it
doesn't actually need it for anything other than preventing a lock
recursion. Since this timer is still running while we are freeing the
contexts, there's a chance to race on the existence of contexts.
Using rcu_assign_pointer, rcu_dereference_sched, and synchronize_sched,
we can make sure that anyone who might have seen the existing contexts
has finished before we free them.
Jonathan Lebon [Fri, 13 Jun 2014 17:24:36 +0000 (13:24 -0400)]
initscript: check script names
Because script names are the basis for some variable names (e.g.
script_name_REQ), they need to adhere to bash variable naming rules.
These are almost the same rules that we enforce for stap -m, so we just
fail 'earlier'. See also RHBZ1109084.
This patch ensures that scripts with invalid names are skipped and
logged.
Jonathan Lebon [Fri, 13 Jun 2014 14:45:03 +0000 (10:45 -0400)]
initscript: use SYSTEMCTL_SKIP_REDIRECT
The SYSTEMCTL_SKIP_REDIRECT variable allows us to avoid being 'handled'
by systemd when users use the legacy 'service' command. This is
necessary in our case because systemctl omits the parameters passed to
the 'service' command for standard service actions such as start/stop.
Josh Stone [Thu, 12 Jun 2014 19:32:38 +0000 (12:32 -0700)]
Let @cast reuse modules even without a cache
It's sometimes necessary for autocast that separate @cast expressions
resolve to the same type, but that requires them to use the same underlying
module. When the cache was disabled, we were compiling a new module for
every @cast encountered.
Now the @cast visitor remembers what modules it has used for a given header
in this session, which will both help performance and make autocast type
comparisons work directly.
Josh Stone [Thu, 12 Jun 2014 19:28:51 +0000 (12:28 -0700)]
testsuite: Don't use linux/un.h for autocast
RHEL6 linux/un.h can't be compiled by itself, lacking a typedef for
sa_family_t. I just wanted something similar to sys/un.h, but distinct.
A @cast on "<sys/socket.h><sys/un.h>" is different enough that we make a
separate typequery module for it, so that will serve here.
This commit was initially required because execve would not pass on
RHEL6, which relied on kernel_string() rather than user_string_quoted().
With the new kernel_string_quoted() function, this test should pass on
all platforms.
Jonathan Lebon [Thu, 12 Jun 2014 17:34:06 +0000 (13:34 -0400)]
conversions.stp: new kernel_string_quoted() function
Just like user_string_quoted(), the new kernel_string_quoted() function
returns the resulting string in quotes if it successfully retrieved the
string and the pointer address otherwise.
Abegail Jakop [Thu, 12 Jun 2014 14:13:18 +0000 (10:13 -0400)]
count max statements in probes in translate.cxx
translate.cxx: counts the maximum number of statements expected
to be executed for each probe, in pass 3. results are printed when
verbosity is > 1. probes with for/foreach statements have a
reported statement count of ~0.
Josh Stone [Thu, 12 Jun 2014 00:40:04 +0000 (17:40 -0700)]
Fix void* handling in tracepoints and autocast
Tracepoint void* args used to be represented as isptr=false, but in
commit 37efef735273 I changed that to isptr=true with a null type die.
This seems clearer to me, but it broke a few parts that weren't ready
for a null die, ending up SEGV in libdw.