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.
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