David Smith [Wed, 7 Apr 2010 21:12:10 +0000 (16:12 -0500)]
PR 9871 (partial) fix. Removed embedded-C in ioblock.stp and ipmib.stp.
* tapset/ioblock.stp(__bio_start_sect): Converted from embedded-C to
script language.
* tapset/ipmib.stp: Replaced all _tcphdr_get_dport()/_tcphdr_get_sport()
calls with _tcp_skb_dport()/_tcp_skb_sport() calls. Removed embedded-C
functions _tcphdr_get_dport()/_tcphdr_get_sport().
(ipmib.OutRequests): Fixed for RHEL4.
(_trn_unspec): New function.
(_input_route_type): Originally called
__input_route_type_old()/__input_route_type_new(), which were embedded-C
functions. Now just does everything in script language.
(__input_route_type_old): Deleted.
(__input_route_type_new): Ditto.
(_output_route_type): Originally called
__output_route_type_old()/__output_route_type_new(), which were
embedded-C functions. Now just does everything in script language.
(__output_route_type_old): Deleted.
(__output_route_type_new): Ditto.
David Smith [Mon, 5 Apr 2010 19:54:45 +0000 (14:54 -0500)]
PR 9871 (partial) fix. Removed more embedded-C in nfs_proc.stp.
* tapset/nfs_proc.stp: Rewrote embedded-C functions stap_NFS_CLIENT(),
get_ip_from_client(), get_prot_from_client(), get_ip(), and get_prot()
in script language. Simplified __i2n_ip_proto() by just calling
get_ip_from_client() or get_prot_from_client().
Josh Stone [Tue, 30 Mar 2010 21:54:39 +0000 (14:54 -0700)]
Use a wider cache for simple function lookups
When we have many individual function lookups, like the nearly 1000 with
syscall.*, each one will iterate every CU in the module (M) and then do a
cache lookup in N entries. That's a thousand MlogN lookups.
We can instead keep the functions in a module-wide map, and then the
complexity is just a thousand logMN lookups.
* dwflpp.cxx (dwflpp::iterate_single_function): Do a simple function
lookup based on a module-wide cache.
(dwflpp::mod_function_caching_callback): Helper for above.
* tapsets.cxx (dwarf_query::query_module_functions): Query a single
function from the module-wide cache.
(dwarf_query::query_module_dwarf): Use above for simple cases.
Josh Stone [Tue, 30 Mar 2010 01:24:04 +0000 (18:24 -0700)]
Remove unused code from iterate_over_functions
* dwflpp.cxx (dwflpp::iterate_over_functions): No caller is using
has_statement_num anymore (since 6b517475), so kill it.
* tapsets.cxx (query_cu): Let the default call rule the day.
David Smith [Tue, 30 Mar 2010 20:53:51 +0000 (15:53 -0500)]
PR 9871 (partial) fix. Removed some embedded-C in ioblock.stp/vfs.stp.
* tapset/dev.stp: Added a bdevname() script function.
* tapset/ioblock.stp: Rewrote the embedded-C devname function to just use
bdevname() script function.
* tapset/vfs.stp: Removed embedded-C __bdevname() C function. Calls
bdevname() script function instead.
* tapset/string.stp: Added isdigit() function.
Stan Cox [Fri, 26 Mar 2010 21:14:32 +0000 (17:14 -0400)]
Add kprobe user probe semaphore handling.
Adds stap_kprobe_process_found and stap_kprobe_mmap_found handlers
and then the task_finder uses those to set the semaphore values.
The probe adds user_path and user_lib which are used by the
task_finder to decide what object to sniff.
* sdt.h (STAP_SEMAPHORE): Also define for kprobes.
* tapsets.cxx (dwarf_derived_probe): Add user_path and user_lib.
(dwarf_derived_probe::join_group): Enable task finder for kprobes.
(dwarf_derived_probe::dwarf_derived_probe): Set user_path and
user_lib.
(dwarf_derived_probe_group::emit_module_decls): Emit
stap_kprobe_mmap_found, sdt_sem_offset, sdt_sem_address, pathname,
and finder declarations. Emit stap_kprobe_process_found and
stap_kprobe_mmap_found.
(dwarf_derived_probe_group::emit_module_init): Setup task finder.
(sdt_query::convert_location): Remove TOK_LIBRARY token.
(dwarf_builder::build): Set user_path and user_lib.
(kprobe_derived_probe): Add path and library.
(kprobe_builder::build): Get process and library params
David Smith [Fri, 26 Mar 2010 19:17:48 +0000 (14:17 -0500)]
PR 11338 (partial): Used '@defined()' in inet_sock tapsets.
* tapset/inet_sock.stp (inet_get_local_port): Used '@defined' instead of a
kernel version check. Added RHEL4 support.
(inet_get_ip_source): Now calls __ip_sock_daddr() to get daddr.
David Smith [Fri, 26 Mar 2010 18:24:38 +0000 (13:24 -0500)]
PR 9871/11338 fix in tcpmib.stp by removing embedded-C and using @defined.
* tapset/tcpmib.stp (tcpmib_get_state): Changed from embedded-C to script
code.
(tcpmib_local_addr): Instead of an embedded-C function, now calls
function from ip.stp/tcp.stp.
(tcpmib_remote_addr): Ditto.
(tcpmib_local_port): Ditto.
(tcpmib_remote_port): Ditto.
(tcpmib.OutRsts.A): Used '@defined' instead of a kernel version check.
* tapset/ip.stp (__ip_sock_saddr): Used '@defined' instead of a kernel
version check. Added RHEL4 support.
(__ip_sock_daddr): Ditto.
* tapset/tcp.stp (__tcp_sock_dport): Ditto.
(__tcp_sock_sport): Ditto.
Josh Stone [Fri, 26 Mar 2010 02:32:46 +0000 (19:32 -0700)]
Print probepoint addresses in hex
* staptree.h (literal_number): Add a bool "print_hex".
* staptree.cxx (literal_number::print): Switch to hex if needed.
* tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Write the
statement number component with a hex literal_number.
(sdt_query::convert_location): Ditto
(kprobe_derived_probe::kprobe_derived_probe): Ditto.
(hwbkpt_derived_probe::hwbkpt_derived_probe): Ditto for data addr.
Josh Stone [Thu, 25 Mar 2010 21:31:45 +0000 (14:31 -0700)]
PR11399: Allow '**' to match tapsets across '.'
Normally wildcards are constrained to matching a single probe point
component between the '.' separator. This patch enables '**' to match
across the separator.
Probe point parameters are still absolute separators though, as there's
not really a meaningful semantic we could use to cross them with '**'.
* elaborate.cxx (isdoubleglob): Check for '**'.
(match_node::find_and_build): Recurse '**' to cross separators.
* testsuite/semok/doubleglob.stp: New test of broad wildcards.
* testsuite/semko/doubleglob.stp: New negative test.
David Smith [Wed, 24 Mar 2010 15:57:01 +0000 (10:57 -0500)]
Improved atomic.exp testcase by removing the need for an external module.
* testsuite/systemtap.base/atomic.exp: Removed the need for the external
module by putting the atomic_long_t inside the stap module.
* testsuite/systemtap.base/atomic_module.c: Removed.
* testsuite/systemtap.base/atomic_module.makefile: Ditto.
* testsuite/lib/stap_run_error.exp (stap_run_error): Better error handling.
Mark Wielaard [Fri, 19 Mar 2010 22:19:19 +0000 (23:19 +0100)]
Support epoll_create1 syscall.
* tapset/aux_syscalls.stp (_epoll_create1_flag_str): New helper function.
* tapset/syscalls.stp (syscall.epoll_create[.return]): Match epoll_creat1
if available.
Josh Stone [Sat, 20 Mar 2010 19:29:37 +0000 (12:29 -0700)]
PR11405: Warn and continue for parsing errors in tapsets
When we start seeing tapsets provided by third parties, any errors in
their files should not be fatal to us. Since we don't really know which
tapsets are our own, this leniency applies to all.
* main.cxx (main): Warn on tapset errors, but continue unless -W.
* testsuite/parseko/bad_tapset/foo.stp: New bogus tapset.
* testsuite/parseko/bad_tapset.stp: Check that "-W -I bad_tapset" fails.
* testsuite/parseok/bad_tapset.stp: Check that "-I bad_tapset" succeeds.
* testsuite/parseok/all_tapsets.stp: Check -W with the default tapsets.
Mark Wielaard [Fri, 19 Mar 2010 19:57:01 +0000 (20:57 +0100)]
Add ia64 pipe result support. Relax pipe syscall test a little.
* tapset/syscalls2.stp (syscall.pipe.return): ia64 provides pipe0, pipe1
results through (user) registers.
* testsuite/systemtap.syscall/pipe.c: Only expect zero as input fildes.
Josh Stone [Fri, 19 Mar 2010 19:04:39 +0000 (12:04 -0700)]
Let try_block contain any statement
We still require the block for parsing, but the optimizer likes to fold
singleton blocks away, so any statement is possible. PR11341 masks such
issues at compile time, but I'm a little surprised that we've gotten
away with this at runtime...
Mark Wielaard [Fri, 19 Mar 2010 12:00:50 +0000 (13:00 +0100)]
PR11402 Support pipe2 syscall.
The pipe2() was added to Linux in version 2.6.27. It is a variant of the
normal pipe syscall, but takes an extra flags argument which can be the
ORed value of O_NONBLOCK and O_CLOEXEC.
* tapset/aux_syscalls.stp (_sys_pipe2_flag_str:string): New helper function.
* tapset/syscalls2.stp (syscall.pipe2, syscall.pipe2.return): New probes.
Mark Wielaard [Fri, 19 Mar 2010 10:55:57 +0000 (11:55 +0100)]
Make pipe file descriptors available in syscall.pipe[.return].
The actual value of the pipe file descriptors can be interesting,
especially in the syscall.pipe.return probe. This can be done without
any embedded C now using @cast. So don't use _fildes_u() anymore.
_fildes_u in aux_syscall.stp is still retained because it is used in
nd_syscalls2.stp for pipe.
* tapset/syscalls2.stp (syscall.pipe, syscall.pipe.return): Add pipe1
pipe2 convenience variables. Don't use _fildes_u for argstr anymore.
Mark Wielaard [Fri, 19 Mar 2010 10:32:22 +0000 (11:32 +0100)]
Use @defined() in syscall.pipe to select whether fildes_uaddr is available.
* tapset/aux_syscalls.stp (syscall.pipe): Remove architecture dependent
probe definitions. Newer gcc make $fildes available on more arches.
Use @defined($fildes) to select on which ones.
Josh Stone [Fri, 19 Mar 2010 01:57:10 +0000 (18:57 -0700)]
Simplify the perf entry handlers
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls):
Just pass an index from the individual entry handlers, and let
handle_perf_probe figure out the pp and ph.
Josh Stone [Fri, 19 Mar 2010 01:54:18 +0000 (18:54 -0700)]
Create one perf structure to rule them all
* perf.h (stap_perf_probe): Define one structure for all our needs.
* perf.c (_stp_perf_init): Use the new struct, return errors directly.
(_stp_perf_exit): Use the new struct.
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls): Use
the stap_perf_probe definition from perf.h now.
(perf_derived_probe_group::emit_module_init): Adapt.
(perf_derived_probe_group::emit_module_exit): Adapt.
Josh Stone [Thu, 18 Mar 2010 22:39:42 +0000 (15:39 -0700)]
PR11346: Move the skip-badvars logic into const-folding
The const_folder is where we prune constant expressions, like
conditionals based on a @defined($foo), so we want to give this a chance
to work before skip-badvars comes in and throws a warning.
As an added bonus, this makes skip-badvars more generic, so it will work
even for non-dwarf $target variables.
* elaborate.cxx (const_folder::visit_target_symbol): Enact skip-badvars.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't
worry about badvars here anymore. Save the error now, clean up later.
* testsuite/semok/badvar_undefined.stp: Test that @defined with
skip-badvars doesn't throw any warnings.
Frank Ch. Eigler [Thu, 18 Mar 2010 13:35:28 +0000 (09:35 -0400)]
PR909: store kernel exported symbols in session object
* session.h (kernel_exports): New field.
* main.cxx (parse_kernel_exports): Fill it.
* tapset-perfmon.cxx (perf_builder::build): Check it for our pal
perf_event_create_kernel_counter.
Josh Stone [Thu, 18 Mar 2010 02:06:56 +0000 (19:06 -0700)]
Preserve perf initialization errors
* runtime/perf.c (_stp_perf_init): Pass through ERR_PTRs, and create our
own -ENOMEM for allocation failures.
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_init): Check
IS_ERR for registration status.
Josh Stone [Thu, 18 Mar 2010 00:30:06 +0000 (17:30 -0700)]
PR909: Emit proper decls for perf probes
While I still have some TODOs, it's now in a usable state for others to
start testing...
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls):
Implement the code to hook up real stap handlers.
(perf_derived_probe_group::emit_module_init): Register for real.
(perf_derived_probe_group::emit_module_exit): Unregister.
Josh Stone [Wed, 17 Mar 2010 21:07:56 +0000 (14:07 -0700)]
Translate perf events names into kernel names
* tapset-perfmon.cxx (perf_builder::translate_event): New. The event
mapping is hard-copied from the current state of perf.
(perf_builder::build): Call it.
Josh Stone [Tue, 16 Mar 2010 23:53:48 +0000 (16:53 -0700)]
Rename perf probe points
These are now the available points:
perf.event("NAME")
perf.event("NAME").sample(NUM)
* tapset-perfmon.cxx (perf_derived_probe::perf_derived_probe): Add
fields for the event name, type, and config. Rewrite the probe_point
to match the derived components
(perf_builder::build): Parse the new fields.
(register_tapset_perf): Adapt the match_nodes.
Will Cohen [Wed, 17 Feb 2010 16:28:36 +0000 (11:28 -0500)]
Modify the systemtap perf sampling internal api
The only information available in the overflow interrupt is the event.
Need to group other pieces of information needed by systemtap, so they
can be found based on the the location of the event information.