Josh Stone [Wed, 5 Aug 2009 03:29:51 +0000 (20:29 -0700)]
Fix grapher compilation warnings from rpm build
* grapher/Graph.cxx (Graph::Graph): Initialize in declaration order.
* grapher/GraphWidget.cxx (GraphWidget::on_expose_event): Remove several
unused local variables.
Josh Stone [Mon, 3 Aug 2009 22:49:40 +0000 (15:49 -0700)]
Add update_visitor::replace
I noticed that most uses of update_visitor::require() were simply
writing the value back to the same place, i.e. foo = require(foo). The
new replace() method just encapsulates that paradigm, so we don't have
the duplication between the LHS and RHS.
* staptree.h (update_visitor::replace): New.
* elaborate.cxx, staptree.cxx, tapset-mark.cxx, tapset-perfmon.cxx,
tapset-procfs.cxx, tapset-utrace.cxx, tapsets.cxx: Update all require
calls that are simply updating the value in-place.
Josh Stone [Mon, 3 Aug 2009 21:45:21 +0000 (14:45 -0700)]
PR2049: support arbitrary $target-array indexing
Rather than just numeric literals, we can now support arbitrary
expressions for the index value. Note that loc2c won't allow this for
noncontiguous arrays, as the access methods need to be statically
computed, but for contiguous arrays and pointers-as-arrays it works
just fine.
* staptree.h (target_symbol::component): Add expression_array_index.
* staptree.cxx (target_symbol::visit_components): New helper.
(target_symbol::assert_no_components): Recognize new array type.
(target_symbol::component::print): Print subexpressions.
(traversing_visitor::visit_target_symbol, visit_cast_op): Visit the
indexing components too.
(varuse_collecting_visitor::visit_target_symbol): Ditto.
(update_visitor::visit_target_symbol, visit_cast_op): Ditto.
* elaborate.cxx (void_statement_reducer::visit_target_symbol): New.
(void_statement_reducer::visit_cast_op): Save indexes too.
* parse.cxx (parser::parse_target_symbol_components): Parse expressions.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Pass
expression-indexes as parameters (indexN) to the dwarf function.
(dwarf_cast_expanding_visitor::visit_cast_op): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
(sdt_var_expanding_visitor::visit_target_symbol): Visit the new @cast.
* dwflpp.cxx (dwflpp::translate_components): Use THIS->indexN.
* translate.cxx (c_unparser::visit_target_symbol): Correct error msg.
* testsuite/systemtap.base/pointer_array.stp: Use a simple index.
Josh Stone [Sat, 1 Aug 2009 00:24:13 +0000 (17:24 -0700)]
Unify no-component assertions on target variables
There are several tapsets that can't deal with component dereferences on
their target variables, and they all check-and-throw in the same way.
This refactors the checks into a target_symbol member.
* staptree.cxx (target_symbol::assert_no_components): New.
* tapsets.cxx (tracepoint_var_expanding_visitor::visit_target_symbol_arg,
tracepoint_var_expanding_visitor::visit_target_symbol_context): Use
the new assertion function to check for no components.
* tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_arg,
mark_var_expanding_visitor::visit_target_symbol_context): Ditto.
* tapset-perfmon.cxx (perfmon_var_expanding_visitor::visit_target_symbol): Ditto.
* tapset-procfs.cxx (procfs_var_expanding_visitor::visit_target_symbol): Ditto.
* tapset-utrace.cxx (utrace_var_expanding_visitor::visit_target_symbol_arg,
utrace_var_expanding_visitor::visit_target_symbol_context): Ditto.
Josh Stone [Sat, 1 Aug 2009 00:00:09 +0000 (17:00 -0700)]
Make a real type for target_symbol->components
Now the dereferences on target_symbol and cast_op are tracked with a
struct instead of just a generic pair. The first immediate benefit is
that we can track the token for more exact error reporting.
* staptree.h (target_symbol): Add a new component type.
* staptree.cxx (target_symbol::component::print): New.
(operator<<(ostream&, target_symbol::component&): New.
(target_symbol::print): Adapt component printing.
(cast_op::print): Ditto.
* parse.cxx (parser::parse_target_symbol_components): Adapt to the new
component construction.
* dwflpp.cxx (dwflpp::find_struct_member): take the component as a
parameter for a better token in error messages
(dwflpp::translate_components): Adapt to the new component type.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't
overwrite the token in target_symbol saved errors.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
Mark Wielaard [Fri, 31 Jul 2009 16:46:47 +0000 (18:46 +0200)]
PR10458. User actual breakpoint address for [ku]probe[ret].
Setup the pt_regs REG_IP to the actual breakpoint address before
entering a probe handler for [ku]probe[ret] (and restore it after
returning). This helps getting symbol resolution and backtraces
more correct and makes it more conform with other probe handlers
like the iutrace and profile timers that also provide pt_regs
(which untill now exhibited off-by-one errors while unwinding).
* tapsets.cxx (dwarf_derived_probe_group::emit_module_decls):
Setup REG_IP correctly before calling enter_kprobe_probe
and enter_kretprobe_probe, and restore afterwards.
(uprobe_derived_probe_group::emit_module_decls): Likewise for
enter_uprobe_probe and enter_uretprobe_probe.
(kprobe_derived_probe_group::emit_module_decls): Likewise for
enter_kprobe2_probe and enter_kretprobe2_probe.
* runtime/unwind/i386.h (arch_unw_init_frame_info): Initialize
info->call_frame to zero.
* runtime/unwind/x86_64.h (arch_unw_init_frame_info): Likewise.
Mark Wielaard [Wed, 29 Jul 2009 22:06:59 +0000 (00:06 +0200)]
PR10459. Disable all warning messages on -w.
* stap.1.in: Document that -w disables all warning messages.
* dwflpp.cxx (get_module_dwarf): Only output warning when session
suppress_warnings is not set.
* translate.cxx (dump_unwindsyms): Likewise.
(emit_symbol_data_done): Likewise.
* tapsets.cxx (query_module_symtab): Likewise.
(read_from_elf_file): Take systemtap_session, check suppress_warnings
before emitting warning.
(read_from_text_file): Likewise.
(get_symtab): Call read_from_elf_file and read_from_text_file with session.
Josh Stone [Wed, 29 Jul 2009 21:34:32 +0000 (14:34 -0700)]
Enable variable listing (-L) for uprobes
All $target variables and their C-types are now printed in -L mode.
* tapsets.cxx (uprobe_derived_probe::uprobe_derived_probe): Save the local
arguments while we still have the dwflpp open.
(uprobe_derived_probe::saveargs): New
(uprobe_derived_probe::printargs): New
Josh Stone [Wed, 29 Jul 2009 21:07:37 +0000 (14:07 -0700)]
Enable variable listing (-L) for dwarf probes
All $target variables and their C-types are now printed in -L mode.
* tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Save the local
arguments while we still have the dwflpp open.
(dwarf_derived_probe::saveargs): New
(dwarf_derived_probe::printargs): New
Josh Stone [Wed, 29 Jul 2009 19:35:29 +0000 (12:35 -0700)]
Use a real session flag for -L
Rather than relying on 'unoptimized' to tell us that the listing mode
should print the variables too, this adds an explicit listing_mode_vars.
* session.h (systemtap_session): Add listing_mode_vars
* main.cxx (main): Set s.listing_mode_vars appropriately.
(printscript): Use the new flag for deciding whether to print locals
Josh Stone [Wed, 29 Jul 2009 19:13:40 +0000 (12:13 -0700)]
Break up dwarf_var_expanding_visitor::visit_target_symbol
This just refactors large chunks of visit_target_symbol into a couple of
smaller functions.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_context): New
(dwarf_var_expanding_visitor::visit_target_symbol_saved_return): New
(dwarf_var_expanding_visitor::visit_target_symbol): Call the new ones
Tim Moore [Mon, 27 Jul 2009 10:46:30 +0000 (12:46 +0200)]
Support for presenting multiple graphs
* grapher/Graph.hxx: New file; class for single graph display.
* grapher/Graph.cxx: New file.
* grapher/GraphData.hxx: Associate title and axis labels with graph
data and not a graph display.
* grapher/GraphWidget.hxx: Move graph-related members to Graph class.
* grapher/GraphWidget.cxx (getExtents, setExtents): Move to Graph
class
(on_expose_event): Move graph rendering to Graph.
(on_button_press_event): Delegate to Graph.
(on_motion_notify_event, on_scroll_event): Modify "active" graph.
* grapher/StapParser.cxx (findTaggedValue): New parsing helper
function.
(io_callback): Support new syntax where properties are attached to
graph data and not the entire graph.
* grapher/grapher.cxx (GrapherWindow): Don't set graph values.
* grapher/Makefile.am: Add Graph.cxx.
* testsuite/systemtap.examples/general/grapher.stp: New property syntax.
Tim Moore [Wed, 27 May 2009 08:32:51 +0000 (10:32 +0200)]
Templatize GraphData
* grapher/GraphData.hxx (GraphDataBase): new superclass for
GraphData. Split time data out as a separate vector.
(GraphData): Rewrite as template.
* grapher/GraphWidget.cxx (on_expose_event): Reflect GraphData
templatization. Handle events with string values.
* grapher/GraphWidget.hxx (GraphWidget): Keep pointers to
GraphDataBase objects instead of GraphData.
* grapher/StapParser.cxx (parseData): new member function
(ioCallback): Handle new discreet event
* grapher/StapParser.hxx (StapParser): keep pointers to GraphDataBase
objects instead of GraphData
* testsuite/systemtap.examples/general/grapher.stp: Display actual key
pressed for keyboard event
PR6905: tweak WILDCARD and RANGE line type for process.statement
* dwflpp.cxx (iterate_over_srcfile_lines): Check the line range
and tolerate invalid line number for WILDCARD line type.
* testsuite/systemtap.base/bz6905.c: Test case.
* testsuite/systemtap.base/bz6905.exp: Ditto.
* testsuite/systemtap.base/bz6905.stp: Ditto.
David Smith [Wed, 22 Jul 2009 19:42:18 +0000 (14:42 -0500)]
Make ring_buffer transport work on new kernels.
* runtime/transport/ring_buffer.c (_stp_event_to_user): Added debug prints.
(_stp_ring_buffer_consume): New function.
(_stp_find_next_event): Avoid incrementing the buffer iterator here.
(_stp_data_write_commit): Added debug prints.
Josh Stone [Wed, 22 Jul 2009 02:21:56 +0000 (19:21 -0700)]
Use the query paradigm for resolving sdt probes
There was a bad assumption in the probe_table initialization that the
dwflpp->module would be immediately valid. We should not assume that
dwflpp only has one module, or that any module is necessarily in focus.
Instead, I've created an sdt_query class which will call an
iterate_over_modules like the other dwarf probe types. For now this
means just a single module, but it will also open the door to iterating
over all linked libraries too, for example.
* dwflpp.cxx (dwflpp::setup_user): don't "save mod!" anymore
* tapsets.cxx (probe_table -> sdt_query): convert to a query-style
class, and also take over the task of iterating over the probes.
(dwarf_builder::build): leave the iteration to sdt_query
Josh Stone [Tue, 21 Jul 2009 01:01:40 +0000 (18:01 -0700)]
PR10424: Consider each tracepoint header separately
With the current monolithic tracepoint query module, a failure in any of
the discovered tracepoint headers means that you can't use any of the
others either. This patch creates a separate query module for each
header so they can pass or fail independently.
* buildrun.cxx (make_tracequery): take a single header name instead of
globbing for everything we can find.
* hash.cxx (find_tracequery_hash): name the header file we're hashing.
* tapsets.cxx (tracepoint_query::handle_query_func): make sure we don't
duplicate tracepoints found through different headers.
(tracepoint_builder::get_tracequery_module): get a header's module
(tracepoint_builder::init_dw): glob for all tracepoint headers, and
feed all their modules into dwflpp.
Josh Stone [Mon, 20 Jul 2009 23:32:33 +0000 (16:32 -0700)]
Allow dwflpp to take a vector of module names
This will be used to load tracepoint modules as a bunch of little query
modules into a single dwflpp.
* dwflpp.cxx (setup_user): take a vector instead of a single module
(dwflpp::dwflpp): form a vector in the singular case, and add a
variant that takes and passes through a vector of modules.
Josh Stone [Mon, 20 Jul 2009 23:25:35 +0000 (16:25 -0700)]
Return hash module values directly as strings
* session.h (systemtap_session): remove tracequery_path
* hash.cxx (find_tracequery_hash, find_typequery_hash): return strings
* tapsets.cxx (dwarf_cast_expanding_visitor::filter_special_modules):
get the hashed path from the return value instead of a parameter
(tracepoint_builder::init_dw): ditto, and don't stuff it in session
David J. Wilder [Mon, 20 Jul 2009 23:08:42 +0000 (16:08 -0700)]
Fixes for 2.6.31. There are some changes in sk_buff structure those cause
failures of compiling ipmib.stp and tcpmib.stp, rtable and dst fields are
deleted.
David Smith [Mon, 20 Jul 2009 20:25:01 +0000 (15:25 -0500)]
Fixed PR 10386 by removing the need to convert a pid to a task.
* runtime/itrace.c (usr_itrace_init): Changed prototype to take a
task_struct instead of a pid.
* tapset-itrace.cxx (emit_module_decls): Updated usr_itrace_init() call.
* runtime/autoconf-find-task-pid.c: Removed, since only user_itrace_init()
was using it.
* buildrun.cxx (compile_pass): Removed autoconf-find-task-pid.c test.
Stan Cox [Mon, 20 Jul 2009 14:20:23 +0000 (10:20 -0400)]
* tapsets.cxx (dwarf_builder::probe_table::convert_probe):
First check kprobe and utrace (did we arrive via stap?) then check
if probe arg matches mark("NAME")
* sdt.h (STAP_PROBE?_): Use STAP_GUARD for stap check, not gettid.
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.