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 [...]
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.
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.
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.
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.
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.
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.
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.
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).
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'.
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.
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.)
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.
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.
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!
Josh Stone [Fri, 10 Aug 2012 22:15:29 +0000 (15:15 -0700)]
PR14396: Add UTF-16/32 conversion functions
* runtime/stp_string.c (_stp_convert_utf32): New, write the given
UTF-32 code point as UTF-8 in the given buffer.
* tapset/linux/conversions.stp (kernel_string_utf32): New, read and
convert a UTF-32 string from kernel memory.
(kernel_string_utf16): Same for UTF-16, handling surrogate pairs.
(kernel_string2_utf32, kernel_string2_utf16): Same w/ custom error.
* tapset/linux/uconversions.stp: All of the above for user memory.
* testsuite/buildok/conversions*.stp: Add build tests.
* testsuite/systemtap.base/utf_*: New runtime tests.
Josh Stone [Fri, 10 Aug 2012 21:50:41 +0000 (14:50 -0700)]
loc2c-runtime.h: Add uread() and uwrite()
These are the userspace equivalents to kread() and kwrite().
For the (unused) STAPCONF_PROBE_KERNEL case, just define them as direct
equivalents. Also add in missing kderef and store_kderef the same way.
For the architecture-implemented case, they are nearly identical to
kread and kwrite, just s/kderef/uderef/. So to avoid duplication, I've
added in a layer of macro indirection to pass in the appropriate deref
function. (Nevermind that the [ku]derefs are often identical -- oh,
what a tangled web we weave...)
David Smith [Fri, 10 Aug 2012 13:39:51 +0000 (08:39 -0500)]
Improve task_finder/task_finder2 error handling.
* runtime/linux/task_finder.c (stap_start_task_finder): When we ignore
EPERM or ENOENT errors, be sure to not accidently return the ignored
error.
* runtime/linux/task_finder2.c (stap_start_task_finder): Ditto.
David Smith [Tue, 7 Aug 2012 22:32:01 +0000 (17:32 -0500)]
Fix problems with varargs macros in dyninst/io.c.
* runtime/dyninst/io.c: Convert _stp_warn(), _stp_error(),
_stp_softerror(), and _stp_dbug() from varargs macros into varargs
functions so that calling _stp_warn() (for example) with just a format
argument works correctly.
Josh Stone [Tue, 7 Aug 2012 19:24:18 +0000 (12:24 -0700)]
parse: Fix a -Werror=delete-non-virtual-dtor
CXX stap-parse.o
../parse.cxx: In destructor ‘parser::pp1_activation::~pp1_activation()’:
../parse.cxx:421:16: error: deleting object of polymorphic class type
‘parser::pp_macrodecl’ which has non-virtual destructor might cause
undefined behaviour [-Werror=delete-non-virtual-dtor]
cc1plus: all warnings being treated as errors
We need virtual ~macrodecl to destroy the inherited pp_macrodecl.
Josh Stone [Tue, 7 Aug 2012 00:46:38 +0000 (17:46 -0700)]
stapdyn: Enable map and stat types
There are a lot of kernel-isms in the map code especially, and rather
than try to rewrite all that, I've simply copied the necessary bits from
the kernel. The new pieces are mostly list and hash related.
* runtime/dyninst/alloc.c (_stp_alloc_percpu): Needs to be zeroed.
* runtime/dyninst/runtime.h: Add BITS_PER_LONG and stap_hash_seed.
Also extract various bits copied from the kernel into new files.
* runtime/dyninst/linux_types.h: Reused Linux type definitions.
* runtime/dyninst/linux_defs.h: Other various reused Linux code.
* runtime/dyninst/linux_hash.h: Direct copy of hashing from Linux.
* runtime/dyninst/ilog2.h: Linux's ilog2(), but just for constants.
* runtime/dyninst/probe_lock.h: Typedef rwlock_t on pthreads.
* runtime/map.c: Don't need sym.c, and emulate ALIGN().
* runtime/map.h: Locate ilog2, and fix NEED_MAP_LOCKS check.
Mark Wielaard [Mon, 6 Aug 2012 18:31:20 +0000 (20:31 +0200)]
PR14434 Filter out partial structs/classes.
GCC might generate a struct/class without DW_AT_declaration,
but that only contains members which have DW_AT_declaration
set. We aren't interested in those. PR14434 (GCC bug #54181).
Filter them out with a new function has_only_decl_members in dwflpp.cxx.
Add new testcase testsuite/systemtap.base/partial-class-type.exp.
Josh Stone [Mon, 6 Aug 2012 20:14:00 +0000 (13:14 -0700)]
spec: Don't use %dir for paths that are fully included
We were getting these messages from rpmbuild:
warning: File listed twice: /usr/share/systemtap/runtime
warning: File listed twice: /usr/share/systemtap/tapset
Those two paths included entirely in systemtap-devel, so the %dir
directive is redundant. However, it should claim %{_datadir}/%{name}
which those two are under.
Josh Stone [Sat, 4 Aug 2012 20:40:27 +0000 (13:40 -0700)]
PR14432: Convert stap exit() calls to exceptions
We need the opportunity to clean up after ourselves, for example
removing any temporary directories created. Calling exit() bypasses our
usual exception/RAII-based cleanups, so don't do that.
* session.h (exit_exception): New, an exception with a custom exit code.
* main.cxx (main): We can simply return here. Also catch exit_exception.
* session.cxx (systemtap_session::usage): Throw an exit_exception.
(systemtap_session::parse_cmdline): Ditto.
* util.cxx (assert_regexp_match): A runtime_error makes more sense here.
Josh Stone [Fri, 3 Aug 2012 01:56:54 +0000 (18:56 -0700)]
stapdyn: TODO updates
- Build integration is in good shape, removing
- Runtime is largely done, but some cleanup left (PR14179)
- Breaking up the tapsets is pretty much done (PR14180)
- New: really need a deref() mechanism
- New: need to rework stapdu_target
Josh Stone [Thu, 2 Aug 2012 19:38:27 +0000 (12:38 -0700)]
PR14180: Fix tapset documentation for non-root tapsets
* doc/SystemTap_Tapset_Reference/manpager: Use basenames so we can deal
with tapsets that are from a subdirectory, like tapset/linux/.
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Update !I paths for the
many tapsets that moved in commit d3110553.
* tapset/linux/context.stp: Defer <tapsetdescription> to tapset/context.stp
Serguei Makarov [Thu, 2 Aug 2012 18:04:40 +0000 (14:04 -0400)]
PR11207: search tapset folders for .stpm files.
Gathers a list of .stpm (library) files on the tapset search
path. In this patch, an index of the paths is gathered in
session.library_macro_paths, but the list is not made use of by the
preprocessor.