Jonathan Lebon [Mon, 26 Aug 2013 16:20:24 +0000 (12:20 -0400)]
stapsh: tweak error msgs
Make error messages more consistent with the rest of SystemTap (i.e.
capitalize the first word). Also, make die() respect host_connected()
and print out strerror().
Jonathan Lebon [Mon, 26 Aug 2013 16:01:19 +0000 (12:01 -0400)]
remote.cxx: use data option for unix
This commit actually enables the use of the new "data" option added in
commit 145fb2f. This is done by using a mini state machine. For now,
only the unix scheme uses this option. However, the upcoming libvirt
scheme will also make use of it.
The prefixing logic has also been revised. Now, cout is always flushed
so that e.g. printf("hello1\nhello2") will not only print out "hello1"
until ^C is done on stap. (This was most likely due to line-buffering).
Additionally, prefixing is now only done when necessary rather than
everytime (e.g. 'timer.s(1) { printf("hello") }' would add a prefix
before every 'hello').
Finally, prefixing now also accounts for multiple remotes, i.e. a new
line is automatically added and prefixed if data from a different remote
from the last was received.
- remote.cxx: add support for data commands and improve prefixing
- util.cxx: new split_lines() function
- util.h: split_lines() defn and new vector_has function
Jonathan Lebon [Mon, 26 Aug 2013 15:50:09 +0000 (11:50 -0400)]
stapsh: add data option
The data option causes stapsh to first send a "data" line before every
output from staprun. This has the key benefit of allowing us to
distinguish between stdout and stderr for schemes where the two are
mixed, such as unix and libvirt (upcoming in a future commit).
Jonathan Lebon [Mon, 26 Aug 2013 15:39:21 +0000 (11:39 -0400)]
stapsh: add option command
The new option command allows stap to change the behaviour of stapsh
depending on the scheme used. For now, only "verbose" is a valid option.
This is especially useful for the unix scheme, where we connect to an
already running instance of stapsh. Options are sent to stapsh right
after a successful handshake.
- remote.cxx: send options after successful handshake
- staprun/stapsh.c: add option command and verbose option
Jonathan Lebon [Fri, 16 Aug 2013 17:58:54 +0000 (13:58 -0400)]
stapsh-unix.exp: give time for socat to get set up
I've observed a few failures of this test in which stap gives the "No
such file or directory" error on connect() even though socat was started
properly. This happens the first time the test is run, but not
subsequent times. My theory is that socat takes some time to be loaded
and set up on the first run.
Looking at past testsuite results seem to indicate that this test failed
frequently, so this may have been a long-standing issue. Either way,
this small wait seems to do the trick.
Jonathan Lebon [Tue, 30 Jul 2013 14:08:48 +0000 (10:08 -0400)]
man/stap.1: small correction
This correction might be useful for those who want to parse the output.
Also add a small comment in stapsh.c to clarify the STAPSH_MAX_ARGS
comparison.
Frank Ch. Eigler [Sat, 12 Oct 2013 20:16:34 +0000 (16:16 -0400)]
PR9822: reduce timer load
Until this very moment, runtime/time.c's tsc-polling timer (the one
related to __stp_time_timer_callback) was being invoked every jiffy,
ie. something like 1000Hz, just to tune our per-cpu estimates of
tsc/real-time. This is excessive. Instead, use a much longer
interval (10Hz), and an even larger yet if cpufreq-change-notification
is in effect (0.1Hz).
* runtime/time.c (STP_TIME_SYNC_INTERVAL): New overrideable macro.
(__stp_init_time, __stp_time_timer_callback): Use it.
(__stp_time_cpufreq_callback): Refresh base_ns/base_cycles.
Josh Stone [Sat, 5 Oct 2013 00:12:04 +0000 (17:12 -0700)]
Fix minor errors found by clang analyzer
* dwflpp.cxx (dwflpp::iterate_over_plt): A bad plt_shdr pointer could be
dereferenced later in the function.
* mdfour.c (m): This static global pointer was retaining stack memory.
It's not needed at all - just pass an additional parameter as needed.
* stapregex-tree.cxx (range_union): In a twisted situation where old_b
is NULL, and old_a is valid but empty, then old_b was dereferenced.
This logic now stops trying to shortcut the empty case. Also, the
segment merging now uses std::merge, instead of doing it manually.
* staprun/stap_merge.c (main): Initialize num[];
* tapset-been.cxx (be_builder::build): Simplify 'priority' init;
* tapsets.cxx (dwarf_builder::build): Assert dw is always set.
* util.cxx (stap_spawn): Don't leave an unused 'cmd' local when SDT is
not enabled.
David Smith [Mon, 30 Sep 2013 15:12:47 +0000 (10:12 -0500)]
Fix PR15982 by making 'process.end' probes work reliably.
* runtime/linux/task_finder.c: Swith from using UTRACE_DEATH events to
using UTRACE_EXIT events, to avoid missing 'process.end' probes.
* tapset-utrace.cxx (utrace_derived_probe_group::emit_linux_probe_decl):
For CONFIG_UTRACE, use UTRACE_EXIT events instead of UTRACE_DEATH
events.
* testsuite/systemtap.base/proc_exec.exp: Tweak expected output.
Vincent Bernat [Sat, 28 Sep 2013 16:50:26 +0000 (18:50 +0200)]
PR15123: when PR15123_ASSUME_MFENTRY is set, don't check for -mfentry flag
-mfentry flag is recorded in `DW_AT_producer` only if
`CFLAGS=-grecord-gcc-switches` was used at compilation-time. We
provide PR15123_ASSUME_MFENTRY as an environment variable to override
this detection. The user is expected to set this variable only if it
is confident that that CFLAGS=-mfentry was used.
William Cohen [Fri, 27 Sep 2013 18:49:44 +0000 (14:49 -0400)]
Basic SystemTap support for aarch64
The SystemTap runtime libraries needs a number of machine specific
details for each architecture to be specified. This is an attempt to
provide the minimal set of them so that a "hello, world" SystemTap
script will compile.
Josh Stone [Thu, 26 Sep 2013 21:35:00 +0000 (14:35 -0700)]
testsuite: New sdt_casm for STAP_PROBE_ASM
An attempted fix for PR13974 had broken STAP_PROBE_ASM, because in that
case there's some ambiguity whether %note and %progbits should be
%%-escaped. We can't determine that in general, because it depends on
whether the user's asm() has operands. That fix was thus reverted, and
we're testing to make sure STAP_PROBE_ASM doesn't regress again.
We broke glibc's build on rawhide due to the way they use SDT_PROBE_ASM.
There's really no way to correctly use %note in that scenario, where we
can't know if there's operand parsing or not.
William Cohen [Thu, 1 Jan 1970 00:19:29 +0000 (00:00 -0019)]
Add am64 support
The "uname -m" reports arm64 as aarch64. Some translation is needed to
convert the name to the proper arch name so the appropriate Makefile
can be found. Also need to report the arch as a 64-bit architecture.
David Smith [Tue, 24 Sep 2013 16:20:22 +0000 (11:20 -0500)]
Define vzalloc() and vzalloc_node() for systems without them.
* buildrun.cxx (compile_pass): Add 'exportconf' tests for vzalloc() and
vzalloc_node().
* runtime/linux/alloc.c: Use STAPCONF_VZALLOC and STAPCONF_VZALLOC_NODE to
know if we need private versions of vzalloc() and vzalloc_node().
Josh Stone [Fri, 20 Sep 2013 23:57:27 +0000 (16:57 -0700)]
Fixes for CC=clang CXX=clang++
We can compile almost everything with clang now, except:
- loc2c.c due to nested functions.
- stapdyn/ because dyninst pulls in __gnu_cxx::hash_map for GNUC < 4.3,
which triggers -Wdeprecated in libstdc++-4.8.1.
(clang #defines itself as GNUC 4.2.1.)
* loc2c-test.c (fail): Indicate that this is itself a formatted
function, so it doesn't complain about non-const 'fmt' passed to
vfprintf. (The callers are in fact passing const strings.)
* session.cxx (systemtap_session::parse_cmdline): Added braces so
that the if-for-if-else doesn't have a dangling else.
* stapregex-dfa.h: translator_output is a class.
* stapregex.h: translator_output is a class; dfa is a struct.
* tapset-method.cxx (java_builder): Remove unused cache_initialized.
Josh Stone [Fri, 20 Sep 2013 23:08:28 +0000 (16:08 -0700)]
testsuite: split std_asm out of std_misc.exp
The asm part of sdt_misc.exp was not really dependent on any other part
of that testcase, so we can let it stand alone for direct testing. Its
reported name in test results is left as "sdt_misc", so it can still be
easily compared to previous test runs.
Josh Stone [Fri, 20 Sep 2013 23:00:44 +0000 (16:00 -0700)]
SDT: Use %foo for section types rather than "foo"
GAS can take section types as "foo", @foo, or %foo. We had the quoted
form, but this is not documented, and llvm-mc doesn't support it. Using
@foo starts a comment on ARM, so we're left with %foo.
For note, we have to escape it to %%note for the asm()'s operand
expansion, but leave it as %note for pure assembly. For progbits, there
are no operands, so it's %progbits either way.
Thanks to Martin C. Martin for first reporting this to LLVM[1], and then
returning to systemtap with a suggested compatibility fix.
[1] http://llvm.org/bugs/show_bug.cgi?id=17270
William Cohen [Thu, 19 Sep 2013 20:56:00 +0000 (16:56 -0400)]
Fix up testsuite/Makefile.am RUNTEST variable
The '"'s in the definition of RUNTEST in testsuite/Makefile.am was
making causing the test for DEJAGNU to fail. There didn't seem to be
a reason to keep the quotes around, so they were removed and "make
installcheck" works again.
William Cohen [Wed, 18 Sep 2013 17:25:29 +0000 (13:25 -0400)]
Correct systemtap.spec to match support currently available on aarch64
The aarch64 does not have dyninst, crash, or publican available. Thus,
the systmetap.spec file needs to turn those off those features
to allow systemtap to build on aarch64.
William Cohen [Thu, 19 Sep 2013 18:25:20 +0000 (14:25 -0400)]
Update gettext related material
The autoreconf command did not update the po/Makefile.in file. Needed
to update files files with a "gettext -f" so there is no complaint
about version mismatch for gettext.
William Cohen [Thu, 19 Sep 2013 15:39:17 +0000 (11:39 -0400)]
Update autoconf related files to support aarch64
The config.sub and config.guess were generated with an older version
of autoconf that did not know about aarch64 (64-bit ARM). Updated the
various files to support the aarch64 by running the following command:
Dave Brolley [Wed, 18 Sep 2013 15:17:05 +0000 (11:17 -0400)]
RHBZ 874205 [FJ6.2 Bug] Handle avahi-deamon restart gracefully in stap-serverd.
stap-serverd was crashing when the avahi-daemon was restarted. There was
some inproper use of the avahi-client API which casued this.
avahi_threaded_poll_stop() was being called from within the client callback
function.
Some reading of the API docs revelaed that, in this situation, the old
client should be freed and a new one created in order to transition
to the new daemon if/when it is started.
Also noticed a potential double free of objects associated with the client
when freeing the client. Freeing the client also frees the associated objects,
so it is not necessary, and potentially wrong, to free them ourselves before
freeing the client.
David Smith [Wed, 18 Sep 2013 14:44:13 +0000 (09:44 -0500)]
Avoid module compilation problems by unsetting the environment variable 'ARCH'.
* testsuite/lib/systemtap.exp (setup_systemtap_environment): Make sure the
environment variable 'ARCH' isn't set. If it is, it can cause custom
module building to fail.
David Smith [Mon, 16 Sep 2013 20:39:23 +0000 (15:39 -0500)]
PR15731 update: Fix 'syscall.{execve,compat_execve}' for older kernels.
* tapset/linux/syscalls.stp (syscall.execve): On kernels < 3.7, go back to
using 'do_execve', since sys_execve was in arch-specific code and had
varying arguments.
(syscall.compat_execve): Ditto.
* tapset/linux/nd_syscalls.stp: Ditto.
Lukas Berk [Fri, 13 Sep 2013 19:27:45 +0000 (15:27 -0400)]
Properly check and use minidebuginfo
dwflpp.cxx: add bool has_gnu_debuginfo() to check if section exists
dwflpp.h: declare bool has_gnu_debuginfo()
tapsets.cxx: check for .gnu_debuginfo as condition to query_module_symtab
and listing functions in a process
minidebuginfo.stp: correct the binary to probe
Stan Cox [Thu, 12 Sep 2013 19:44:19 +0000 (15:44 -0400)]
Bump python source releases.
* testsuite/systemtap.apps/python.exp: Bump python2release and python3release.
* testsuite/systemtap.apps/python2.stp: Check dict value before trying to
cast it.
Dave Brolley [Thu, 12 Sep 2013 17:30:25 +0000 (13:30 -0400)]
client.exp: Make sure spawned stap finishes.
Test cases should ensure that all spawned processes are
sufficiently complete before the expect {} block for that
test exits. This prevents any subsequent 'close' statement
from generating a SIGHUP and possibly interrupting the spawned
process.
William Cohen [Wed, 11 Sep 2013 21:18:29 +0000 (17:18 -0400)]
Parse additional SDT ARM arguments variations
When running qemu_count.stp example on arm a there were a number of
cases where systemtap could not parse the location of the marker
arguments for the qemu-system-arm.stp tapset. There were two cases
that were not handled in the code:
- Use of r10 in the argument location information
- Locations with zero offsets that omit the ", #0"
David Smith [Mon, 9 Sep 2013 20:03:31 +0000 (15:03 -0500)]
Make user_string_n_quoted.exp more robust.
* testsuite/systemtap.string/user_string_n_quoted.exp: Several small
changes. If we're not doing install testing, mark the test as
untested. Increase the timeout value, in case we're operating with a
cold cache. If we timeout, try to kill stap. Properly call "close" and
"wait" after "spawn" call.
* testsuite/systemtap.string/user_string_n_quoted.stp: Change
'nd_syscall.write' to 'syscall.write', since the 'syscall' variant has
more support.
Lukas Berk [Fri, 6 Sep 2013 17:41:39 +0000 (13:41 -0400)]
Fix minidebuginfo.exp testcase
The minidebuginfo testcase was based off of an incomplete documenation. We need
to properly fix the creation of the executable to test in a standalone instance.
create-minidebug.sh - properly create standalone testcase, this includes
removing all symbol, relocation and .debug_* sections.
Tweak naming of files with binary. prefix for easier
tracking
minidebuginfo.exp - updated file names to target and cleanup
David Smith [Fri, 30 Aug 2013 18:51:42 +0000 (13:51 -0500)]
Improve the 'num_args' subtest of systemtap.context/context.exp.
* testsuite/systemtap.context/num_args.stp: Improve s390 support by
looking in r2 for the first argument.
* testsuite/systemtap.context/num_args.tcl: Fail if we don't get the
proper string function arguments (instead of silently ignoring the
error).
David Smith [Fri, 30 Aug 2013 16:12:34 +0000 (11:12 -0500)]
Skip the 'utf' tests if we don't have uprobes.
* testsuite/systemtap.base/utf_pretty.exp: Don't run test if we're not
doing install testing or if we don't have uprobes.
* testsuite/systemtap.base/utf_user.exp: Ditto.
* testsuite/systemtap.base/utf_user_trunc.exp: Ditto.
David Smith [Fri, 30 Aug 2013 14:55:52 +0000 (09:55 -0500)]
Improve skipping perf probe tests on unsupported systems.
* testsuite/lib/systemtap.exp (perf_probes_p): New function.
* testsuite/systemtap.stress/conversions.exp: Use new 'perf_probes_p'
function instead of an explicit test.
* testsuite/systemtap.base/perf.exp: If we don't have perf probes, mark
test as untested.
* testsuite/systemtap.base/pt_user_mode.exp: Skip test if we're not doing
an install test. We don't need to check for perf probe support.
* testsuite/systemtap.examples/profiling/perf.tcl: Skip the example if we
don't have perf probes or uprobes.
David Smith [Fri, 30 Aug 2013 13:43:25 +0000 (08:43 -0500)]
Fix minidebuginfo.exp testcase problems.
* testsuite/systemtap.base/minidebuginfo.exp: If the tested system doesn't
have uprobes, mark as untested.
* testsuite/systemtap.base/create-minidebug.sh: Change "/usr/bin/bash" to
"/bin/bash", so older systems can run the script.
David Smith [Thu, 29 Aug 2013 21:28:27 +0000 (16:28 -0500)]
Make systemtap.examples/check.exp look for an example's optional tcl file.
* testsuite/systemtap.examples/check.exp: If the example has an associated
tcl file, run it.
* testsuite/systemtap.examples/README: Mention new tcl file that can be
optionally associated with an example.
* testsuite/systemtap.examples/stapgames/pingpong.meta: Add a
'test_support' tag.
* testsuite/systemtap.examples/virtualization/kvm_service_time.meta: Make
the 'test_support' tag more specific.
* testsuite/systemtap.examples/process/auditbt.tcl: Skip the example if we
don't have uprobes.
* testsuite/systemtap.examples/process/mutex-contention.tcl: Ditto.
* testsuite/systemtap.examples/process/threadstacks.tcl: Ditto.
* testsuite/systemtap.examples/profiling/pf4.tcl: Ditto.
* testsuite/systemtap.examples/process/ltrace.tcl: Skip the example if we
don't have .plt probes.
* testsuite/systemtap.examples/interrupt/scf.tcl: Skip the example if
we're on ia64, which has no dwarf unwinding support.
* testsuite/systemtap.examples/io/io_submit.tcl: Ditto.
* testsuite/systemtap.examples/io/mbrwatch.tcl: Ditto.
* testsuite/systemtap.examples/process/chng_cpu.tcl: Ditto.
* testsuite/systemtap.examples/process/sleepingBeauties.tcl: Ditto.
* testsuite/systemtap.examples/profiling/latencytap.tcl: Ditto.
* testsuite/systemtap.examples/process/strace.tcl: Skip the example if
we're on ia64, which doesn't have nd_syscall support.
* testsuite/systemtap.examples/process/thread-business.tcl: Ditto.
David Smith [Wed, 28 Aug 2013 15:31:57 +0000 (10:31 -0500)]
Update badname.stp example for newer kernels (with inlined may_create()).
* testsuite/systemtap.examples/general/badname.stp: Since may_create() is
now always inlined (and we can't find its arguments), probe
may_create()'s callers instead.
Frank Ch. Eigler [Tue, 27 Aug 2013 18:22:37 +0000 (14:22 -0400)]
PR15900 weaken & simplify server_locale.exp test case
The server_locale.exp test case need only confirm that selected
local-related environment variables are passed to the server. A
smaller & simpler set of tests are sufficient for that.
David Smith [Tue, 27 Aug 2013 14:58:22 +0000 (09:58 -0500)]
Make pr13158.exp test results less random.
* testsuite/systemtap.base/pr13158.exp: Make test result less random, by
making sure the first copy of the module is loaded before trying to load
the second copy.
Lukas Berk [Fri, 23 Aug 2013 19:05:30 +0000 (15:05 -0400)]
Move %changelog pruning into diff check block
If there is no spec diff, then there's no need to even check for a
difference in the %changelog section. Furthermore we should check
that there is even a %changelog section in the diff and only attempt
to prune accordingly
scripts/spin-rawhide - move pruning into file check statements