David J. Wilder [Thu, 16 Jul 2009 23:47:01 +0000 (16:47 -0700)]
This SNMP group of tapsets provides probes used to count SNMP management
events. The probes mirror many of the SNMP statistics defined
in /usr/include/linux/snmp.h. Each probe represents a single SNMP
statistic or MIB. Each of the probe's handler is called when system
performs an operation that would alter the associated statistic. Along
with each probe is defined an indexed set of counters used to record
probe hits. The probe handlers call a user supplied callback functions
to determine which counter to alter. The user's callback should returns a
key value that will be used to index the counter. For example a callback
could return a unique value for each socket. This would results in a
separate counter being used for each socket.
tcpipstat.stp shows how snmp tapsets could be used. Tcpipstat collects and
displays network statistics related to individual TCP sockets or groups of
sockets. The statistics that are collected are simmer to that of the command
netstat -s, only sorted and grouped by individual sockets. Signed-off-by: David Wilder <dwilder@us.ibm.com>
Mark Wielaard [Thu, 16 Jul 2009 21:32:12 +0000 (23:32 +0200)]
PR10398 DW_OP_call_frame CFA support doesn't work for prelink shared libs.
* dwflpp.cxx (translate_location): Call get_cfa_ops with relative pc plus
module bias.
(literal_addr_to_sym_addr): Add verbose logging.
(get_cfa_ops): Adjust pc for returned bias. Add verbose logging.
Josh Stone [Thu, 16 Jul 2009 01:21:56 +0000 (18:21 -0700)]
PR5930: Address-op for $target and @cast members
This allows the '&' operator to get the address of @cast and $target
variable expressions.
* staptree.h (target_symbol): add addressof field
* staptree.cxx (target_symbol::print): print '&' for addressof
(cast_op::print): ditto
* parse.cxx (parser::parse_value): allow '&' prefix on $target/@cast
* dwflpp.cxx (dwflpp::translate_final_fetch_or_store): allow taking the
computed address without actually doing a final fetch.
* tapset* (*::visit_target_symbol): throw errors for $vars w/o addresses
* testsuite/systemtap.base/cast.stp: add &@cast test
* testsuite/semok/target_addr.stp: test '&' on different member types
* testsuite/semko/target_addr?.stp: test failure on bitfields/registers
David Smith [Wed, 15 Jul 2009 16:52:52 +0000 (11:52 -0500)]
utrace_syscall_args.stp makes sure open syscall is from target pid.
* testsuite/systemtap.base/utrace_syscall_args.stp: Makes sure the open
syscall is from the target pid.
Mark Wielaard [Wed, 15 Jul 2009 10:04:57 +0000 (12:04 +0200)]
PR10388 Support DW_OP_call_frame_cfa.
Depends on elfutils 0.142 cfi support.
* loc2c.h (c_translate_location): Take (optional) Dwarf_Op *cfa_ops.
* loc2c.c (translate): Recognize DW_OP_call_frame_cfa.
(location_from_address): Take cfa_ops, examine fb_ops, if it is
DW_OP_call_frame_cfa, pass cfa_ops to translate instead.
(location_relative): Take cfa_ops, pass to location_from_address.
(c_translate_location): Take cfa_ops, pass to location_from_address.
* loc2c-test.c (handle_variable): Take cfa_ops, pass to c_translate_location
when needed.
(main): Fetch cfa_ops, pass to handle_variable.
* dwflpp.h (struct dwflpp): Add new method get_cfa_ops.
* dwflpp.cxx: Include elfutils/version.h.
(translate_location): Fetch cfa_ops when necessary.
(get_cfa_ops): New method.
Josh Stone [Wed, 15 Jul 2009 00:57:16 +0000 (17:57 -0700)]
PR4166: Allow array-like indexing on pointers
* dwflpp.cxx (dwflpp::translate_components): let pointers get treated
the same as arrays, and add a final DIE dereference for array access.
* loc2c.c (c_translate_array): tolerate pointer types
* testsuite/systemtap.base/pointer_array.*: new test
Mark Wielaard [Sat, 11 Jul 2009 09:58:52 +0000 (11:58 +0200)]
Don't accidentially use user space ntohs function.
The definition of ntohs comes from user space include headers
netinet/in.h which could define it as function instead of macro.
So use builtin kernel be16_to_cpu instead.
* tapset/aux_syscalls.stp (_struct_sockaddr_u): Define and use _stp_ntohs
as be16_to_cpu.
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