Dave Brolley [Mon, 14 Jun 2010 19:19:43 +0000 (15:19 -0400)]
Reword compile server client merge into stap based on feedback received:
- Move server related utility methods out of systemtap_session
- Move other utility methods back out of systemtap_session and back
into the top level of main.cxx
- Move pending_interrupts out of systemtap_session and back to top level.
- Initialize systemtap_session in the constructor
- Move server argument collection out of main options switch.
Dave Brolley [Tue, 1 Jun 2010 18:51:53 +0000 (14:51 -0400)]
Merged compile server client: Basic implementation.
o client automatically detects compatible online servers
o request package created, zipped and sent to the server
o response unzipped and processed
o staprun called, if requsted
o command line options filtered and passed to the server in the request package
o --unprivileged is handled
Dave Brolley [Fri, 21 May 2010 19:52:32 +0000 (15:52 -0400)]
More compile server client merge infrastructure:
- Make phase management functions methods of systemtap_session
- Make phase management globals static members of systemtap_session
- Create skeletal compile_server_client class
Dave Brolley [Fri, 21 May 2010 18:09:26 +0000 (14:09 -0400)]
Begin compile server client merge into stap:
- Detect presence of avahi-client library and headers during configuration
- Use avahi-client API to detect online servers
- Implement --server-status=online,compatible
Mark Wielaard [Tue, 29 Jun 2010 10:02:48 +0000 (12:02 +0200)]
Merge _stp_vma_module_name functionality into _stp_umod_lookup.
This also includes the fix for 32bit signed values in 64bit longs issue
which was missing from _stp_umod_lookup. Better to have the lookup and
fix/workaround all in one place.
* runtime/vma.c (_stp_vma_module_name): Removed.
* runtime/sym.c (_stp_umod_lookup): Include module name lookup.
(_stp_kallsyms_lookup): Get name directly when available throug umodule.
* runtime/unwind.c (unwind): Adjust _stp_umod_lookup call.
* tapset/ucontext.stp (umodname): Use _stp_umod_lookup.
Mark Wielaard [Mon, 28 Jun 2010 20:21:23 +0000 (22:21 +0200)]
Match user space modules on actual path and set name to basename.
Matching on actual canonical path is more accurate. Having basename is
better for module in backtraces.
* translate.cxx (dump_unwindsyms): Grab basename from canonical path for
user space modules.
* dwflpp.cxx (dwflpp::emit_address): Call _stp_umodule_relocate with
canonical path.
* runtime/sym.c (_stp_umodule_relocate): Match on path, not name.
David Smith [Mon, 28 Jun 2010 19:30:33 +0000 (14:30 -0500)]
Fixed PR11762 by making the systemtap.base/flightrec*.exp tests more robust.
* testsuite/systemtap.base/flightrec1.exp: Make sure old test results are
removed when starting. Be sure to close spawned processes properly.
When sending stapio a signal, sleep 2 seconds to let everything settle
out.
* testsuite/systemtap.base/flightrec2.exp: Ditto.
* testsuite/systemtap.base/flightrec3.exp: Ditto.
* testsuite/systemtap.base/flightrec4.exp: Ditto.
* testsuite/systemtap.base/flightrec5.exp: Ditto.
Mark Wielaard [Mon, 28 Jun 2010 14:14:29 +0000 (16:14 +0200)]
Fold space/newline/brief/inexact logic into _stp_func_print flags.
Trying to get all the logic of how symbols/addresses in backtraces are
printed into one place. So that passing through the flags tell the whole
story, instead of decissions being spread out all over the place. This
does mean one hairy _stp_print_func() function unfortunately. But at least
there is now one place to tweak when adding stack/symbol output changes.
* runtime/runtime.h: Remove SYM_VERBOSE_NO, _FULL, _BRIEF.
* runtime/sym.h: Add _STP_SYM_ flags.
* runtime/sym.c (_stp_func_print): Base output on individual _STP_SYM_ flags.
* runtime/stack.c (print_stack_address): Use _STP_SYM_INEXACT.
(_stp_stack_print): Check and use _STP_SYM_ flags.
* runtime/stack-i386.c (_stp_stack_print_fallback): Use _STP_SYM_INEXACT.
* runtime/stack-x86_64.c (_stp_stack_print_fallback): Likewise.
* tapset/context-unwind.stp (print_backtrace): Pass _STP_SYM_FULL.
* tapset/ucontext-unwind.stp (print_ubacktrace): Likewise.
(print_ubacktrace_brief): Pass _STP_SYM_BRIEF.
Mark Wielaard [Sun, 27 Jun 2010 19:30:53 +0000 (21:30 +0200)]
Don't resolve symbols unnecessarily and don't suppress things from backtrace.
We were always doing symbol lookups of addresses in a backtrace, even when
the user only wanted the addresses. If we couldn't find an symbol associated
with an address in the backtrace we just tried again and reported the next
address/symbol we could find. It really is better to always report all
addresses we think are part of a backtrace. It is more efficient, and more
truthful.
* runtime/sym.c (_stp_func_print): Don't report whether name lookup
succeeded. Only lookup symbol names when requested.
* runtime/stack-x86_64.c (_stp_stack_print_fallback): Report all addresses
found.
* runtime/stack-i386.c (_stp_stack_print_fallback): Likewise.
(__stp_stack_print): Mark frame based addresses as inexact.
Mark Wielaard [Sun, 27 Jun 2010 12:18:33 +0000 (14:18 +0200)]
Split _stp_module_relocate into kernel and user space lookup functions.
Simplify relocation logic by splitting kernel and user space module lookups.
* runtime/sym.h (_stp_module_relocate): Split into ...
(_stp_kmodule_relocate): ... this for kernel module lookups and ...
(_stp_umodule_relocate): ... this for user space lookups.
* runtime/sym.c: Likewise.
(_stp_module_check): Use _stp_kmodule_relocate.
* dwflpp.cxx (dwflpp::emit_address): Use _stp_kmodule_relocate or
_stp_umodule_relocate as appropriate.
* tapsets.cxx (dwarf_derived_probe_group::emit_module_init): Use
_stp_kmodule_relocate for kprobes.
David Smith [Fri, 25 Jun 2010 16:32:02 +0000 (11:32 -0500)]
Added kprocess.stp testcases.
* testsuite/buildok/kprocess-all-probes.stp: Renamed from
process-all-probes.stp and uses wildcards.
* testsuite/buildok/kprocess-detailed.stp: New testcase.
* testsuite/buildok/kprocess-embedded.stp: Ditto.
Mark Wielaard [Fri, 25 Jun 2010 14:04:12 +0000 (16:04 +0200)]
Rename _stp_stack_snprint to _stp_stack_hexstring.
_stp_stack_snprint() was only used to get the hex string of a backtrace.
So rename it to make that clear and simplify it by not calling through
the full _stp_stack_print(). Simplify _stp_stack_print() a bit since it
now doesn't need to handle "hex string only" backtraces.
* runtime/stack.c (_stp_stack_print): Just handle the SYM_VERBOSE_FULL
and SYM_VERBOSE_BRIEF cases. SYM_VERBOSE_NONE isn't supported directly
anymore.
(_stp_stack_snprint): Rename to ...
(_stp_stack_hexstring): ... this. Remove now unused verbose argument.
Just handle hexstring backtrace only, call through to __stp_stack_print.
* tapset/context-unwind.stp (print_backtrace): Explicitly use
SYM_VERBOSE_FULL.
(backtrace): Use _stp_stack_hexstring().
* tapset/ucontext-unwind.stp (ubacktrace): Likewise.
Mark Wielaard [Fri, 25 Jun 2010 10:00:42 +0000 (12:00 +0200)]
Combine _stp_symbol_print and _stp_usymbol_print into _stp_print_symbol.
These functions did exactly the same, except the usymbol one took a
task_struct. Combine them and use task_struct being NULL as indicator
for wanting kernel/module symbols.
* runtime/sym.c (_stp_symbol_print): Combine with...
(_stp_usymbol_print): ... this into ...
(_stp_print_symbol): combined function.
* tapset/context-symbols.stp (print_stack): Call _stp_print_symbol with NULL.
* tapset/ucontext-symbols.stp (print_ustack): Call _stp_print_symbol with tsk.
* runtime/stack.c (_stp_stack_print): Use _stp_print_symbol.
(_stp_stack_print_tsk): Likewise.
* runtime/stack-arm.c (__stp_stack_print): Likewise.
* runtime/stack-ia64.c (__stp_show_stack_sym): Likewise.
* runtime/stack-ppc.c (__stp_stack_print): Likewise.
* runtime/stack-s390.c (__stp_show_stack): Likewise.
Mark Wielaard [Thu, 24 Jun 2010 16:19:35 +0000 (18:19 +0200)]
Split _stp_mod_sec_lookup into _stp_kmod_sec_lookup and _stp_umod_lookup.
* runtime/sym.c (_stp_mod_sec_lookup): Split into...
(_stp_kmod_sec_lookup): ... for kernel/module lookup and ...
(_stp_umod_lookup): For user space/vma lookup.
(_stp_kallsyms_lookup): Use either of the above and calculate rel_addr.
* runtime/unwind.c (unwind): Call either _stp_umod_lookup or
_stp_kmod_sec_lookup.
* tapset/context-symbols.stp (probemod): Use _stp_kmod_sec_lookup.
(modname): Likewise.
Josh Stone [Wed, 23 Jun 2010 21:28:16 +0000 (14:28 -0700)]
PR10830 cont'd: Rename pp1() -> pn() and isolate it
The new name is "pn" to evoke "probe name". It is also now isolated in
its own tapset file, so it's less likely to be pulled into and conflict
with a user's script accidentally.
No real code changes here -- it's roughly just s/pp1/pn/ and
s/probe_point_listing/probe_name/.
Mark Wielaard [Wed, 23 Jun 2010 19:47:53 +0000 (21:47 +0200)]
Correct testing for compat task. Always use our own test.
is_compat_task(), when defined in the kernel, is really just for testing
whether or not we are in a 32-compat syscall. It does not definitely tell
us whether or not the current task is a 32bit compat task. So always use
our own test_thread_flag() with the arch specific TIF_flag.
* runtime/autoconf-is-compat-task.c: Removed.
* buildrun.cxx (compile_pass): Remove is-compat-task check.
* runtime/compatdefs.h: Detect s390 specific TIF flag. Always define
_stp_is_compat_task() when CONFIG_COMPAT defined.
* tapset/conversions.stp (user_long): Use _stp_is_compat_task().
(user_long_warn): Likewise.
Mark Wielaard [Wed, 23 Jun 2010 19:07:33 +0000 (21:07 +0200)]
Better split kernel/user space address symbol lookups.
* runtime/sym.c (_stp_mod_sec_lookup): Don't fall through to kernel module
address search when we know to be looking for a user space module/vma.
* tapset/context-symbols.stp (probefunc): Clarify documentation.
Use user_mode(CONTEXT->regs) check. Pass NULL for task to
_stp_symbol_snprint().
(probemod): Clarify documentation. Pass NULL for task to
_stp_mod_sec_lookup().
(modname): Likewise.
(symname): Clarify documentation.
(symdata): Likewise.
David Smith [Wed, 23 Jun 2010 16:39:05 +0000 (11:39 -0500)]
Fixed PR11725 by adding big-endian support to systemtap.printf/bin6.exp.
* testsuite/systemtap.printf/bin6.exp: Added a big-endian result string
and code to pick the correct result string bassed on the system running
the test.
Josh Stone [Wed, 23 Jun 2010 00:44:35 +0000 (17:44 -0700)]
PR10830: Add pp1() for the high-level probe name
This is a new function which should return the same high-level name that
"stap -l" gives. (e.g. syscall.open instead of kernel.function...)
* translate.cxx (c_unparser::emit_common_header): Add probe_point_listing.
(translate_pass): Add pp1 to stap_probe, predicated on
STP_NEED_PROBE_POINT_LISTING so we don't waste space.
* tapsets.cxx (common_probe_init): Set pp1 to script_location().
(common_probe_entryfn_prologue): Write pp1 to the CONTEXT.
* tapset-timers.cxx (profile_derived_probe_group::emit_module_decls):
Fixup CONTEXT->probe_point_listing, since it loops individual probes
manually.
* tapset/context.stp (pp1): New, expose the location to scripts.
* testsuite/buildok/context-embedded.stp: Build pp1().
* testsuite/systemtap.base/pp.{exp,stp}: Test the difference between
pp() and pp1().
Josh Stone [Wed, 23 Jun 2010 00:02:37 +0000 (17:02 -0700)]
Factor out common probe elements
The probes in every tapset type all have a handler (ph) and a
probe_point (pp), which are initialized and used in exactly the same
way. Let's bring that out into a common stap_probe struct.
This will also ease new fields, e.g. for PR10830.
* translate.cxx (translate_pass): Define struct stap_probe, also making
the decision of whether pp is better as char* or char[].
* tapsets.cxx (common_probe_init): Initialize a runtime stap_probe from
any translator derived_probe.
(common_probe_entryfn_prologue): Take a stap_probe instead of pp.
* tapset*.cxx: Adjust all tapsets to use the features above.
Josh Stone [Tue, 22 Jun 2010 20:01:10 +0000 (13:01 -0700)]
Add a function for getting a probe's script location
* elaborate.cxx (derived_probe::script_location): New, factor out the
code for grabbing the "friendly" location of a probe, as specified in
the script.
* main.cxx (printscript): Use it.
Josh Stone [Tue, 22 Jun 2010 18:42:30 +0000 (11:42 -0700)]
Make probe::almost_basest() work
* staptree.h (probe::almost_basest): Probes are the basest, not almost.
* elaborate.h (derived_probe::almost_basest): If base says 0, then the
almost_basest is this one.
* main.cxx (printscript): Use p->almost_basest() instead of collecting
the entire derivation chain.
Stan Cox [Tue, 22 Jun 2010 16:37:43 +0000 (12:37 -0400)]
Handle $N numeric literal for -DSTAP_SDT_V2 probe asm arg descriptor.
sdt.h (__stap_argN): Switch gcc asm constraint from "ro" to "ron" to allow $N
tapsets.cxx (sdt_uprobe_var_expanding_visitor::visit_target_symbol):
Add literal_arg to support $N.
Mark Wielaard [Tue, 22 Jun 2010 13:53:47 +0000 (15:53 +0200)]
PR11722 Handle signed "addresses" from 32-on-64 user processes.
A systemtap long is signed, and so can contain a "negative" address.
Make sure to "chop off" the signedness when processing these longs
for 32-on-64 bit user tasks.
* runtime/compatdefs.h: Always (redifine) TIF_32BIT.
* runtime/sym.c (_stp_kallsyms_lookup): Detect long used as 32bit address.
* runtime/vma.c (_stp_vma_module_name): Likewise.
Lukas Berk [Mon, 21 Jun 2010 20:25:44 +0000 (16:25 -0400)]
Addressing bug 11706 "unautoconfiscation of most stap*.in manual
pages. autoconfiguration paths were moved to a new stappaths (7)
manual page while the other manual pages were changed to refer
to stappaths (7) in case of a dynamic path. Tested using a fresh
install with a set --prefix during configuration and evn MANPATHS to
match the given $prefix.
Lukas Berk [Mon, 21 Jun 2010 19:53:56 +0000 (15:53 -0400)]
Addressing bug 11706 "unautoconfiscation of most stap*.in manual pages".
Autoconfiguration paths were moved to a new stappaths (7) manual page,
while the other manual pages were changed to refer to stappaths(7) in
case of dynamic paths. Tested using a fresh install with a set --prefix
during configuration and evn MANPATHS to match the given $prefix.
Lukas Berk [Mon, 21 Jun 2010 19:48:52 +0000 (15:48 -0400)]
Addressing bug 11706 unautoconfiscation of most stap*.in manual pages
autoconfiguration paths were moved to a new stappaths (7) manual page
while the other manual pages were changed to refer to stappaths (7)
in case of a dynamic path. Tested using a fresh install with a
set --prefix during configuration and evn MANPATHS to match the given
$prefix.
David Smith [Mon, 21 Jun 2010 15:09:58 +0000 (10:09 -0500)]
Large update to kprobes test scripts.
* scripts/kprobes_test/kprobes_test.py: Python script to replace old
expect scripts.
* scripts/kprobes_test/whitelist.exp: Removed old expect script.
* scripts/kprobes_test/whitelist_lib.exp: Ditto.
* scripts/kprobes_test/gen_code.py: Changed so that could be included by
another python module, or directly executed.
* scripts/kprobes_test/is_probed.py: Ditto.
* scripts/kprobes_test/run_module.py: Ditto.
* scripts/kprobes_test/config_opts.py: Commented config options.
* scripts/kprobes_test/default.cfg: Commented out ltp tests that require a
server.
* scripts/kprobes_test/.gitignore: Updated.
Mark Wielaard [Mon, 21 Jun 2010 11:57:16 +0000 (13:57 +0200)]
Rework usymbols.exp to create arch specific executables and library names.
This makes it more clear what setup is specifically tested. But it also
seems to work around a bug where systemtap apparently picks up the wrong
copy (cached?) of similarly named executables/shared libraries. PR11735.
* testsuite/systemtap.context/usymbols.exp: Make testexename/testlibname
derived from arch under test.
Mark Wielaard [Mon, 21 Jun 2010 09:40:38 +0000 (11:40 +0200)]
usymbols.exp set maintestflags and testlibflags correctly for compat (-m32).
Testcase now really compiles both for default and compat (-m32) arches for
platforms that support it. This makes the 32-on-64 x86_64 fail similarly
to the ppc case (user_long fetches a kernel long, not the user space long).
* testsuite/systemtap.context/usymbols.exp: Set maintestflags and
testlibflags not just testflags.
David Smith [Fri, 18 Jun 2010 20:13:17 +0000 (15:13 -0500)]
Fixed PR11719 by fixing cmd_parse.exp for ppc.
* testsuite/systemtap.base/cmd_parse.exp: Mapped 'ppc64' to 'powerpc' (and
similar changes form s390x and i686) because that is the internal kernel
architecture.
Frank Ch. Eigler [Wed, 16 Jun 2010 21:03:01 +0000 (17:03 -0400)]
PR11553: better error messages for .return probes on inlined functions
* tapsets.cxx (dwarf_query): Add inlined_non_returnable field.
(query_dwarf_funct): Add to it as appropriate.
(dwarf_builder::build): Report on it as appropriate, function
of verbosity, match-count, warning-suppression. Yey.
(query_inline_instance_info): Assert !has_return.
David Smith [Wed, 16 Jun 2010 14:18:02 +0000 (09:18 -0500)]
Fixed PR11710 so that nd_syscall probes work on s390x systems.
* tapset/s390/registers.stp (_stp_arg): Fixed logic error. The last case
was missing an "if", which caused all _stp_arg() calls to only return
the value of r6.