David Smith [Tue, 24 Mar 2009 19:43:08 +0000 (14:43 -0500)]
PR 9989 fix.
2009-03-24 David Smith <dsmith@redhat.com>
PR 9989.
* runtime/task_finder.c (stap_utrace_detach): Ignores
-EINPROGRESS.
(stap_utrace_detach_ops): Ignores errors from
stap_utrace_detach(), so that other tasks will get detached from
this utrace engine.
(__stp_utrace_attach): Better error handling from
utrace_barrier().
(__stp_utrace_task_finder_target_quiesce): Ditto.
Frank Ch. Eigler [Tue, 24 Mar 2009 16:53:17 +0000 (12:53 -0400)]
PR9993: tracepoint toleration for undeclared types in trace/*.h headers
* tapsets.cxx (tracepoint_extra_headers): New function to return
needed header file names.
(emit_module_decls): Emit them.
* buildrun.cxx (make_tracequery): Emit them.
* testsuite/systemtap.base/tracepoints.exp: Rewrite to exercise
building each tracepoint.
Stan Cox [Tue, 24 Mar 2009 16:40:05 +0000 (12:40 -0400)]
Keep static probe parameters visible while inlining.
* includes/sys/sdt.h (STAP_PROBEN): Revive the STAP_LABEL macro to
prevent inlining to keep probe parameters visible. Use +rm
constraints.
* tapsets.cxx (build): Use .probes section for all uses of static
probes.
Stan Cox [Mon, 23 Mar 2009 14:10:03 +0000 (10:10 -0400)]
Make .probes 32 bit aware and simplify label handling.
* includes/sys/sdt.h (STAP_PROBE_DATA_): Use gas local labels which
avoids a mysql problem when a function containing a probe is inlined.
Make the data placement 32 bit aware.
Frank Ch. Eigler [Sat, 21 Mar 2009 12:39:57 +0000 (08:39 -0400)]
sdt.exp: save intermediate sdt.h-client executables for analysis
* testsuite/lib/stap_run2.exp (stap_run3): Put supplied stap
extra arguments after the .stp script name, not before, so
that @1/such arguments can be substituted within.
Josh Stone [Fri, 20 Mar 2009 23:35:06 +0000 (16:35 -0700)]
Cache the tracepoint query results
To use tracepoints, we build a "tracequery" module that compiles
debuginfo for all available tracepoints in the user's kernel. That's a
bit of a cumbersome step to do during pass-2 though. This change adds
tracequery caching so we only need to compile it once.
Stan Cox [Fri, 20 Mar 2009 20:30:19 +0000 (16:30 -0400)]
Define static user probe point using asm instead of c.
* includes/sys/sdt.h (STAP_PROBE_DATA): New. Define the probe point
using asm instead of c.
(STAP_PROBEN): Use it.
* testsuite/systemtap.base/sdt.exp: Continue if a compile fails.
* testsuite/systemtap.base/static_uprobes.exp: Don't test setting
probe without .probes section.
Frank Ch. Eigler [Fri, 20 Mar 2009 20:30:02 +0000 (16:30 -0400)]
PR9967: don't count -DINTERRUPTIBLE=1 reentrancy against MAXSKIPPED
* tapsets.cxx (common_probe_entryfn_prologue): Become conditional on
!INTERRUPTIBLE.
* translate.cxx (emit_module_exit): Still print skipped_count_reentrant
with -t, even if skipped_count was zero.
Add on-file flight recorder options (the combination of -F and -o,
and -S option) to stap command, and change manpages and NEWS.
- Both of -F and -o is specified, stap passes -D option to staprun.
- stap just passes -S option to staprun.
Masami Hiramatsu [Fri, 20 Mar 2009 16:11:30 +0000 (12:11 -0400)]
PR6930: stapio: support file switching
Add file-switching option(-S size[,N]) to stapio. This option has two
arguments, 'size' and 'N', and requires -o option.
- When the size of output file exceeds specified 'size'MB, staprun switches
output file to the next file. For this purpose, all output file has a serial
number as a suffix only when user specifies this option.
- Using this option in bulk mode, the output file name will be
'FILE_cpuX.SERIAL'.
- When the number of files exceeds specified N, staprun removes the oldest
file. This argument can be omitted.
Masami Hiramatsu [Fri, 20 Mar 2009 15:59:06 +0000 (11:59 -0400)]
PR6930: stapio: run in background as a daemon
Add '-D'(daemon mode) option to staprun/stapio for daemon mode.
In this mode, stapio shows just its pid and detachs from console.
Since it has no stdio, this mode requires -o option. stapio will
exit when it receives SIGTERM or detects some error.
Josh Stone [Thu, 19 Mar 2009 23:23:02 +0000 (16:23 -0700)]
PR9960: support tracepoint struct/union value arg
If a tracepoint arg is a structure or union that is passed by value,
then this takes the address of the parameter so it can be used like a
pointer in the rest of our code.
Josh Stone [Thu, 19 Mar 2009 03:05:56 +0000 (20:05 -0700)]
PR9959: hide tracepoint arguments of unknown type
We always have to know the type name of tracepoint arguments, so we can
declare the right function callback, but we can suppress access to those
types which we don't (yet) know how to read.
Josh Stone [Thu, 19 Mar 2009 02:04:54 +0000 (19:04 -0700)]
PR9959: improve tracepoint arg type-naming
dwarf_type_name now works with more argument types. There were
three cases that I needed to improve:
- For "const struct foo*", the debuginfo has a const-DIE named "foo"
chained to a struct-DIE named "foo", so we can't assume that seeing a
name means we're down to the base type. The recursion now decends
until it explicitly sees a base_type, typedef, struct, or union.
- For "void*", the debuginfo has a pointer-DIE without any DW_AT_type
after. Now I'm just catching that failed lookup and writing in
"void".
- For "va_list", the debuginfo actually resolves to an internal type
"struct __va_list_tag*", but that struct has no declaration at the
source level. I'm just hacking that exact case to say "va_list"
instead, but it would be nice to find something cleaner...
We'll probably still have problems if any tracepoint uses a function-
pointer argument, but so far I've only seen that as a "void*", which we
now handle ok.
Josh Stone [Thu, 19 Mar 2009 01:51:17 +0000 (18:51 -0700)]
Support tracepoints with no arguments
LTTng has a few tracepoints without any arguments, which caused our
compile to fail, claiming that our entry function was not a declaration.
This just adds an explicit (void) argument list for that case.
Mark Wielaard [Wed, 18 Mar 2009 10:42:53 +0000 (11:42 +0100)]
Don't mutex_unlock in __stp_tf_get_vma_map_entry_internal.
All callers of __stp_tf_get_vma_map_entry_internal lock and unlock
the mutex correctly themselves in all cases. This unlock would trigger
a double unlock.
Josh Stone [Tue, 17 Mar 2009 01:36:44 +0000 (18:36 -0700)]
PR9951: Prevent GCC warnings in deref()
In some configurations, GCC was warning about a possible use of _v in
the deref macros. I could not reproduce the error, but the only case
where _v is not written is if lookup_bad_addr rejects the address, in
which case we will hit DEREF_FAULT and _v won't be used.
Now we're priming _v=0 anyway, so GCC has no right to complain...
Josh Stone [Tue, 17 Mar 2009 01:13:07 +0000 (18:13 -0700)]
Fix regression in tracepoint unregistration
Commit 96b030fe reorganized the tracepoint registration calls by
creating generic wrappers that return int. However, the older
tracepoint implementation (as found in RHEL5.3) returned void for unreg,
so this was failing pass-4.
Since we can't handle unregistration failures anyway, this change just
makes the generic unregister function return void instead. As noted in
the newly-added comment, it should be safe for us to ignore unreg
failures.
Mark Wielaard [Sun, 15 Mar 2009 14:29:01 +0000 (15:29 +0100)]
Move vma module tracking from pr6866 branch to master.
* tapsets.cxx (utrace_derived_probe_group::emit_module_decls):
Always emit vm callback probe for __stp_tf_vm_cb.
* runtime/task_finder.c (__stp_tf_vm_cb): Always expose, move _stp_dbug
statements under ifdef DEBUG_TASK_FINDER_VMA. Find and record
corresponding module when vm_path not NULL.
* runtime/task_finder_vma.c (struct __stp_tf_vma_entry): Add _stp_module.
(stap_add_vma_map_info): Add _stp_module argument and assign.
(__stp_tf_get_vma_entry_addr): New static function to get
the __stp_tf_vma_entry given an address.
Josh Stone [Fri, 13 Mar 2009 23:22:04 +0000 (16:22 -0700)]
Move lookup_bad_addr call in STAPCONF_PROBE_KERNEL
With most of the implementations, kread/kwrite call deref/store_deref,
and so it makes sense to have lookup_bad_addr in the latter as an
underlying address check.
However, in the STAPCONF_PROBE_KERNEL case that uses probe_kernel_read
and probe_kernel_write, the roles are reversed, so lookup_bad_addr needs
to be in kread/kwrite.
Also note that __deref_bad and __store_deref_bad should only be used in
cases that can be determined at compile time. These turn into invalid
symbols which prevent the module from loading. (They might be better
replaced with compile-time assertions.)