David Smith [Thu, 9 Jul 2009 20:16:57 +0000 (15:16 -0500)]
Added timer data flushing and overwrite handling to the ring_buffer transport.
* buildrun.cxx (compile_pass): Checks for ring_buffer api change.
* runtime/autoconf-ring_buffer-flags.c: New file.
* runtime/transport/ring_buffer.c (tracing_wait_pipe): No longer
schedules, just returns. The timer function will handle it later.
(_stp_data_write_reserve): Handles ring_buffer api change. Added
overwrite processing. If we're full, delete an event to make room.
(_stp_data_write_commit): Handles ring_buffer api change.
(__stp_relay_wakeup_timer): New function.
(__stp_relay_timer_start): Ditto.
(__stp_relay_timer_stop): Ditto.
(_stp_transport_data_fs_start): Calls __stp_relay_timer_start().
(_stp_transport_data_fs_stop): Calls __stp_relay_timer_stop().
(_stp_transport_data_fs_overwrite): Sets overwrite flag.
Mark Wielaard [Tue, 7 Jul 2009 12:35:10 +0000 (14:35 +0200)]
Add support for constant struct member field offsets.
* loc2c.h (c_translate_add_offset): New function prototype.
* loc2c.c (c_translate_add_offset): New function implementation.
* loc2c-test.c (handle_variable): Use c_translate_add_offset if appropriate.
* dwflpp.cxx (translate_location): Likewise.
Mark Wielaard [Wed, 8 Jul 2009 07:38:33 +0000 (09:38 +0200)]
More gcc 4.5 'jump skips variable initialization' fixlets.
* tapset/ioblock.stp (__bio_start_sect): Declare, then initialize variables
that could (through kread) take an early jump.
* tapset/nfs_proc.stp (get_prot_from_client): Likewise.
* tapset/scsi.stp (scsi_timer_pending): Likewise.
* tapset/task.stp (task_cpu): Likewise.
(task_open_file_handles): Likewise.
PR3498: speed up pass-2 and pass-3 for kernel offline dwfl module searching
* dwflpp.cxx (dwflpp ctor): Parametrize for user/kernel modes.
Update callers.
(dwfl_report_offline_predicate): New function. Filter and
abort searches early if possible.
(setup_kernel): Use new predicate.
* dwflpp.h: Corresponding changes.
* tapsets.cxx (dwfl_report_offline_predicate): Remove this shared
implementation.
(dwarf_builder): Turn kern_dw into module_name->dwflpp* map, just
like user_dw.
(get_kern_dw): Adapt.
(dwarf_build_no_more): Adapt.
* tapsets.h: Remove old shared predicate.
* translate.cxx (dwfl_report_offline_predicate2): New function.
Filter and abort searches early if possible.
(emit_symbol_data): Use it.
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