]> sourceware.org Git - systemtap.git/log
systemtap.git
11 years agostapdyn: Make sure the module has a path component
Josh Stone [Fri, 28 Sep 2012 21:42:14 +0000 (14:42 -0700)]
stapdyn: Make sure the module has a path component

We don't ever want library-path searching for the probe module, but
that's what dlopen will do if there's no '/' in the filename.

* stapdyn/stapdyn.cxx (main): If the module has no path component, give
  it the minimum "./" leader.

11 years agostapdyn: Check and report the child exit status
Josh Stone [Fri, 28 Sep 2012 21:28:13 +0000 (14:28 -0700)]
stapdyn: Check and report the child exit status

* stapdyn/dynutil.cxx (check_dyninst_exit): New, check how the given
  BPatch_process exited, and report failures.
* stapdyn/stapdyn.cxx (main): Use check_dyninst_exit.
* stapdyn/dynsdt.cxx (main): Use check_dyninst_exit.

11 years agoPR14364, PR14630: Use set_fs and pagefault_disable/enable around more accesses
Frank Ch. Eigler [Fri, 28 Sep 2012 19:35:18 +0000 (15:35 -0400)]
PR14364, PR14630: Use set_fs and pagefault_disable/enable around more accesses

It turns out there are a bunch of conceptually overlapping
functions/macros throughout the runtime, each of which attempts to
dereference untrustworthy kernel- or user-space pointers, in slightly
different ways.

When deliberately invoked with bad pointer values, some lockdep
kernels (e.g. 2.6.32-279.9.1.el6.x86_64.debug) would emit errors about
page-fault handling paths being triggered in inappropriate contexts
for some of these lookup functions.  It turns out a more robust
control of address space checking and fault suppression is necessary.

* runtime/linux/autoconf-pagefault_disable.c: New test.
* buildrun.cxx (compile_pass): Run it.
* runtime/linux/copy.c (_stp_read_address): Add pagefault_{disable,enable}.
  Note duplication with loc2c-runtime.h
  (_stp_strncpy_from_user): Add set_fs & pagefault_{disable,enable}.
  Note duplication with loc2c-runtime.h
* runtime/stp_string.h (__stp_get_user): Wrap in pagefault_{disable,enable}.
  Note duplication with loc2c-runtime.h
* tapset/uconversions.stp (__STP_GET_USER): Instead of __stp_get_user,
  zap duplication with loc2c-runtime.h and just call loc2c-runtime.h.
* runtime/loc2c-runtime.h (STAPCONF_PAGEFAULT_DISABLE): Add dummy
  macros for pre-rhel5 kernels.
  (_stp_deref, _stp_store_deref): Revamped arch-specific macros, setting
  segments and disabling pagefaults.
  (uderef,ustore_deref,kderef,kstore_deref): Revamped macros to call the
  above.  These should become the standard throughout the runtime/tapset.

11 years agoruntime: fix uninitialized-variable warning
Frank Ch. Eigler [Fri, 28 Sep 2012 19:07:56 +0000 (15:07 -0400)]
runtime: fix uninitialized-variable warning

* runtime/stack.c (_stp_stack_kernel_get): Initialize pc = 0.
  (_stp_stack_user_get): Ditto.

11 years agoruntime: add noinline to *printf fns to limit frame-size errors
Frank Ch. Eigler [Fri, 28 Sep 2012 18:57:46 +0000 (14:57 -0400)]
runtime: add noinline to *printf fns to limit frame-size errors

During the debugging work for PR14630, it turned out to trigger these
warning->errors.  Some noinline's, and one or two static[]'s,
<south park>.... and it's gone!</>

11 years agoPR14630 part 1: make addr-map take irq-blocking locks
Frank Ch. Eigler [Fri, 28 Sep 2012 18:35:40 +0000 (14:35 -0400)]
PR14630 part 1: make addr-map take irq-blocking locks

Implicated by several OOPS messages, complaining about normal locks
being manipulated in atomic contexts.

* runtime/linux/addr-map.c (*): Lock addr_map_lock with
  irqsave/restore variant calls.

11 years agoPR13693 groundwork: document the %( systemtap_privilege ... %) conditional
Serguei Makarov [Fri, 28 Sep 2012 21:16:16 +0000 (17:16 -0400)]
PR13693 groundwork: document the %( systemtap_privilege ... %) conditional

11 years agoPR13693: correct behaviour for --privilege=stapsys.
Serguei Makarov [Fri, 28 Sep 2012 21:05:18 +0000 (17:05 -0400)]
PR13693: correct behaviour for --privilege=stapsys.

11 years agoPR13693: allow unprivileged use of probefunc().
Serguei Makarov [Fri, 28 Sep 2012 19:27:20 +0000 (15:27 -0400)]
PR13693: allow unprivileged use of probefunc().

11 years agocleanup in context-symbols.stp: get rid of redundant range check before the one in...
Serguei Makarov [Fri, 28 Sep 2012 19:26:04 +0000 (15:26 -0400)]
cleanup in context-symbols.stp: get rid of redundant range check before the one in __stack_raw().

11 years agoPR13693 groundwork: allow conditional compilation based on script privilege level.
Serguei Makarov [Fri, 28 Sep 2012 19:24:17 +0000 (15:24 -0400)]
PR13693 groundwork: allow conditional compilation based on script privilege level.

11 years agoPR14489: Revamp stapdyn probe metadata
Josh Stone [Fri, 28 Sep 2012 00:55:05 +0000 (17:55 -0700)]
PR14489: Revamp stapdyn probe metadata

Rather than having a fixed data structure for stapdyn to read from the
module, now stapdyn queries the module dynamically for its data.  Thus,
we dlopen the module within stapdyn, then dlsym a few query functions
and use those to enumerate all of the probe data.

* runtime/dyninst/stapdyn.h: Add functions for metadata.
* runtime/dyninst/uprobes.h: New, define module internal datastructures.
* runtime/dyninst/uprobes.c: Implement the metadata functions.
* tapsets.cxx: Generate probe metadat in the new datastructures.
* stapdyn/stapdyn.cxx: Query probes using the new functions.
* stapdyn/Makefile.am: No longer need -lelf for stapdyn.
* stapdyn/Makefile.in: Regenerate.

11 years agoPR14574: Let stapdyn run without a target command
Josh Stone [Thu, 27 Sep 2012 20:25:30 +0000 (13:25 -0700)]
PR14574: Let stapdyn run without a target command

For easier testing, let begin/end/error probes run directly in stapdyn
when there's no -c option given.

* runtime/dyninst/stapdyn.h: New, declare functions defined in the
  module and used by stapdyn.
* runtime/dyninst/runtime.h: Include stapdyn.h so definitions match.
* stapdyn/stapdyn.cxx: When no command is given, dlsym the init/exit
  functions and run them directly.
* (autoreconf...)

11 years agostapdyn: open /proc/self/mem with O_CLOEXEC
Josh Stone [Thu, 27 Sep 2012 19:23:18 +0000 (12:23 -0700)]
stapdyn: open /proc/self/mem with O_CLOEXEC

11 years agohash: Include several subdirectories of the runtime
Josh Stone [Thu, 27 Sep 2012 18:42:03 +0000 (11:42 -0700)]
hash: Include several subdirectories of the runtime

One advantage of having the runtime path in the hash is its mtime also
tells us when any files were modified (at least with most editors that
write a temp file then atomically rename).  For stap hackers like
myself, it would be nice to get this benefit for subdirectories of the
runtime too, so let's also add those to the hash.

* hash.cxx (get_base_hash): Add /transport, /unwind, and either /dyninst
  or /linux depending on the current runtime mode.
  (find_uprobes_hash): Update the uprobes paths since PR14179's move.

11 years agoPR13486: Always output a frame_base if needed
Josh Stone [Thu, 27 Sep 2012 16:19:39 +0000 (09:19 -0700)]
PR13486: Always output a frame_base if needed

Previously, loc2c only emitted code for frame_base if it was on the
first loc of the chain.  But in some cases, the first piece may not
reference the frame_base while later parts do.

In the cases found in the bug, the first piece was GNU_implicit_pointer,
which doesn't even emit code of its own.  But its target DIE did need
the frame_base to compute its value.  Since loc2c didn't realize that,
we ended up emitting code using frame_base without ever declaring it.

* loc2c.c (c_emit_location): Loop over the whole loc chain to determine
  if a frame_base is needed, and output the first one found.

11 years agostapdyn: Resolve the target executable from the PATH
Josh Stone [Wed, 26 Sep 2012 22:17:10 +0000 (15:17 -0700)]
stapdyn: Resolve the target executable from the PATH

BPatch::processCreate needs a full path for the process argument, so we
need to walk the PATH to figure that out.  We already did this in
dynsdt, but using a private function.  Now both use find_executable from
util.h, in a new form that doesn't care about sysroots.

* util.cxx (find_executable): Add a name-only version that just wraps
  the full sysroot version, for convenience.  Also let a few more things
  be const in the implementation.
* hash.cxx (get_base_hash): Use the wrapper function for finding gcc,
  instead of having a "dummy" sysenv itself.
* stapdyn/stapdyn.cxx (main): Resolve the target with find_executable.
* stapdyn/dynsdt.cxx (resolve_path): Removed.
  (main): Use find_executable instead.

11 years agoPR13693 yet more typo fix: more precise version check.
Serguei Makarov [Wed, 26 Sep 2012 21:27:41 +0000 (17:27 -0400)]
PR13693 yet more typo fix: more precise version check.

11 years agoPR13693 groundwork: appropriate pure/privileged pragmas for stack(), ustack().
Serguei Makarov [Wed, 26 Sep 2012 20:56:17 +0000 (16:56 -0400)]
PR13693 groundwork: appropriate pure/privileged pragmas for stack(), ustack().

11 years agoPR13693: typofix previous commit (yes, the change is tested).
Serguei Makarov [Wed, 26 Sep 2012 20:24:26 +0000 (16:24 -0400)]
PR13693: typofix previous commit (yes, the change is tested).

11 years agoPR13693 groundwork: rewrite probefunc() solely in terms of [u]symname([u]stack(0)).
Serguei Makarov [Wed, 26 Sep 2012 20:09:49 +0000 (16:09 -0400)]
PR13693 groundwork: rewrite probefunc() solely in terms of [u]symname([u]stack(0)).

11 years ago(PR14574 partial fix) Make the systemtap.pass1-4/*.exp tests use dyninst also.
David Smith [Wed, 26 Sep 2012 19:31:31 +0000 (14:31 -0500)]
(PR14574 partial fix) Make the systemtap.pass1-4/*.exp tests use dyninst also.

* testsuite/lib/systemtap.exp (print_systemtap_version): New function.
  (get_runtime_list): Ditto.
  (setup_systemtap_environment): Remember whether we've got dyninst
  support.
  (stap_run_batch): Allow passing args and the filename.
* testsuite/systemtap.pass1-4/buildok-dyninst.exp: New test.
* testsuite/systemtap.pass1-4/buildko.exp: Add dyninst support.
* testsuite/systemtap.pass1-4/parseko.exp: Ditto.
* testsuite/systemtap.pass1-4/parseok.exp: Ditto.
* testsuite/systemtap.pass1-4/semko.exp: Ditto.
* testsuite/systemtap.pass1-4/semok.exp: Ditto.
* testsuite/systemtap.pass1-4/transko.exp: Ditto.
* testsuite/systemtap.pass1-4/transok.exp: Ditto.
* testsuite/buildok/cmdline01.stp: Allow extra args to be passed in.
* testsuite/buildok/fortytwo.stp: Ditto.
* testsuite/buildok/oldlocals01.stp: Ditto.
* testsuite/buildok/scsi-detailed.stp: Ditto.
* testsuite/buildok/thirtythree.stp: Ditto.
* testsuite/buildok/thirtytwo.stp: Ditto.
* testsuite/parseko/bad_tapset.stp: Ditto.
* testsuite/parseko/cmdline02.stp: Ditto.
* testsuite/parseko/cmdline03.stp: Ditto.
* testsuite/parseko/cmdline04.stp: Ditto.
* testsuite/parseko/cmdline06.stp: Ditto.
* testsuite/parseko/cmdline07.stp: Ditto.
* testsuite/parseko/cmdline08.stp: Ditto.
* testsuite/parseko/cmdline15.stp: Ditto.
* testsuite/parseko/cmdline22.stp: Ditto.
* testsuite/parseko/deprecated01.stp: Ditto.
* testsuite/parseko/preprocess13.stp: Ditto.
* testsuite/parseko/preprocess16.stp: Ditto.
* testsuite/parseko/preprocess17.stp: Ditto.
* testsuite/parseko/twentyseven.stp: Ditto.
* testsuite/parseko/twentythree.stp: Ditto.
* testsuite/parseok/all_tapsets.stp: Ditto.
* testsuite/parseok/bad_tapset.stp: Ditto.
* testsuite/parseok/cmdline01.stp: Ditto.
* testsuite/parseok/cmdline02.stp: Ditto.
* testsuite/parseok/deprecated01.stp: Ditto.
* testsuite/parseok/fourteen.stp: Ditto.
* testsuite/parseok/macros05.stp: Ditto.
* testsuite/parseok/macros08.stp: Ditto.
* testsuite/parseok/nineteen.stp: Ditto.
* testsuite/parseok/semko.stp: Ditto.
* testsuite/parseok/unparser.stp: Ditto.
* testsuite/semko/fifty.stp: Ditto.
* testsuite/semko/nodwf01.stp: Ditto.
* testsuite/semko/nodwf02.stp: Ditto.
* testsuite/semko/nodwf03.stp: Ditto.
* testsuite/semko/nodwf04.stp: Ditto.
* testsuite/semko/nodwf05.stp: Ditto.
* testsuite/semko/nodwf06.stp: Ditto.
* testsuite/semko/nodwf07.stp: Ditto.
* testsuite/semko/nodwf08.stp: Ditto.
* testsuite/semko/nodwf09.stp: Ditto.
* testsuite/semko/plt2.stp: Ditto.
* testsuite/semko/target_lvalue.stp: Ditto.
* testsuite/semok/args.stp: Ditto.
* testsuite/semok/badvar.stp: Ditto.
* testsuite/semok/badvar_undefined.stp: Ditto.
* testsuite/semok/bz11911.stp: Ditto.
* testsuite/semok/defined_list_vars.stp: Ditto.
* testsuite/semok/eight.stp: Ditto.
* testsuite/semok/nine.stp: Ditto.
* testsuite/semok/nodwf01.stp: Ditto.
* testsuite/semok/nodwf02.stp: Ditto.
* testsuite/semok/nodwf03.stp: Ditto.
* testsuite/semok/nodwf04.stp: Ditto.
* testsuite/semok/nodwf05.stp: Ditto.
* testsuite/semok/nodwf06.stp: Ditto.
* testsuite/semok/nodwf07.stp: Ditto.
* testsuite/semok/plt2.stp: Ditto.
* testsuite/semok/pr11808.stp: Ditto.
* testsuite/semok/pr11809.stp: Ditto.
* testsuite/semok/syscall_return.stp: Ditto.
* testsuite/semok/transko.stp: Ditto.
* testsuite/semok/twenty.stp: Ditto.
* testsuite/semok/twentyfive.stp: Ditto.
* testsuite/transok/buildko.stp: Ditto.
* testsuite/transok/eleven.stp: Ditto.

11 years agoTypo fix for earlier probe_type enum commit (commit cda141c).
Serguei Makarov [Wed, 26 Sep 2012 19:24:25 +0000 (15:24 -0400)]
Typo fix for earlier probe_type enum commit (commit cda141c).

11 years agotestsuite: set $SYSTEMTAP_SYNC
Frank Ch. Eigler [Wed, 26 Sep 2012 17:41:54 +0000 (13:41 -0400)]
testsuite: set $SYSTEMTAP_SYNC

For helping diagnose crashes that may occur during a testsuite,
set $SYSTEMTAP_SYNC, which is handled by staprun, just before it
does the module-insertion.  This will make tests slower, sorry.

* testsuite/Makefile.am (RUNTEST): Add env SYSTEMTAP_SYNC=yes.
* testsuite/Makefile.in: Regenerated with love.

11 years agoPR6580: tweak psyms() et al output format to satisfy exelib.exp.
Serguei Makarov [Wed, 26 Sep 2012 16:36:02 +0000 (12:36 -0400)]
PR6580: tweak psyms() et al output format to satisfy exelib.exp.

11 years agoPR6580: detailed docstrings for updated tapset functions.
Serguei Makarov [Tue, 25 Sep 2012 15:29:36 +0000 (11:29 -0400)]
PR6580: detailed docstrings for updated tapset functions.

11 years agostapdyn: Enable end/error probes
Josh Stone [Mon, 24 Sep 2012 23:15:55 +0000 (16:15 -0700)]
stapdyn: Enable end/error probes

The dyninst exit hook runs too late for us to still call anything in the
mutatee, so the systemtap_module_exit() call which should run all of the
end/error probes wasn't happening.

Now we use a destructor function in the mutatee, so our exit path always
runs after main() returns or after an exit() call.  Functions like
_exit() are still problematic though.

This now also makes a distinction between initializing process-local vs.
session resources, so we are more ready for operating with multiple
mutatees at once.  See dyninst/runtime.h for design comments.

11 years agoPR14611: enable PR9740 workaround only for kernel 2.6.23 - 2.6.29ish
Frank Ch. Eigler [Mon, 24 Sep 2012 19:21:00 +0000 (15:21 -0400)]
PR14611: enable PR9740 workaround only for kernel 2.6.23 - 2.6.29ish

11 years agostaplog.c: Use tighter #if / #elif chain for crash/defs ARCH #defines
Frank Ch. Eigler [Mon, 24 Sep 2012 13:25:58 +0000 (09:25 -0400)]
staplog.c: Use tighter #if / #elif chain for crash/defs ARCH #defines

Just to make doubly triple-sure that no more than one of the macros gets set.

11 years agocommon_probe_context cleanup: make probe_type an enum
Serguei Makarov [Fri, 21 Sep 2012 20:05:23 +0000 (16:05 -0400)]
common_probe_context cleanup: make probe_type an enum

11 years ago(PR14571 partial fix) For dyninst, use TLS for map and stat data.
David Smith [Fri, 21 Sep 2012 20:13:28 +0000 (15:13 -0500)]
(PR14571 partial fix) For dyninst, use TLS for map and stat data.

* runtime/dyninst/tls_data.c: New file.
* runtime/stat.c (struct _Stat): Add a tls_data_container_t structure.
  (_stp_stat_tls_object_init): New function.
  (_stp_stat_tls_object_free): Ditto.
  (_stp_stat_init): Instead of directly allocating percpu data, for
  dyninst set up tls data to be created when accessed by calling
  _stp_tls_data_container_init().
  (_stp_stat_del): For dyninst, call _stp_tls_data_container_cleanup() to
  remove all the tls data.
  (_stp_stat_add): For dyninst, get the proper tls stat object.
  (_stp_stat_get_cpu): Deleted unused function.
  (_stp_stat_get): For dyninst, get the proper tls stat objects.
  (_stp_stat_clear): For dyninst, clear the stat in each thread's tls data.
* runtime/stat.h (struct stat_data): Add a tls_data_object_t structure.
* runtime/map.c (_stp_map_tls_object_init): New function.
  (_stp_map_tls_object_free): Ditto.
  (_stp_pmap_new): Instead of directly allocating percpu data, for dyninst
  set up tls data to be created when accessed by calling
  _stp_tls_data_container_init().
  (_stp_pmap_clear): For dyninst, clear the map in each thread's tls data.
  (_stp_pmap_del): For dyninst, call _stp_tls_data_container_cleanup() to
  remove all the tls data.
  (_stp_pmap_agg): Add dyninst support.
* runtime/map.h (struct map_root): Add a tls_data_object_t structure.
  (struct pmap): Add a tls_data_container_t structure.
* runtime/map-stat.c (_stp_hstat_tls_object_init): New function.
  (_stp_pmap_new_hstat_linear): For dyninst, override the standard tls
  data object init function with _stp_hstat_tls_object_init(), which knows
  how to handle hstats.
  (_stp_pmap_new_hstat_log): Ditto.
* runtime/pmap-gen.c (_stp_pmap_tls_object_init): New function.
  (_stp_pmap_new): For dyninst, override the standard tls
  data object init function with _stp_pmap_tls_object_init(), which knows
  how to handle pmaps.
  (_stp_pmap_set): For dyninst, get the proper tls pmap object.
  (_stp_pmap_add): Ditto.
  (_stp_pmap_get_cpu): Ditto.
  (_stp_pmap_get): Ditto.
  (_stp_pmap_del): Ditto.
* runtime/dyninst/linux_defs.h: Added container_of(), list_entry(),
  list_for_each_entry(), and list_for_each_entry_safe().

11 years agoFixup sym.c _stp_module_check note_addr warning.
Mark Wielaard [Fri, 21 Sep 2012 08:30:12 +0000 (10:30 +0200)]
Fixup sym.c _stp_module_check note_addr warning.

The check said "notes_addr <= base_addr" /* shouldn't happen */
But the warning said "build-id address %lx < base %lx".
Make them both <=.

11 years agoAdd MODULE_INFO() macro for dyninst mode.
David Smith [Thu, 20 Sep 2012 21:13:48 +0000 (16:13 -0500)]
Add MODULE_INFO() macro for dyninst mode.

* runtime/dyninst/runtime.h: Add MODULE_INFO() macro to get things
  compiling in dyninst mode (the testsuite adds a "--modinfo intree=Y"
  argument).

11 years agoPR6580: reimplement straightforward legacy functions in terms of stack().
Serguei Makarov [Wed, 19 Sep 2012 20:34:23 +0000 (16:34 -0400)]
PR6580: reimplement straightforward legacy functions in terms of stack().

11 years agoPR6580 clarification: comment explaining suitability of current kluge for _stp_get_ur...
Serguei Makarov [Wed, 19 Sep 2012 15:00:22 +0000 (11:00 -0400)]
PR6580 clarification: comment explaining suitability of current kluge for _stp_get_uregs() clearing kernel cache.

The inefficiency alluded to only occurs when interspersing
*partial* kernel and user unwinds, e.g. try this with -DDEBUG_UNWIND=1:

stack(0); ustack(0); stack(1); ustack(1); ...

11 years agoparse.cxx swallow tokens we are definitely not using.
Mark Wielaard [Wed, 19 Sep 2012 08:33:29 +0000 (10:33 +0200)]
parse.cxx swallow tokens we are definitely not using.

The tokens produced by expect_* () were immediately dropped on the floor
after inspection. And a lot of places in the parser called next () just
to get passed the current token without using it. Those tokens could
immediately be cleaned up saving ~3MB of "lost memory".

valgrind stap -v -k -p4 -e 'probe begin { log("Hello, World!"); exit(); }'
Before:
==12545==    definitely lost: 2,470,128 bytes in 51,408 blocks
==12545==    indirectly lost: 14,180,805 bytes in 319,624 blocks

After:
==14782==    definitely lost: 18,856 bytes in 220 blocks
==14782==    indirectly lost: 12,432,436 bytes in 264,176 blocks

11 years agostapdyn: Enable user macros and verbose gcc reporting
Josh Stone [Wed, 19 Sep 2012 00:22:42 +0000 (17:22 -0700)]
stapdyn: Enable user macros and verbose gcc reporting

11 years agostapdyn: Add execname() using prctl(PR_GET_NAME)
Josh Stone [Wed, 19 Sep 2012 00:20:26 +0000 (17:20 -0700)]
stapdyn: Add execname() using prctl(PR_GET_NAME)

11 years agoPR6580: incremental unwinder with cache.
Serguei Makarov [Mon, 17 Sep 2012 22:03:31 +0000 (18:03 -0400)]
PR6580: incremental unwinder with cache.

Implements a cached unwinder, allowing most backtrace tapset functions
to be implemented in terms of stack() without loss of performance.
stack() calls can be made repeatedly and in any order, and they will
use the results of a single unwind. (Works only with the DWARF
unwinder).

_stp_stack_kernel_print et. al. retain their prior behaviour,
including a number of fallbacks not available to the incremental
unwind. These fallbacks only emit backtrace strings, which can be
tokenized on the tapset end as a last resort.

* runtime/unwind/unwind.h -- define struct unwind_cache to store PCs
  obtained from unwinder.
* runtime/common_probe_context.h -- include two sets of unwinder
  context and cache, one for user side, one for kernel.
* tapsets.cxx -- probe prologue includes a small thing to mark
  the unwind caches as being in an uninitialized state.
* runtime/stack.c -- incremental unwinder implementation.
* runtime/stack-dwarf.c -- deleted. Code moved to stack.c since
  this is now the preferred unwind method.
* tapset/linux/[u]context-symbols.stp -- change stack(), ustack()
  to directly call incremental unwinder.

11 years ago(PR14571 partial fix) For dyninst, rename 'stat' to 'stat_data'.
David Smith [Mon, 17 Sep 2012 18:54:18 +0000 (13:54 -0500)]
(PR14571 partial fix) For dyninst, rename 'stat' to 'stat_data'.

* runtime/stat.h: To avoid clashing with 'stat' definition from
  /usr/include/sys/stat.h, rename internal 'stat' typedef to 'stat_data'.
* runtime/map-gen.c: Renamed 'stat' to 'stat_data'.
* runtime/map-stat.c: Ditto.
* runtime/map.c: Ditto.
* runtime/map.h: Ditto.
* runtime/pmap-gen.c: Ditto.
* runtime/stat-common.c: Ditto.
* runtime/stat.c: Ditto.

11 years agoCleanup for PR6580: well-duh typo fix for last commit.
Serguei Makarov [Mon, 17 Sep 2012 15:34:13 +0000 (11:34 -0400)]
Cleanup for PR6580: well-duh typo fix for last commit.

11 years agoCleanup for PR6580: replace context probe_flags with individual status bits.
Serguei Makarov [Mon, 17 Sep 2012 15:10:39 +0000 (11:10 -0400)]
Cleanup for PR6580: replace context probe_flags with individual status bits.

Instead of checking c->probe_flags against _STP_PROBE_STATE_*, use
c->user_mode_p and c->full_uregs_p.

11 years ago(PR14571 partial fix) For dyninst, use TLS for the context structure.
David Smith [Fri, 14 Sep 2012 15:13:19 +0000 (10:13 -0500)]
(PR14571 partial fix) For dyninst, use TLS for the context structure.

* translate.cxx (c_unparser::emit_common_header): Update to use thread
  local storage in dyninst mode for context structure.
  (c_unparser::emit_global_param): Since there are no module parameters
  with dyninst, don't bother emitting code.
  (c_unparser::emit_module_init): Don't bother emitting kernel-only code
  in dyninst mode.
* runtime/vsprintf.c (_stp_vsprint_memory): For dyninst, use thread local
  storage to get correct context structure.
* tapsets.cxx (common_probe_entryfn_prologue): Take a 'systemtap_sesion'
  argument instead of a 'translator_output' argument.  This allows access
  to the s.is_usermode() function (so we can avoid outputting kernel code
  when using dyninst).
  (dwarf_derived_probe_group::emit_module_decls): Update
  common_probe_entryfn_prologue() call.
  (uprobe_derived_probe_group::emit_module_utrace_decls): Ditto.
  (uprobe_derived_probe_group::emit_module_inode_decls): Ditto.
  (uprobe_derived_probe_group::emit_module_dyninst_decls): Ditto.
  (kprobe_derived_probe_group::emit_module_decls): Ditto.
  (hwbkpt_derived_probe_group::emit_module_decls): Ditto.
  (tracepoint_derived_probe_group::emit_module_decls): Ditto.
* tapset-been.cxx (be_derived_probe_group::emit_module_decls): Ditto.
* tapset-itrace.cxx (itrace_derived_probe_group::emit_module_decls): Ditto.
* tapset-mark.cxx (mark_derived_probe_group::emit_module_decls): Ditto.
* tapset-netfilter.cxx (netfilter_derived_probe_group::emit_module_decls):
  Ditto.
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls): Ditto.
* tapset-procfs.cxx (procfs_derived_probe_group::emit_module_decls):
  Ditto.
* tapset-timers.cxx (profile_derived_probe_group::emit_module_decls):
  Ditto.
* tapset-utrace.cxx (utrace_derived_probe_group::emit_module_decls):
  Ditto.
* tapsets.h: Updated common_probe_entryfn_prologue() declaration.

11 years agoInclude a closing ''' for kvm_service_time.meta so the tests run properly.
William Cohen [Thu, 13 Sep 2012 19:31:58 +0000 (15:31 -0400)]
Include a closing ''' for kvm_service_time.meta so the tests run properly.

11 years agoParameterize variables used in config and initscript files.
William Cohen [Wed, 12 Sep 2012 17:22:17 +0000 (13:22 -0400)]
Parameterize variables used in config and initscript files.

11 years agoFixed PR14560 to avoid cmd_parse.exp hanging on RHEL5.
David Smith [Tue, 11 Sep 2012 22:24:18 +0000 (17:24 -0500)]
Fixed PR14560 to avoid cmd_parse.exp hanging on RHEL5.

* testsuite/systemtap.base/cmd_parse.exp: Change cmd_parse14 test to use
  grep instead of expect to avoid hangs on RHEL5.

11 years ago(PR14488 partial fix) Make memory writing more robust.
David Smith [Mon, 10 Sep 2012 21:20:16 +0000 (16:20 -0500)]
(PR14488 partial fix) Make memory writing more robust.

* runtime/dyninst/linux_defs.h (__copy_from_user): Remove unused code (and
  update comment).
  (__put_user): New macro.
  (__copy_to_user): New function.
  (__put_user_fn): Ditto.
* runtime/dyninst/loc2c-runtime.h (__get_user_asm): Fix macro to return
  error code.
  (__put_user_asm): New macro.

11 years agoCorrect the location of uconversions.stp in tapsets.tmpl
William Cohen [Mon, 10 Sep 2012 18:44:42 +0000 (14:44 -0400)]
Correct the location of uconversions.stp in tapsets.tmpl

11 years agodoc: elaborate on process.* context variables and sdt.h markers
Frank Ch. Eigler [Mon, 10 Sep 2012 17:02:13 +0000 (13:02 -0400)]
doc: elaborate on process.* context variables and sdt.h markers

11 years agodoc: mention 'context variables' as an alias for 'target variables'
Frank Ch. Eigler [Mon, 10 Sep 2012 17:01:50 +0000 (13:01 -0400)]
doc: mention 'context variables' as an alias for 'target variables'

11 years agolangref.tex: document various embedded-C pragmas
Serguei Makarov [Mon, 10 Sep 2012 16:44:49 +0000 (12:44 -0400)]
langref.tex: document various embedded-C pragmas

11 years agolangref.tex: clarify when embedded-C code (as opposed to expressions) may appear
Serguei Makarov [Mon, 10 Sep 2012 16:30:06 +0000 (12:30 -0400)]
langref.tex: clarify when embedded-C code (as opposed to expressions) may appear

11 years agodflpp.cxx (find_variable_and_frame_base): Remove extra bracket in error.
Mark Wielaard [Mon, 10 Sep 2012 08:29:15 +0000 (10:29 +0200)]
dflpp.cxx (find_variable_and_frame_base): Remove extra bracket in error.

Before:
semantic error: unable to find local 'task', dieoffset 0x111604 in nfs,
near pc 0x78863 in nfs_read_done fs/nfs/proc.c ( (alternatives: $data):
identifier '$task' at [...]

After:
semantic error: unable to find local 'task', dieoffset 0x111604 in nfs,
near pc 0x78863 in nfs_read_done fs/nfs/proc.c (alternatives: $data):
identifier '$task' at [...]

11 years ago(PR14488 partial fix) Make memory reading more robust.
David Smith [Fri, 7 Sep 2012 19:57:18 +0000 (14:57 -0500)]
(PR14488 partial fix) Make memory reading more robust.

* runtime/dyninst/runtime.h (assert_is_myproc): New dummy macro.
  (stp_dummy_init): Opens the /proc/self/mem file.
  (stp_dummy_exit): Close the file.
* runtime/dyninst/linux_defs.h (user_mode): New dummy macro.
  (__copy_from_user): Rewrote to read memory from /proc/self/mem, to be
  able to catch errors.
* runtime/stp_string.h (__stp_get_user): Always use __get_user(), no
  matter what arch we're on in dyninst mode.
* tapset/uconversions.stp: Moved from tapset/linux/uconversions.stp, since
  the dyninst runtime can use the functions also.

11 years agoImprove dwflpp::find_variable_and_frame_base error message when var not found.
Mark Wielaard [Fri, 7 Sep 2012 13:04:44 +0000 (15:04 +0200)]
Improve dwflpp::find_variable_and_frame_base error message when var not found.

Mention scope DIE offset and module name.

11 years agostap-report: add slackware package-listing widgetry
Frank Ch. Eigler [Thu, 6 Sep 2012 18:18:25 +0000 (14:18 -0400)]
stap-report: add slackware package-listing widgetry

11 years agoPR14549: Revert "PR6580: rewrite simple to-be-deprecated backtrace functions in terms...
Serguei Makarov [Thu, 6 Sep 2012 14:06:26 +0000 (10:06 -0400)]
PR14549: Revert "PR6580: rewrite simple to-be-deprecated backtrace functions in terms of new ones"

This reverts commit 4e4aaf10d022db0f607b9e729b1a7abd5decc1b4, keeping the
definition of spsyms(), in order to avoid regression PR14549.

11 years agoPR14546 Only copy registers of initial state.
Mark Wielaard [Wed, 5 Sep 2012 19:09:43 +0000 (21:09 +0200)]
PR14546 Only copy registers of initial state.

The DWARF unwinder was copying too much information into the cie_regs
state possibly overwriting ~18 bytes after the unwind_context. Just copy
the registers.

Fix small testsuite type s/ko/ok/ in pr14546.exp

11 years agoPR14546: testcase for repeated unwinder invocations.
Serguei Makarov [Wed, 5 Sep 2012 20:31:17 +0000 (16:31 -0400)]
PR14546: testcase for repeated unwinder invocations.

11 years agochmod +x ./testsuite/semko/entry04.stp
William Cohen [Wed, 5 Sep 2012 14:43:44 +0000 (10:43 -0400)]
chmod +x ./testsuite/semko/entry04.stp

11 years agosystemtap.spec: activate with_dyninst on rhel7 too
Frank Ch. Eigler [Tue, 4 Sep 2012 14:14:50 +0000 (10:14 -0400)]
systemtap.spec: activate with_dyninst on rhel7 too

11 years agoPR14534: systemtap.spec should include ../stap-env in -server, not -runtime
Frank Ch. Eigler [Fri, 31 Aug 2012 14:28:32 +0000 (10:28 -0400)]
PR14534: systemtap.spec should include ../stap-env in -server, not -runtime

11 years agoPR14524: also document in tapset/DEVGUIDE.
Serguei Makarov [Tue, 28 Aug 2012 14:04:55 +0000 (10:04 -0400)]
PR14524: also document in tapset/DEVGUIDE.

11 years agoPR14524: document /* unmangled */ pragma for embedded-C functions.
Serguei Makarov [Mon, 27 Aug 2012 19:31:08 +0000 (15:31 -0400)]
PR14524: document /* unmangled */ pragma for embedded-C functions.

11 years agoPR14524: test case for per-function legacy mangling pragma
Serguei Makarov [Mon, 27 Aug 2012 19:14:41 +0000 (15:14 -0400)]
PR14524: test case for per-function legacy mangling pragma

11 years agoPR10299 residue: only define STAP_RETVALUE for non-void functions
Serguei Makarov [Mon, 27 Aug 2012 18:52:15 +0000 (14:52 -0400)]
PR10299 residue: only define STAP_RETVALUE for non-void functions

11 years agoPR14524: support old embedded-locals notation on a per-function basis
Serguei Makarov [Mon, 27 Aug 2012 18:13:39 +0000 (14:13 -0400)]
PR14524: support old embedded-locals notation on a per-function basis

Adding the pragma /* unmangled */ to an embedded-C function now enables
the use of the pre-1.8 local names, i.e. THIS->n instead of STAP_ARG_n.
This aids migration of pre-1.8 scripts and tapsets by allowing mixing
two kinds of embedded functions (pre- and post-1.8) in the same code.

11 years agoNEWS: note that stap(dyn) does selinux checks itself now
Frank Ch. Eigler [Thu, 23 Aug 2012 22:36:58 +0000 (18:36 -0400)]
NEWS: note that stap(dyn) does selinux checks itself now

11 years agolangref: Mention 'delete' in the Arrays and Statistics sections
Josh Stone [Wed, 22 Aug 2012 22:41:49 +0000 (15:41 -0700)]
langref: Mention 'delete' in the Arrays and Statistics sections

When reading just the sections on Arrays and Statistics, it was not
apparent that the 'delete' statement is applicable to each.  These
sections now have a mention and back-reference to the delete statement.

Reported-By: Ben Woodard <woodard@redhat.com>
11 years agoDon't require prefix for ia64 rpm.
Stan Cox [Tue, 21 Aug 2012 22:17:11 +0000 (18:17 -0400)]
Don't require prefix for ia64 rpm.

* systemtap.spec (Requires): ia64 does not have prelink.

11 years agoruntime: Use typedef-typeof for safer function pointers
Josh Stone [Tue, 21 Aug 2012 18:46:30 +0000 (11:46 -0700)]
runtime: Use typedef-typeof for safer function pointers

We use kallsyms_lookup_name to access several functions that are
publicly declared but not exported.  We were manually recreating the
call signatures for function pointers though, which is begging for
trouble.  This patch updates all those typedefs to use typeof on the
original function declaration, so we hopefully get compile-time breakage
if the call signature ever changes on us.

11 years agoFixed PR14467 by correcting memory initialization.
David Smith [Tue, 21 Aug 2012 18:19:37 +0000 (13:19 -0500)]
Fixed PR14467 by correcting memory initialization.

* runtime/stp_utrace.c (utrace_task_alloc): Don't try to initialize the
  utrace structure after possibly freeing it.

11 years agosystemtap.spec: Be sensitive to %{?rhel} for publican branding
Frank Ch. Eigler [Tue, 21 Aug 2012 13:50:31 +0000 (09:50 -0400)]
systemtap.spec: Be sensitive to %{?rhel} for publican branding

Manually setting publican_brand to RedHat vs. fedora is too unpleasant.

11 years agostapdyn: Check for cooperative SELinux booleans
Josh Stone [Mon, 20 Aug 2012 21:22:25 +0000 (14:22 -0700)]
stapdyn: Check for cooperative SELinux booleans

We know that deny_ptrace=1 or allow_execstack=0 will prevent Dyninst
from working; with libselinux we can check this beforehand.

* configure.ac: Check for libselinux via pkg-config.
* stapdyn/Makefile.am: Add selinux flags when present.
* [...autoreconf...]
* stapdyn/dynutil.cxx (check_dyninst_sebools): New, validate the
  mentioned SELinux booleans for Dyninst compatibility.
* stapdyn/dynsdt.cxx (main): Call check_dyninst_sebools.
* stapdyn/stapdyn.cxx (main): Ditto.
* systemtap.spec: BuildRequire libselinux-devel for dyninst builds.

11 years agoPR6580: cleanly handle overflow of MAXSTRINGLEN (subject to further testing)
Serguei Makarov [Mon, 20 Aug 2012 18:16:35 +0000 (14:16 -0400)]
PR6580: cleanly handle overflow of MAXSTRINGLEN (subject to further testing)

11 years agoPR6580: notice oops in earlier commit.
Serguei Makarov [Mon, 20 Aug 2012 15:40:46 +0000 (11:40 -0400)]
PR6580: notice oops in earlier commit.

11 years agobuild compatibility: drop unnecessary decl
Frank Ch. Eigler [Mon, 20 Aug 2012 17:11:50 +0000 (13:11 -0400)]
build compatibility: drop unnecessary decl

commit dec33462a left some detritus behind.  Clean that up.

* hash.h (struct hash): Don't forward-declare.

11 years agoPR6580: rewrite simple to-be-deprecated backtrace functions in terms of new ones
Serguei Makarov [Fri, 17 Aug 2012 20:27:44 +0000 (16:27 -0400)]
PR6580: rewrite simple to-be-deprecated backtrace functions in terms of new ones

For now, avoid changing backtrace(), probemod(), or the functions that
depend on not running into MAXSTRINGLEN according to their documentation.

11 years agoPR6580: more missed @unwind_error() renaming.
Serguei Makarov [Fri, 17 Aug 2012 19:18:47 +0000 (15:18 -0400)]
PR6580: more missed @unwind_error() renaming.

11 years agoPR6580: rename @unwind_error() to something more descriptive.
Serguei Makarov [Fri, 17 Aug 2012 19:07:32 +0000 (15:07 -0400)]
PR6580: rename @unwind_error() to something more descriptive.

11 years agoFixed PR14463 by changing error handling of utrace_control().
David Smith [Fri, 17 Aug 2012 18:31:24 +0000 (13:31 -0500)]
Fixed PR14463 by changing error handling of utrace_control().

* runtime/stp_utrace.c (utrace_barrier): Add a 'might_sleep()' call since
  it calls schedule_timeout_interruptible(), which sleeps.
* runtime/linux/task_finder2.c (__stp_utrace_attach): Ignore
  EINPROGRESS errors from utrace_control() when passed UTRACE_STOP, since
  that just means the task hasn't stopped yet.
* runtime/linux/task_finder.c (__stp_utrace_attach_flags): Ditto.

11 years agobuild compatibility: gcc 4.7 with -std=c++11, std::hash collision
Frank Ch. Eigler [Thu, 16 Aug 2012 00:58:59 +0000 (20:58 -0400)]
build compatibility: gcc 4.7 with -std=c++11, std::hash collision

* hash.cxx (struct hash): Rename to stap_hash to avoid conflict with
  std::hash template.
* session.h: Corresponding changes.

Reported-By: Doug Evans <dje@google.com>
11 years agobuild compatibility: gcc 4.7 with -std=c++11
Frank Ch. Eigler [Thu, 16 Aug 2012 00:56:58 +0000 (20:56 -0400)]
build compatibility: gcc 4.7 with -std=c++11

* dwflpp.cxx, tapsets.cxx: On glibc >= 2.7, use scanf %ms instead of %as,
  as the former is more posixly correct.

Reported-By: Doug Evans <dje@google.com>
11 years agoPR11659: Hook into the panic_notifier_list
Chris Meek [Wed, 15 Aug 2012 19:44:55 +0000 (15:44 -0400)]
PR11659: Hook into the panic_notifier_list

This feature lets stap dump the trace buffers to the serial console on a
kernel panic. The basic functionality is there, but it could use some
tweeking including adding a summary report at the end of the dump.
Currently it only works for the relay buffer V2.

11 years agomore typo fix for langref.tex
Serguei Makarov [Wed, 15 Aug 2012 15:37:42 +0000 (11:37 -0400)]
more typo fix for langref.tex

11 years agoPR14313: clarifying message for alias_suffixes.stp example.
Serguei Makarov [Wed, 15 Aug 2012 15:35:00 +0000 (11:35 -0400)]
PR14313: clarifying message for alias_suffixes.stp example.

11 years agoPR14313: rewrite alias suffix example in langref.tex.
Serguei Makarov [Wed, 15 Aug 2012 15:31:59 +0000 (11:31 -0400)]
PR14313: rewrite alias suffix example in langref.tex.

The rewrite avoids possible confusion due to the fact that there is
a syscall.read.return alias defined in the tapset (which changes how
the suffix is resolved in the real code vs. in the example with
only one custom syscall.read alias).

11 years agoFix PR14026 by updating the IP before calling the inode-uprobe handler.
David Smith [Wed, 15 Aug 2012 15:11:12 +0000 (10:11 -0500)]
Fix PR14026 by updating the IP before calling the inode-uprobe handler.

* tapsets.cxx (uprobe_derived_probe_group::emit_module_inode_decls): Fix
  the IP before calling the real probe handler using
  uprobe_get_swbp_addr().
* buildrun.cxx (compile_pass): Added
  STAPCONF_UPROBE_GET_SWBP_ADDR_EXPORTED autoconf.
* runtime/linux/runtime.h: Add kallsyms_uprobe_get_swbp_addr declaration.
* runtime/linux/uprobes-inode.c: Ditto.
* runtime/transport/transport.c (_stp_transport_init): If
  STAPCONF_UPROBE_GET_SWBP_ADDR_EXPORTED isn't defined, use
  kallsyms_lookup_name() to find the address of 'uprbe_get_swbp_addr'.

11 years agoPR6580: implement psyms().
Serguei Makarov [Tue, 14 Aug 2012 19:02:08 +0000 (15:02 -0400)]
PR6580: implement psyms().

11 years agoPR6580 misc oops: put ucontext stuff in ucontext-*!
Serguei Makarov [Tue, 14 Aug 2012 15:51:35 +0000 (11:51 -0400)]
PR6580 misc oops: put ucontext stuff in ucontext-*!

11 years agoImprove PR14463 by avoiding sleeping in the clone handler.
David Smith [Tue, 14 Aug 2012 15:38:14 +0000 (10:38 -0500)]
Improve PR14463 by avoiding sleeping in the clone handler.

* runtime/linux/task_finder2.c (__stp_tf_alloc_task_work): Change
  parameter to a void pointer.
  (__stp_tf_clone_worker): New function.
  (__stp_utrace_task_finder_report_clone): Uses stp_task_work_add() to
  call __stp_tf_clone_worker() when we can safely sleep.

11 years agoPR6580: implement callers(), ucallers().
Serguei Makarov [Tue, 14 Aug 2012 14:32:22 +0000 (10:32 -0400)]
PR6580: implement callers(), ucallers().

11 years agoPR14396: Fix a kernel typo in utf_user_trunc.stp
Josh Stone [Tue, 14 Aug 2012 01:50:24 +0000 (18:50 -0700)]
PR14396: Fix a kernel typo in utf_user_trunc.stp

* testsuite/systemtap.base/utf_user_trunc.stp: s/kernel/user/

11 years agoPR14396: Truncate UTF strings silently
Josh Stone [Tue, 14 Aug 2012 01:32:40 +0000 (18:32 -0700)]
PR14396: Truncate UTF strings silently

The UTF-16 and UTF-32 conversion functions were correctly refusing to
write a partial UTF-8 sequence into the buffer, but they were treating
that case as an error.  It should just silently stop processing, so the
result is truncated just as any other string concatenation does.

* tapset/linux/conversions.stp (kernel_string_utf32): Treat only rc<0
  from _stp_convert_utf32 as an error; rc==0 is truncation.
  (kernel_string_utf16): Ditto.
* tapset/linux/uconversions.stp (user_string_utf32): Ditto.
  (user_string_utf16): Ditto.
* testsuite/systemtap.base/utf_kernel_trunc.*: Test a broad range of
  truncation points within kernel UTF strings.
* testsuite/systemtap.base/utf_user_trunc.*: Same test for userspace.
  (The duplication is unfortunate, but it's not too crazy.)

11 years agostap: Include DYNINST in the enabled feature list
Josh Stone [Mon, 13 Aug 2012 23:00:43 +0000 (16:00 -0700)]
stap: Include DYNINST in the enabled feature list

11 years agoDon't report non-git if we have an extra-version
Josh Stone [Mon, 13 Aug 2012 22:45:23 +0000 (15:45 -0700)]
Don't report non-git if we have an extra-version

When we're not building from git, but we do have --with-extra-version,
just let that suffice in our version strings.  But when we do have a git
repo, still print the fullest information possible.

* version.h: Define STAP_EXTENDED_VERSION with this scheme.
* session.cxx, stapdyn/stapdyn.cxx, staprun/common.c: Use it.

11 years agoPR6580: implement naive stack(), ustack()
Serguei Makarov [Mon, 13 Aug 2012 20:48:15 +0000 (16:48 -0400)]
PR6580: implement naive stack(), ustack()

11 years agoPR14460 ipaddr.exp: all hail bash /dev/tcp
Frank Ch. Eigler [Mon, 13 Aug 2012 00:10:22 +0000 (20:10 -0400)]
PR14460 ipaddr.exp: all hail bash /dev/tcp

Use bash's /dev/tcp/127.0.0.1/8079 and /dev/tcp/::1/8079, which work.

11 years agoPR14460 try 1
Frank Ch. Eigler [Mon, 13 Aug 2012 00:05:46 +0000 (20:05 -0400)]
PR14460 try 1

Switch to tcl's [socket HOST PORT] facilities as a netcat client
substitute.  Except tcl 8.5* doesn't speak ipv6 jive.  Also, switch to
port 8079 for tests, expecting to conflict less with normal ongoings
than good old 8080.

11 years agoPR14396: Add pretty-printing support for UTF
Josh Stone [Sat, 11 Aug 2012 00:46:13 +0000 (17:46 -0700)]
PR14396: Add pretty-printing support for UTF

* dwarf_wrappers.h: Define DW_ATE_UTF if elfutils < 0.155.
* tapsets.cxx (dwarf_pretty_print::recurse_base): Print UTF with %#c
  too. This will generally only work with the ASCII subset for now...
  (dwarf_pretty_print::print_chars): Match strings by char/UTF encoding
  types, rather than by type name, and use the byte_size to select the
  correct string dereferencing function.
* testsuite/systemtap.base/utf_pretty.*: Test it!

This page took 0.067739 seconds and 5 git commands to generate.