David Smith [Mon, 6 Jul 2009 14:16:28 +0000 (09:16 -0500)]
BZ 490234 fix.
* runtime/procfs.c (_stp_rmdir_proc_module): Now before removing either
'/proc/systemtap/${MODULE}' or '/proc/systemtap', lock the transport
directory. Also make sure '/proc/systemtap' is empty before removal.
David Smith [Thu, 2 Jul 2009 20:39:57 +0000 (15:39 -0500)]
Fixed PR 10258.
* tapset-procfs.cxx (procfs_derived_probe::join_group): Outputs structure
definition.
(procfs_derived_probe_group::emit_module_decls): The generated
'_stp_procfs_read' and '_stp_procfs_write' functions no longer put a
string_t on the stack.
(procfs_var_expanding_visitor::visit_target_symbol): The generated
'_procfs_value_set' and '_procfs_value_get' functions copy directly
into or out of the os buffer.
Josh Stone [Thu, 2 Jul 2009 01:59:41 +0000 (18:59 -0700)]
PR10327: resolve symbol aliases to dwarf functions
This will first read in the symbol table for modules, and update the
dwarf cu_function_cache with aliased names too. Then when iterating
in dwarf, all of the possible names are matched, instead of only the
canonical dwarf name.
* dwflpp.cxx (dwflpp::iterate_over_functions): call update_symtab,
and track wildcard addresses in a set to avoid alias dupes
* dwflpp.h (symbol_table::Compare): removed
* tapsets.cxx (symbol_table::map_by_addr): replaces list_by_addr
(symbol_table::sort): removed -- multimap doesn't need sorting
(symbol_table::mark_dwarf_redundancies): removed, see update_symtab
(symbol_table::purge_syscall_stubs): remove map elements inline
(dwarf_query::handle_query_module): preload the symtable.
(query_dwarf_func): don't compare the function a second time,
especially since it may have been an alias that matched at first.
(module_info::get_symtab): allow being called multiple times
(module_info::update_symtab): copy dies from the cache to the symtab,
and also add aliased names to the cache
Mark Wielaard [Fri, 26 Jun 2009 14:36:58 +0000 (16:36 +0200)]
PR10335 systemtap.base/strftime.exp hangs.
This only happened if there was a lot of cruft in the testsuite dir since
expect wasn't "draining" the output of the spawned ls command for some
reason. Work around it by just using tcl file globs to match.
* testsuite/systemtap.base/strftime.exp: Test with glob and file exists.
Mark Wielaard [Thu, 25 Jun 2009 21:07:17 +0000 (23:07 +0200)]
PR10323 Some ustack exelib.exp tests fail with prelinked shared libs.
For shared libraries (.dynamic sections) we need the eh frame section
address offset. This is the sh_addr if the shared library isn't prelinked
(since the base load address is zero in that case), otherwise it is
the module start address minus the bias (which also works for the
non-prelinked case).
* translate.cxx (get_unwind_data): Adjust eh_addr for module start and
bias if module isn't absolute (has no relocations).
* testsuite/systemtap.exelib/ustack.tcl: Accept all prelink tests.
Mark Wielaard [Thu, 25 Jun 2009 14:44:02 +0000 (16:44 +0200)]
Only compile with plain gcc for exelib.exp testcases.
g++ is also supported but disabled because it didn't add much interesting
differences in binaries and exploded the test search case a bit.
* testsuite/systemtap.exelib/exelib.exp: Disable g++ by default, but
keep support for enabling it.
Mark Wielaard [Thu, 25 Jun 2009 14:35:53 +0000 (16:35 +0200)]
Add seperate debuginfo after prelinking to exelib.exp tests.
We split debuginfo before prelinking, that means that the base load address
of the .so is non-zero, while for the .debug files they are zero. In the
other case we supported sep-debug without prelinking both .so and .debug
load bases were zero. In this new test case both base load addresses are
non-zero.
* testsuite/systemtap.exelib/exelib.exp: Add libdebug == "sep-after" to
indicate separate debuginfo after prelinking library. Skip sep-after
if not prelinking.
Mark Wielaard [Wed, 24 Jun 2009 12:20:08 +0000 (14:20 +0200)]
PR10305 Mark probes fail on prelinked shared library.
Mark probes rely on literal statement addresses, these are based on the
on-disk module address space. Introduce helper function to turn such
addresses into symbol addresses as expected by libdwfl. Also properly
adjust for dw bias when such addresses are used in dw queries.
* dwflpp.h (dwflpp::literal_addr_to_sym_addr): New method.
* dwflpp.cxx (query_cu_containing_address): Don't "globalize" address.
(literal_addr_to_sym_addr): New method.
* tapsets.cxx (query_module_dwarf): Turn literal addresses into symbol
addresses.
(query_dwarf_func): Likewise and adjust for dw module bias.
This patch adds the test case needed for this function. I have added
few tests. If required more can be added in future.
As discussed in previous version, the testcase patch has been reverted
to the original as the str_replace() functionality has changed wrt to
error handle.
Signed-off-by: Varun Chandramohan <varunc@linux.vnet.ibm.com> Signed-off-by: Josh Stone <jistone@redhat.com>
This patch adds a search and replace string functionality to existing
tapsets.
The functionality is as follows:
The function takes in a parent string and searches for a substring as
specified by the user. If substring not found, the parent string is
returned. If substring is found, it is replaced by another string and
returned.
NOTE: The function will search and replace all the occurrence of
substrings in a parent string when matched.
Signed-off-by: Varun Chandramohan <varunc@linux.vnet.ibm.com> Signed-off-by: Josh Stone <jistone@redhat.com>
Josh Stone [Mon, 22 Jun 2009 20:59:58 +0000 (13:59 -0700)]
Bump up the default timeout for target_set test
Starting the test with a cold cache can take easily longer than
dejagnu's default 10 second timeout. I'm bumping it to 180 seconds,
the same as in the stap_run library functions.
Mark Wielaard [Mon, 22 Jun 2009 14:48:30 +0000 (16:48 +0200)]
PR10307 beginning of statement check should be overridden in guru mode.
* tapsets.cxx (query_cu): When in guru mode just issue an warning (if not
suppressed) instead of an error when address isn't at the beginning of
a statement.
Masami Hiramatsu [Fri, 19 Jun 2009 22:19:52 +0000 (18:19 -0400)]
Fix various issues in initscript (bz506956)
* initscript/systemtap.in: Fix messages.
(clog): Don't strip spaces out.
(parse_args): Parse -y option.
(status): Show message if no scripts are running.
(restart): Don't try to stop scripts if no scripts are running.
Masami Hiramatsu [Fri, 19 Jun 2009 22:19:51 +0000 (18:19 -0400)]
Fix on-file flight recorder mode bugs on old kernel.
* runtime/staprun/common.c (make_outfile_name): Moved from relay.c, fix not to
open /dev/null.XXX output files, and add 'bulk' argument for bulkmode.
* runtime/staprun/relay.c (make_outfile_name): Moved to common.c.
* runtime/staprun/relay_old.c (open_oldoutfile): Fix to use fopen() and store
FILE * to percpu_tmpfile[cpu].
Stan Cox [Fri, 19 Jun 2009 20:13:21 +0000 (16:13 -0400)]
Correctly find probes for -m32 executables.
* sdt.h (STAP_PROBE_DATA_): Pad with 0 so final probe entry doesn't
pickup a stray word.
* sdt_misc.exp (static_user_markers.{c,d}): Add bstruct to test struct
type handling
Revise acquiring of pid and ppid in fork.return probe -- use returnval()
and pid() instead of pid() and ppid() respectively. Add pid removal on
exit syscall. Use dwarfless syscall probe aliases. Correct formatting.
Previous implementation was error-prone, because allowed returning empty
tokens (mimiced strsep()), which is fine if there is a NULL semantic.
Unfortunately SystemTap doesn't provide it in scripts and has only blank
string (""), therefore testing against it was misleading.
The solution is to return only non-empty tokens (mimic strtok()).
* tapset/string.stp: Fix tokenize.
* testsuite/systemtap.string/tokenize.stp: Improve and add case with
more than one delimiter in the delim string.
* testsuite/systemtap.string/tokenize.exp: Ditto.
* stapfuncs.3stap.in: Update tokenize description.
* doc/langref.tex: Ditto.
David Smith [Tue, 16 Jun 2009 17:17:35 +0000 (12:17 -0500)]
Moved time.c inclusion from runtime/transport/transport.c to runtime/runtime.h.
* runtime/runtime.h: Includes time.c.
* runtime/transport/transport.c: Removed time.c inclusion.
Mark Wielaard [Tue, 16 Jun 2009 14:13:25 +0000 (16:13 +0200)]
Add GCC version to testsuite run output and systemtap.sum file.
Prints the gcc being used and full version. Also adds short version
number to systemtap.sum file (plus full version string). Will make
comparing failures based on compiler version being used easier.
* testsuite/lib/systemtap.exp (print_systemtap_version): Also print
location and full version of gcc being used.
(get_system_info): Get gcc version number and long version string.
* testsuite/lib/stap_run.exp (print_system_info): Output GCC version.
Stan Cox [Mon, 15 Jun 2009 16:16:17 +0000 (12:16 -0400)]
Add experimental utrace/kprobe sdt support
* sdt.h (EXPERIMENTAL_UTRACE_SDT, EXPERIMENTAL_KPROBE_SDT): New probe
point macros.
* dtrace: Add support for creating type debug info, currently invoked
with --types.
* tapsets.cxx (probe_table::convert_probe): New.
(probe_table::convert_location): New.
(dwarf_builder::build): Use it to simplify probe point handling.
* sdt.exp (pbtype_flags, pbtype_mssgs): New to also test kprobe and utrace.
* static_uprobes.exp (pbtype_flags, pbtype_mssgs): New to also test kprobe and utrace.
Mark Wielaard [Mon, 15 Jun 2009 15:47:36 +0000 (17:47 +0200)]
PR10285. User space PROBE marks aren't found with separate debuginfo.
The original logic was a little confused. It could end up searching the
separate debuginfo twice instead of falling back to the main elf file.
Now we explicitly search the main elf file first (where the .probes
section really should be) and only then fall back to the separate
debuginfo file.
* tapsets.cxx (dwarf_builder::probe_table::probe_table): Search main
elf file first, then fall back on separate debuginfo file if necessary.
* testsuite/systemtap.exelib/exelib.exp: Enable mark.tcl testcase.
main elf file or the debuginfo file, but would interpret
Mark Wielaard [Mon, 15 Jun 2009 11:37:39 +0000 (13:37 +0200)]
PR10274 Fix exelib -O3 testcase.
The testcase now uses noinline, an empty asm statement and a volatile
variable to prevent the function getting inlined, being totally unrolled
or the recursive call being replaced with an inner-iteration.
This does defeat part of the testcase though, which was testing unwinding
through an optimized recursive function. But it seems the best we can do.
* testsuite/systemtap.exelib/exelib.exp: Add -O3 to the mix.
* testsuite/systemtap.exelib/uprobes_exe.c: Use volatile bar and mark
main_func noinline.
* testsuite/systemtap.exelib/uprobes_lib.c: Use volatile foo and mark
lib_func noinline.
Frank Ch. Eigler [Sat, 13 Jun 2009 22:21:06 +0000 (18:21 -0400)]
PR10279: add -DKRETACTIVE=nnnn parameter
* tapsets.cxx (dwarf/kprobe_derived_...::emit_decl/init): Define
and use KRETPROBE instead of hard-coded max(...) values. Raise
the default 50%.
* testsuite/buildok/thirtytwo.stp: New test.
Mark Wielaard [Fri, 12 Jun 2009 20:37:11 +0000 (22:37 +0200)]
Add exelib uprobes test framework.
Tests uprobes placed in executables and shared libraries on different
arches (32-on-64 currently disabled), gcc/g++, optimizations (currently
disabled), prelinked libs (currently disabled), seperate libs/exe debuginfo
and pie executables.
* testsuite/systemtap.base/uprobes_exe.c: Moved to...
* testsuite/systemtap.exelib/uprobes_exe.c: From systemtap.base.
* testsuite/systemtap.base/uprobes_lib.c: Moved to...
* testsuite/systemtap.exelib/uprobes_lib.c: From systemtap.base.
* testsuite/systemtap.base/uprobes_lib.exp: Rewritten as...
* testsuite/systemtap.exelib/lib.tcl: From uprobes_lib.exp.
* testsuite/systemtap.base/uprobes_lib.stp: Rewritten as...
* testsuite/systemtap.exelib/lib.stp: From uprobes_lib.stp.
* testsuite/systemtap.base/uprobes_uname.exp: Rewritten as...
* testsuite/systemtap.exelib/uname.tcl: From uprobes_uname.exp.
* testsuite/systemtap.base/uprobes_uname.stp: Rewritten as...
* testsuite/systemtap.exelib/uname.stp: From uprobes_uname.stp.
* testsuite/systemtap.base/uprobes_ustack.exp: Rewritten as...
* testsuite/systemtap.exelib/ustack.tcl: From uprobes_ustack.exp.
* testsuite/systemtap.base/uprobes_ustack.stp: Rewritten as...
* testsuite/systemtap.exelib/ustack.stp: From uprobes_ustack.stp.
* testsuite/systemtap.exelib/exelib.exp: New exelib uprobes framework.
* testsuite/systemtap.exelib/cleanup.tcl: New file.
David Smith [Fri, 12 Jun 2009 18:20:57 +0000 (13:20 -0500)]
Fixed non-bulkmode output on smp systems using transport version 2.
* runtime/transport/relay_v2.c (__stp_relay_create_buf_file_callback): Set
the 'is_global' return parameter so that smp systems work correctly.
Josh Stone [Wed, 10 Jun 2009 22:50:04 +0000 (15:50 -0700)]
PR10260: Clean up all resources after init errors
When anything in systemtap_module_init fails, and we return non-zero,
then the module load is aborted. The normal module unload path
(systemtap_module_exit) is not even attempted, so we need to make sure
that all partially-allocated resources are returned.
Our timer callbacks for the gettimeofday subsystem are a classic example
of this error. If we don't unregister the timers before aborting init,
they will later be called and cause a kernel fault.
We also were neglecting to free the percpu context. A memory leak is
less harmful, but that's fixed now too.
Josh Stone [Wed, 10 Jun 2009 02:58:15 +0000 (19:58 -0700)]
Fix condition propagation across aliases
When an instance of an alias has a condition, that condition gets
propagated to each of the locations that the alias defines. However,
the copy of the location list was not a deep copy, and so all other
instances of the alias would also incorrectly receive the condition.
This patch makes the location list copy a little deeper, and adds a
test case which demonstrates the issue.