Serguei Makarov [Wed, 19 Dec 2012 21:18:23 +0000 (16:18 -0500)]
PR14883: let stuff that demands task_finder, incl. probefunc(), fail gracefully when such is not available
Now, instead of failing pass-4, code demanding task_finder process tracking
functionality on systems where the facility is unavailable will run with
a warning, then silently ignore any task_finder callbacks that the script
attempts to register.
* runtime/vma.c (_stp_vma_init()): return silently without doing anything if HAVE_TASK_FINDER is not set.
* runtime/linux/task_finder3.c: new file.
* runtime/linux/runtime.h: include task_finder3.c if actual task_finder not available.
Lukas Berk [Tue, 18 Dec 2012 21:24:09 +0000 (16:24 -0500)]
PR14714: Introduce --suppress-time-limits flag
This flag enables somewhat heavier weight scripts to be run, disabling
-DSTP_NO_OVERLOAD, -DMAXACTION, and -DMAXTRYLOCK mechanisms. The flag
itself also requires guru mode to be specified.
* cmdline.cxx - add the new long option
* cmdline.h - add the corresponding long option to enum
* hash.cxx - add the option to be hashed
* man/stap.1 - updated man page reflecting new option
* runtime/common_probe_context.h - remove actionremaining declaration if
flag is specified and the variable is no longer needed
* runtime/dyninst/probe_lock.h - remove the check against MAXTRYLOCK if
the flag is specified
* runtime/linux/probe_lock.h - remove the check against MAXTRYLOCK if
the flag is specified
* runtime/runtime_defines.h - remove the declarations of MAXTRYLOCK and
MAXACTION if the flag is specified
* session.cxx - add flag bool for stap proper, stap help message, and
command line option check
* session.h - declare the flag boolean
* tapset-timers.cxx - add conditionals for the module 'actionremaning'
variable if the flag is specified
* tapsets.cxx - add conditionals for the module 'actionremaning'
variable if the flag is specified
* testsuite/systemtap.base/suppress-time-limit.exp - new testcase
* testsuite/systemtap.base/suppress-time-limit.stp - testcase script
* translate.cxx - add conditional based on stap proper boolean to
record_actions function
Josh Stone [Mon, 17 Dec 2012 23:44:33 +0000 (15:44 -0800)]
runtime: Updated support for uretprobes test kernels
This updates support for uretprobes kernels from here:
http://repos.fedorapeople.org/repos/aarapov/kernel-uprobes/
... particularly kernel-3.7.0-99.uretprobes.fc18 built 13-Dec-2012.
The struct uretprobe_consumer is gone, and now both uprobes and
uretprobes use the same struct uprobe_consumer. The signature of the
handler function has changed to include a long addr for the uretprobes'
true return address. In the future that parameter will also be set for
plain uprobes to the equivalent of uprobe_get_swbp_addr().
I'm knowingly breaking compatibility with earlier uretprobes test
kernels. As far as I know, those have never been officially shipped
anywhere, so that should be fine. This does maintain compatibility with
the version of plain uprobes before the change in the handler signature.
* runtime/linux/uprobes-inode.c (struct stapiu_consumer): Collapse the
uconsumer and uretconsumer back to a single entry.
(stapiu_probe_prehandler): Fill in the given IP temporarily, then call
the true handler from the translator.
(stapiu_probe_prehandler_noaddr): Compatibility handler to grab the IP
from uprobe_get_swbp_addr().
* runtime/linux/autoconf-inode-uprobes-noaddr.c: New autoconf to detect
the former version of uprobes handler, without the addr parameter.
* buildrun.cxx (compile_pass): Use that autoconf.
* tapsets.cxx (uprobe_derived_probe_group::emit_module_inode_decls):
Yield the IP-munging duties to uprobes-inode.c.
Josh Stone [Sat, 15 Dec 2012 02:00:32 +0000 (18:00 -0800)]
stapdyn: Use shared memory for globals
All globals are now in shared memory, no matter what type.
* runtime/dyninst/common_session_state.h: Add globals to the session
struct, and change the timing stats to offptr_t. Create global()
macros to abstract the access to various globals.
* runtime/linux/common_session_state.h: Create the simpler kernel
equivalents of the global() macros.
* runtime/dyninst/map_runtime.h: Use shm for allocating map and pmap.
* runtime/dyninst/stat_runtime.h: Use shm for allocating stats.
* runtime/dyninst/runtime.h (stp_pthread_rwlock_init_shared): New,
for initializing global locks with PTHREAD_PROCESS_SHARED set.
* translate.cxx: Use global() macros everywhere that did "global.foo".
(c_unparser::emit_global): Emit stapdyn globals with a union foo_typed
so that the global() macros can type-check it a little.
(translate_pass): Globals are only statically-initialized in kernel
mode, where they might be overridden early by module params.
(c_unparser::emit_module_init): For stapdyn mode, initialize global
values during the rest of the module initialization.
* testsuite/buildok/globals.stp: Simple test building all global types.
Josh Stone [Thu, 13 Dec 2012 21:31:53 +0000 (13:31 -0800)]
PR14957: Don't force __GFP_ZERO into kmalloc_node
It turns out that rhel5-era kernels have a BUG check in slab cache_grow
that doesn't permit __GFP_ZERO from this path. Later kernels corrected
this, as the implementation of kzalloc_node is just kmalloc_node with
__GFP_ZERO added, but for compatibility we can't rely on that.
* runtime/linux/alloc.c (_stp_kzalloc_node_gfp): Use a plain
_stp_kmalloc_node_gfp, then memset-0 manually.
Josh Stone [Wed, 12 Dec 2012 23:34:39 +0000 (15:34 -0800)]
stapdyn: Move contexts into shm
David already abstracted different allocation schemes for runtime
contexts, so this time the kernel runtime needs no change. The dyninst
runtime now has the per-cpu contexts included in shared memory.
* translate.cxx (c_unparser::emit_common_header): Move runtime_context.h
and common_session_state.h right after the struct context definition.
* runtime/dyninst/common_session_state.h: Add struct context[] to shm.
(stp_session_context): New function to access a specific context.
* runtime/dyninst/runtime_context.h (_stp_runtime_contexts_alloc/free):
Don't manage memory anymore, just initialize the locks and be done.
Use stp_session_context throughout to retrieve contexts.
* runtime/dyninst/runtime.h (stp_pthread_mutex_init_shared): New, set
the PTHREAD_PROCESS_SHARED attribute while initializing a mutex.
* runtime/dyninst/shm.c (_stp_shm_finalize): dbug the final mmap addr.
Josh Stone [Wed, 12 Dec 2012 22:02:00 +0000 (14:02 -0800)]
stapdyn: Move alibi and timing stats to shm
In dyninst mode, the alibi and timing parts are now part of the main
session struct that lives in shared memory. In kernel mode the same
parts are their own global arrays, but otherwise unchanged.
Also, the global stap_probes[] that used to hold these has no more
mutable members, so it is now const.
* runtime/dyninst/common_session_state.h: Add alibi and timing data to
the session, and define functions to access them.
* runtime/linux/common_session_state.h: Move alibi and timing data to
global arrays, and define the same access functions.
* tapsets.cxx (common_probe_entryfn_prologue): Use probe_alias() and
probe_timing() to get the relevant data in runtime-neutral ways.
* translate.cxx (c_unparser::emit_module_exit): Ditto.
(translate_pass): Define STP_PROBE_COUNT for sizing related arrays.
Update the stap_probes[] initialization with a fixed index to access
the relocated alias/timing data, and make the whole thing const.
* [everything else]: Always use const struct stap_probe pointers.
Josh Stone [Tue, 11 Dec 2012 23:09:54 +0000 (15:09 -0800)]
stapdyn: Move global session counters into shm
In dyninst mode, the atomic_t session_state, error_count, and various
skipped_counts are now lumped into a common structure which is allocated
first thing in shared memory. Kernel mode is effectively unchanged.
* runtime/common_session_state.h: Split into runtime specifics.
* runtime/dyninst/common_session_state.h: Define a session struct,
access functions, and an initialization function using shm.
* runtime/linux/common_session_state.h: Leave the former atomics as
globals, but provide the same function abstractions as in /dyninst/.
* translate.cxx (c_unparser::emit_module_init): Call stp_session_init.
* [everything else]: Update how those global variables are accessed,
essentially just s/&foo/foo()/g.
Josh Stone [Tue, 11 Dec 2012 19:49:58 +0000 (11:49 -0800)]
stapdyn: Guard against unfound return probes
Sometimes dyninst will identify an instrumentation point, but be unable
to find its corresponding return. The reason for this is not yet known,
but we should be defensive against NULL from findPoint(BPatch_locExit).
* stapdyn/mutatee.cxx (mutatee::instrument_dynprobe_target): Check the
return value of findPoint(BPatch_locExit), and warn if not found.
Josh Stone [Tue, 11 Dec 2012 19:48:07 +0000 (11:48 -0800)]
tapset: Add ppfunc() to parse the function name from pp()
This performs similarly to the pre-2.0 probefunc(), but without the
fallback to addr->symbol lookups. That is, if pp() doesn't have a
function name, then an empty string is returned without further ado.
Josh Stone [Tue, 11 Dec 2012 01:11:45 +0000 (17:11 -0800)]
runtime: offptr_t: Fix NULL, and add a global implementation
NULL can't be treated as a relative pointer, because it's always
absolute. Good thing we weren't using offptr_t in relocatable memory
yet. Now this is treated as the special case it must be.
I've also added another offptr_t implementation, based on a fixing
offsets from the global shared-memory base. This means it's only good
for pointers within that memory, but math should be simpler.
Josh Stone [Tue, 11 Dec 2012 00:26:11 +0000 (16:26 -0800)]
stapdyn: Add a shared-memory allocator
* runtime/dyninst/stapdyn.h (stp_dyninst_shm_init): Called to
initialize the shared memory and return its name for mutatees.
(stp_dyninst_shm_connect): Called connect a mutatee to shm.
* runtime/dyninst/runtime.h (stp_dyninst_session_init): Make sure that
stp_dyninst_shm_init is called, in case of old stapdyn.
* runtime/dyninst/shm.c: All new functions to create, map, and allocate
from shared memory. Allocation must only be done from the main
process before anyone else connects, so we don't have to worry about
signalling other processes about the growth.
Josh Stone [Sat, 8 Dec 2012 01:06:40 +0000 (17:06 -0800)]
runtime: Use single allocation for stapdyn maps again
The kernel maps are left as-is, but I remembered a good reason why I
wanted large allocations for stapdyn. As explained in _stp_pmap_new:
The reason for this is that we're allocating in the shared memory
mmap, which may have to move locations in order to grow. If some
smaller unit of the pmap allocation were to cause the whole thing to
move, then we'd lose track of the prior allocations.
Once returned from here, we'll always access the pmap via the global
shared memory base. So if other map/pmap/stat/etc. allocations
cause it to move later, that's ok.
We're not *actually* using a shared memory mmap quite yet, but we're
almost there, I promise...
Serguei Makarov [Fri, 7 Dec 2012 18:00:47 +0000 (13:00 -0500)]
PR14929: groundwork for letting stap refer the user to man staperrors.
To tag an error with a specific manpage, replace
semantic_error (...)
--> semantic_error_manpage ("name_of_manpage", ...)
or
parse_error (...)
--> parse_error_manpage ("name_of_manpage", ...)
Then both errors will output messages instructing the user to refer
to man 3stap error::name_of_manpage.
Josh Stone [Fri, 7 Dec 2012 02:29:32 +0000 (18:29 -0800)]
runtime: remove the map_node data_offset
The value in the map_node is now an honest member of the struct. Here
are your papers, congratulations, now get to work!
* runtime/map-gen.c (KEYSYM(map_node)): Add the value.
(MAP_COPY_VAL): New macro to assist in pmap aggregation.
* runtime/pmap-gen.c (KEYSYM(pmap_update_node)): New callback for
aggregation node updates, copying the keys and values as needed.
* runtime/map-stat.c (_stp_map_new_hstat, _stp_pmap_new_hstat): New
constructors to take responsibility for setting HIST_NONE.
(_stp_[p]map_new_hstat_{log,linear}): Only need to augment the size
with the histogram buckets now; the stat_data is already there.
* runtime/map.c (_stp_map_new, _stp_pmap_new): No longer need the value
type, not the separate key/data sizes; a simple node_size is enough.
Josh Stone [Thu, 6 Dec 2012 22:53:52 +0000 (14:53 -0800)]
runtime: remove the 'type' metadata from map_node
We always know what the type should be, so pass that info around.
* runtime/map-gen.c (map_get_key): This returns value "keys" now too,
for simpler use by _stp_map_sort[n] and _stp_cmp.
(MAP_GET_VAL): Use more direct access to the value.
(_stp_map_get_VALNAME): New, provide a single typed value getter.
* runtime/map.c (_stp_get_TYPE): Remove these type-generic getters.
(_stp_cmp): Let get_key sort out the type and where to get it.
(_stp_map_sort[n]): This needs no type knowledge now.
(_stp_new_agg, _stp_add_agg, _stp_pmap_agg, _new_map_clear_node): Pass
the type as a parameter from map-gen code that knows it statically.
* translate.cxx (itervar::get_value): Use _stp_map_get_VALNAME.
Josh Stone [Thu, 6 Dec 2012 19:21:47 +0000 (11:21 -0800)]
runtime: Remove dupes between map-gen and pmap-gen
Most of pmap-gen was a rehash of map-gen, just named pmap instead. Only
a few of the pmap functions were actually unique to that situation, so
the rest have been terminated with extreme prejudice.
This also addresses a FIXME note I added in commit 57eedf945 about the
way map-gen and pmap-gen are included. Made it in before the seventh
anniversary of that FIXME -- whew!
* translate.cxx (c_unparser::emit_map_type_instantiations): Set
MAP_DO_PMAP to trigger the pmap-gen from within map-gen.
* runtime/map-gen.c (KEY_EQ_P): New, consolidate testing of all keys.
(MAP_DO_PMAP): Use to include pmap-gen while the #defines are hot.
* runtime/pmap-gen.c: I love the smell of napalm in the morning...
William Cohen [Wed, 5 Dec 2012 22:43:28 +0000 (17:43 -0500)]
Avoid using probefunc() in the syscall tapsets
Some of the tapsets still used probefunc(). Unfortunately probefunc
may trigger the use of taskfinder support on machines that do not yet
support taskfinder. To work around issue kernel-space tapset probes
can use symname(addr()).
Josh Stone [Wed, 5 Dec 2012 21:31:56 +0000 (13:31 -0800)]
runtime: Break up map allocs again
I ran into trouble with a few tests inconsistently failing to allocate
their maps. I believe this is because the new allocation scheme I made
in commit db45dfde was just to big for fragmented memory. This commit
goes back to allocating each node separately, but keeps the rest of the
cleanups made before.
* runtime/map.c (_stp_map_new): Allocate the map_root on its own.
(_stp_map_init): Then allocate each map_node separately too.
(_stp_map_del): Delete the map_nodes too.
Josh Stone [Wed, 5 Dec 2012 01:27:44 +0000 (17:27 -0800)]
runtime: Remove the map_node pointer to its root
The only thing this helped anymore was getting the type and data_offset,
which we can embed directly instead. Those might actually be better in
the future as KEYSYM-specialized functions anyway. With this change,
all map stuctures are now pointer-free!
Josh Stone [Wed, 5 Dec 2012 00:27:51 +0000 (16:27 -0800)]
runtime: Remove function pointers from struct map_root
More work on the way to shared-memory stapdyn, this patch removes the
function pointers from struct map_root. The functions which used those
pointers now take them as parameters, and the translator calls through
[p]map-gen intermediaries to figure those out.
* runtime/map.h (struct map_root): Remove the function pointers, as well
as ancient unused fields "list" and "key". Declare typedefs for those
function pointers, and add them as parameters to needed functions.
* runtime/map-gen.c: No more initializing those function pointers, and
add new KEYSYM wrapper functions to pass those as parameters.
* runtime/pmap-gen.c: Ditto.
* runtime/map.c: Use the parameterized function pointers as needed.
* translate.cxx (mapvar::function_keysym): New generic name-generator
for KEYSYM-wrapped functions. Use it as-needed.
Josh Stone [Tue, 27 Nov 2012 21:44:26 +0000 (13:44 -0800)]
runtime: Allocate maps in fewer chunks
This makes map allocations as more unified chunks, basically just one
big allocation for each map_root. For pmaps, there's one base
allocation, then the separate map_roots for each cpu and the aggregate.
Fewer chunks means fewer pointers to keep track of, which contributes to
the pointer-free goals of shared-memory stapdyn.
* runtime/*/alloc.c: Add kzalloc_node variants.
* runtime/*/map_runtime.h (struct pmap): Abstract the map_roots with
plain pointers in kernel or offptr_t in stapdyn.
* runtime/map.h (struct map_root): Make "hashes" a fixed array.
* runtime/map.c (_stp_map_init): No more allocation, just initialize
fields and insert the nodes into the free pool.
(_stp_map_normalize_key_size, _stp_map_normalize_data_size): Setup the
key and data sizes in a uniform way.
(_stp_map_new): Allocate the map_nodes along with the map_root.
(_stp_pmap_new): Allocate the base pmap, then _stp_map_new the bits.
(_stp_map_del, _stp_pmap_del): Deletion is now simpler to match.
* runtime/map-gen.c: Update callers to new abstractions.
* runtime/map-stat.c: Ditto.
* runtime/pmap-gen.c: Ditto.
William Cohen [Mon, 3 Dec 2012 22:33:03 +0000 (17:33 -0500)]
Adjust output checks for arm stat.c syscall.exp test
The output check for the arm tests needs to be adjusted to match the
syscalls being used on the arm. Arm has output that looks like the
ia64 process and needs a similar conditional check.
William Cohen [Mon, 3 Dec 2012 22:16:08 +0000 (17:16 -0500)]
Correct the syscall test alarm.c to properly match for arm.
The output of syscalls is slightly different for arm machines. This caused
the alarm test to fail. The conditionals tests for arm allow this test to
properly pass on the arm.
Frank Ch. Eigler [Fri, 30 Nov 2012 03:24:32 +0000 (22:24 -0500)]
PR14804: tolerate !STAPCONF_KALLSYMS without an early _stp_error
A _stp_error call from that early in initialization leads to
badness.
* runtime/sym.c (kallsyms_lookup_name): In the !STAPCONF_KALLSYMS
case, return NULL quietly, not tickling the error dragons.
* runtime/mempool.c (_stp_mempool_alloc): As a belt & suspenders
kind of thing, if invoked so early that the incoming pool is not
even initialized yet (= NULL), return NULL instead of crashing.
Josh Stone [Wed, 28 Nov 2012 21:59:35 +0000 (13:59 -0800)]
Hold System.map failures until both attempts fail
On RHEL4, System.map only exists in /boot/, so the first attempt under
/lib/modules/ was always spamming about its failure. Now that error
message is delayed and printed iff /boot/ fails too.
David Smith [Tue, 27 Nov 2012 15:29:02 +0000 (09:29 -0600)]
Fixed PR12642 by interrupting the target task.
* runtime/stp_utrace.c (utrace_init): If 'signal_wake_up' and/or
'__lock_task_sighand' aren't exported, look up their addresses.
(utrace_control): Add UTRACE_INTERRUPT functionality, which involves
setting up a task_work handler, then sending the target a signal.
* runtime/linux/task_finder.c (__stp_utrace_attach_flags): Use the
caller's specified action instead of hardcoding UTRACE_STOP, to allow
UTRACE_INTERRUPT to go through.
(stap_task_finder_post_init): New function.
* runtime/linux/task_finder2.c: Ditto.
* runtime/stp_utrace.h: Added UTRACE_INTERRUPT.
* runtime/utrace_compatibility.h: Ditto.
* runtime/linux/runtime.h: Add kallsyms variables for 'signal_wake_up' and
'__lock_task_sighand'.
* translate.cxx (c_unparser::emit_module_init): Runs all
emit_module_post_init() functions.
* task_finder.cxx (task_finder_derived_probe_group::emit_module_post_init):
Emit call to 'stap_task_finder_post_init()'.
* elaborate.h (struct derived_probe_group): Add virtual function
'emit_module_post_init' which gets called once session_state is set to
running.
* buildrun.cxx (compile_pass): Added 'exportconf' tests for
"signal_wake_up" and "__lock_task_sighand".
* testsuite/systemtap.clone/main_quiesce.exp: New test.
* testsuite/systemtap.clone/main_quiesce.c: New test C source.
Josh Stone [Wed, 7 Nov 2012 21:57:56 +0000 (13:57 -0800)]
stapdyn: Define offset pointers and list implementations
Offset pointers are an abstraction of pointers into relative offsets,
here chosen as relative to the offptr_t object itself. This allows
objects to reference each other within a memory block that may not be at
a fixed virtual address, such as with shared memory or reallocs.
The olist and ohlist types are based on the Linux list and hlist types,
but purely using offset pointers.
William Cohen [Tue, 20 Nov 2012 19:26:33 +0000 (14:26 -0500)]
Add a "-O" to the "-D_FORTIFY_SOURCE=2" setjump.exp test
When building code with -D_FORTIFIY_SOURCE=2 need to turn on
optimizations. Without the "-O" the compile of code triggers warning
that will cause the build to fail and some parts of the portion of the
test is untested.
Mark Wielaard [Mon, 19 Nov 2012 20:43:40 +0000 (21:43 +0100)]
Run probefunc inline testcase with --compatible=1.8.
In the new implementation we will observe the name of the function where
this gets inlined, not the inlined function name itself. With the old
implementation of probefunc() it would get the name from the actual
probe string. Test the old behavior explicitly.
Josh Stone [Thu, 8 Nov 2012 01:07:15 +0000 (17:07 -0800)]
stapdyn: loadLibrary now returns BPatch_object
BPatch_addressSpace::loadLibrary changed its return value before Dyninst
8.0 final. We wanted the BPatch_object anyway, so now we don't have to
get it indirectly through BPatch_module::getObject.
Also, bump the rpm spec to require the actual Dyninst 8.0.
David Smith [Mon, 19 Nov 2012 20:08:43 +0000 (14:08 -0600)]
Fix _stp_get_arg32_by_number() for RHEL5.
* runtime/regs.c (_stp_get_arg32_by_number): Handle i386/x86_64
differences better for systems without x86 register unification, like
RHEL5.
Please enter the commit message for your changes. Lines starting
Mark Wielaard [Sat, 17 Nov 2012 21:34:04 +0000 (22:34 +0100)]
PR10272 Warn if we will be unable to generate user backtrace for 32-on-64.
Deduce the kernel ELF class from the kernel normalized machine architecture
and warn if it is different from the module ELF class (except for 32-bit
vdso). Don't generate unwind tables for "wrong class" modules.
Josh Stone [Wed, 7 Nov 2012 19:41:16 +0000 (11:41 -0800)]
stapdyn: Workaround for an i686 Dyninst bug in argument passing
Dyninst appears to be filling only 32-bits for the index to
enter_dyninst_uprobe_regs, which makes the following arguments shift
badly too. This is reported upstream, but we can detect and work around
it ourselves too.
Josh Stone [Tue, 6 Nov 2012 22:07:36 +0000 (14:07 -0800)]
stapdyn: Add tapset function print_regs
The underlying _stp_print_regs is more limited than the kernel version,
as some registers are not available, but this is still useful to see all
the information available to the probe.
Note: this makes it obvious that i686 actually doesn't have register
values right now. Dyninst has documented that only POWER and AMD64
implement getRegisters, unfortunately. This might be expanded by them
in a future release.
* runtime/regs.c: Split into linux/ and dyninst/ versions.
* tapset/context.stp (print_regs): Moved from linux/; now it's generic.
* stapdyn/mutatee.cxx (get_dwarf_registers): Add verbose logging, which
also shows that i686 doesn't have registers. :(
Josh Stone [Tue, 6 Nov 2012 00:21:50 +0000 (16:21 -0800)]
stapdyn: Add support for return probes
Each address is converted to the BPatch_locExit of the function which
contains it. Even $return is working fine from here!
* runtime/dyninst/uprobes.c (stp_dyninst_probe_flags): New, return the
flags describing this probe, notably STAPDYN_PROBE_FLAG_RETURN.
* stapdyn/dynprobe.cxx (find_dynprobes): Read the flags from the module.
(dynprobe_location::dynprobe_location): Parse return_p from the flags.
* stapdyn/mutatee.cxx (mutatee::instrument_dynprobe_target): For probes
with return_p set, transform into BPatch_locExit points.
* tapsets.cxx (dwarf_builder::build): Let stapdyn return probes through.
(uprobe_derived_probe_group::emit_module_dyninst_decls): Emit
.flags=STAPDYN_PROBE_FLAG_RETURN for return probes.
Josh Stone [Mon, 5 Nov 2012 21:58:44 +0000 (13:58 -0800)]
stapdyn: Reduce LDADD to only those directly used
The only part of Dyninst that we actually use and need to link is
libdyninstAPI. The rest of those libraries I had in dyninst_LIBS were
those needed indirectly by that one. But trying to enumerate someone
else's dependencies is a recipe for failure -- e.g. it was already
broken by not including the new libdynElf too.
The reason I had this was to allow successful linking when using
--with-dyninst=/not/a/lib/searched/path without requiring also to set
LD_LIBRARY_PATH. Since the enumeration is prone to break, and you'd
have to set LD_LIBRARY_PATH anyway to be able to run, I've decided it's
not worth trying to be fancy here.
Josh Stone [Mon, 5 Nov 2012 21:50:13 +0000 (13:50 -0800)]
configure: treat any positive --with-dyninst as a hard req
If the user gave --with-dyninst[=yes] or --with-dyninst=/path, treat a
failure in that feature test as a hard error. If the user left dyninst
implicit, then don't make it an error. And of course if the user gave
--without-dyninst, then don't test it at all.
Josh Stone [Mon, 5 Nov 2012 20:20:46 +0000 (12:20 -0800)]
Add System.map kernel functions to systemtap_session
The code to parse System.map was already in place for kprobe.function
validation; now it's generalized and the result made available in
systemtap_session::kernel_functions.
Josh Stone [Fri, 2 Nov 2012 23:23:43 +0000 (16:23 -0700)]
Prototype support for inode-uretprobes
Anton Arapov sent a test kernel build with new support for uretprobes,
and this patch adds stap support. I've confirmed that it works on
x86_64, but i686 is crashing the target processes with SIGSEGV.
We need to find a dynamic (pass-2) way to detect the presence of
uretprobes in the kernel. For now, I've just hacked it enabled, and it
will fail registration at runtime.
* buildrun.cxx (compile_pass): Autoconf uretprobes and its exports.
* runtime/linux/autoconf-inode-uretprobes.c: New, check for uretprobes.
* runtime/linux/runtime.h: Add function pointers for uretprobes.
* runtime/transport/transport.c (_stp_transport_init): Set the uretprobe
function pointers if not exported. (Anton's kernel does have exports,
but we're prepared in case upstream doesn't accept those.)
* runtime/linux/uprobes-inode.c (stapiu_consumer): Let this double as
either a uprobe_consumer or a uretprobe_consumer, chosen by return_p.
(stapiu_probe_handler): Add a new generic function signature.
(stapiu_uprobe_handler, stapiu_uretprobe_handler): New specific
callbacks that mux into stapiu_probe_handler.
(stapiu_register, stapiu_unregister): New functions to perform the
appropriate kind of registration for a probe.
* tapsets.cxx (dwarf_builder::build): Hack the uretprobes check.
(uprobe_derived_probe_group::emit_module_inode_decls): Use the new
signature for the probe handler, and emit .return_p.
New systemtap.examples/stapgames directory added with the supporting
tapsets located in the 'tapset' subdirectory. All tests run with -p4
specified.
* testsuite/systemtap.examples/stapgames/block.meta : block meta data
* testsuite/systemtap.examples/stapgames/block.stp : break a ceiling of
blocks
* testsuite/systemtap.examples/stapgames/eater.meta : eater meta data
* testsuite/systemtap.examples/stapgames/eater.stp : eat the .'s before
being eaten
* testsuite/systemtap.examples/stapgames/lifegame.meta : life meta data
* testsuite/systemtap.examples/stapgames/lifegame.stp : watch a
'lifeform' morph and evolve
* testsuite/systemtap.examples/stapgames/pingpong.meta : ping pong meta
data
* testsuite/systemtap.examples/stapgames/pingpong.stp : cursor bounces
around terminal reflecting off edges
* testsuite/systemtap.examples/stapgames/tapset/audio.stp : audio
functionality
* testsuite/systemtap.examples/stapgames/tapset/cursor.stp : cursor
functionality and tracking
* testsuite/systemtap.examples/stapgames/tapset/game.stp : seed values
* testsuite/systemtap.examples/stapgames/tapset/gmtty.stp : tty functionality
* testsuite/systemtap.examples/stapgames/tapset/input.stp : controlling
game input