Tim Moore [Tue, 22 Dec 2009 22:30:56 +0000 (23:30 +0100)]
grapher: remove _zoomFactor from horizontal scaling calculation
This makes zooming more consistent and less buggy.
* grapher/Graph.cxx (Graph::draw): Set graph time spread using
_zoomFactor.
* grapher/Graph.hxx (Graph::getHorizontalScale): no _zoomFactor
* grapher/GraphWidget.cxx (on_motion_notify_event): Dragging increment
uses _zoomFactor.
(on_scroll_event): Set extents after changing the zoom factor with
the scroll wheel.
Tim Moore [Tue, 22 Dec 2009 18:48:20 +0000 (19:48 +0100)]
grapher: scale from right end of graph
The right side of the graph represents the most recent time. Since
there is never anything interesting to the right of that, it makes
sense to have the origin of the scaling be there.
* grapher/Graph.hxx (getHorizontalScale): new function
* grapher/GraphStyle.cxx (GraphStyleBar::draw, GraphStyleDot::draw,
GraphStyleEvent::draw): Use cairo transform functions to set up
scaling.
(GraphStyleBar::dataIndexAtPoint, GraphStyleEvent::dataIndexAtPoint):
Base calculations on scaling from right.
Tim Moore [Tue, 22 Dec 2009 10:35:38 +0000 (11:35 +0100)]
grapher: scroll continuously with time
Don't scale graph based on how much data will fit. This didn't work
very well and resulted in distracting, weird scale changes. We now
assume that scripts output their time (x axis) in milliseconds.
* grapher/Graph.hxx (setCurrentTime): New function.
* grapher/Graph.cxx (Graph::draw): Assume a fixed default scale of 1
pixel = 5 milliseconds and don't do any autoscaling.
* grapher/GraphWidget.cxx (GraphWidget constructor): Set global time
base on startup.
(on_expose_event): Don't search graphs for earliest time.
* grapher/GraphWidget.hxx (_timeBaseInitialized): delete
* grapher/Time.hxx: new file; interface to timeval.
Mark Wielaard [Mon, 21 Dec 2009 12:02:19 +0000 (13:02 +0100)]
PR11015 Support shared library reloading (in different processes)
* runtime/task_finder_vma.c (stap_remove_vma_map_info): Return negative
status on failure.
(stap_find_vma_map_info): Likewise.
(stap_find_vma_map_info_user): New function.
(stap_drop_vma_maps): New function.
* runtime/sym.h (addr): Renamed to static_addr, to store addresses for
sections which are always mapped at the same address.
(_stp_module_relocate): Add extra struct task_struct *tsk argument.
* runtime/sym.c (_stp_tf_exec_cb): New callback, calls stap_drop_vma_maps.
(_stp_tf_mmap_cb): Don't store address in module.section, but call
stap_add_vma_map_info() per tsk->group_leader for matched module.
Don't register empty/null modules.
(_stp_module_relocate): Take extra struct task_struct *tsk argument,
cache last tsk used. Only use section->static_addr for none dynamic
modules. Use stap_find_vma_map_info_user() to locate dynamic modules.
(_stp_mod_sec_lookup): Add extra argument unsigned long *rel_addr to
optionally store relative address when module/section found.
(_stp_kallsyms_lookup): Use _stp_mod_sec_lookup to find relative address.
(_stp_sym_init): Register _stp_tf_exec_cb in stap_task_finder_target.
Add error check to see if task finder could be initialized.
* dwflpp.cxx (emit_address): Pass NULL for kernel/modules and current for
user tasks to _stp_module_relocate.
* runtime/transport/symbols.c (_stp_do_relocation): Set new static_addr
_stp_section field.
* runtime/unwind.c (adjustStartLoc): Take new struct task_struct *tsk
argument and pass to stap_find_vma_map_info_user and _stp_module_relocate
to find adjusted addr.
(_stp_search_unwind_hdr): Pass through struct task_struct *tsk.
(unwind_frame): Likewise.
* tapset/context-symbols.stp (probemod): Add NULL to _stp_mod_sec_lookup
call to indicate we aren't interested in relative address.
* tapsets.cxx (dwarf_derived_probe_group::emit_module_init): Pass NULL to
_stp_module_relocate to indicate kernel/module address.
Josh Stone [Tue, 22 Dec 2009 02:26:47 +0000 (18:26 -0800)]
PR11112: Check the full %m/M buffer, and limit the length
We already had code in place to try a deref on the requested memory
buffer, but it was missing the static-precision case. Thus, it was
possible to craft an address that would pass the check on the first byte
but would pagefault at the end of the buffer.
While we're at it, we should also be limiting the number of bytes in
such a read, so even legitimately-huge buffers won't chew up kernel
time. I've arbitrarily chosen 1024 as the limit, but we can revisit
that later. (see also PR10490)
TODO: we need a reliable testcase where a starting address is valid but
the end address is bogus. In PR11112, the reproducer was using a huge
precision to run off the heap, but we need something that will
consistently work even with <1024 length.
Mark Wielaard [Mon, 21 Dec 2009 12:02:19 +0000 (13:02 +0100)]
PR11015 Support shared library reloading (in different processes)
* runtime/task_finder_vma.c (stap_remove_vma_map_info): Return negative
status on failure.
(stap_find_vma_map_info): Likewise.
(stap_find_vma_map_info_user): New function.
(stap_drop_vma_maps): New function.
* runtime/sym.h (addr): Renamed to static_addr, to store addresses for
sections which are always mapped at the same address.
(_stp_module_relocate): Add extra struct task_struct *tsk argument.
* runtime/sym.c (_stp_tf_exec_cb): New callback, calls stap_drop_vma_maps.
(_stp_tf_mmap_cb): Don't store address in module.section, but call
stap_add_vma_map_info() per tsk->group_leader for matched module.
Don't register empty/null modules.
(_stp_module_relocate): Take extra struct task_struct *tsk argument,
cache last tsk used. Only use section->static_addr for none dynamic
modules. Use stap_find_vma_map_info_user() to locate dynamic modules.
(_stp_mod_sec_lookup): Add extra argument unsigned long *rel_addr to
optionally store relative address when module/section found.
(_stp_kallsyms_lookup): Use _stp_mod_sec_lookup to find relative address.
(_stp_sym_init): Register _stp_tf_exec_cb in stap_task_finder_target.
Add error check to see if task finder could be initialized.
* dwflpp.cxx (emit_address): Pass NULL for kernel/modules and current for
user tasks to _stp_module_relocate.
* runtime/transport/symbols.c (_stp_do_relocation): Set new static_addr
_stp_section field.
* runtime/unwind.c (adjustStartLoc): Take new struct task_struct *tsk
argument and pass to stap_find_vma_map_info_user and _stp_module_relocate
to find adjusted addr.
(_stp_search_unwind_hdr): Pass through struct task_struct *tsk.
(unwind_frame): Likewise.
* tapset/context-symbols.stp (probemod): Add NULL to _stp_mod_sec_lookup
call to indicate we aren't interested in relative address.
* tapsets.cxx (dwarf_derived_probe_group::emit_module_init): Pass NULL to
_stp_module_relocate to indicate kernel/module address.
Frank Ch. Eigler [Fri, 18 Dec 2009 17:20:52 +0000 (12:20 -0500)]
PR10601 part 1: i386 and x86-64 regset for dwarf fetch/store_register()s
* runtime/loc2c-runtime.h (fetch_register, store_register):
forked into k_ (kernel) and u_ (user) varieties. Implement
i386 and x86_64 in terms of regset.h; fall back to k_* for
other architectures.
* tapsets.cxx: (*::visit_target_symbol): Emit macros to map
loc2c's fetch/store_register to loc2c-runtime's k_ or u_ as
appopriate.
Tim Moore [Fri, 18 Dec 2009 16:56:24 +0000 (17:56 +0100)]
Remove uprobes.h declaration from runtime.h
Turns out that it breaks on kernels that don't have utrace.
* runtime/runtime.h : Don't include uprobes.h
* runtime/stack.c: Include uprobes.h
* runtime/stack-i386.c: Check if uprobes is included at all.
* runtime/stack-x86_64.c: ditto
* tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): put
uprobes.h include back in.
William Cohen [Thu, 17 Dec 2009 22:51:16 +0000 (17:51 -0500)]
Remove blank line in ucontext-unwind.stp for SystemTap Tapset Reference Manual
The automatic documentation extraction doesn't allow blank lines between the
the comment and the actual code. Removed the problem blank line to allow
the information to be extracted for the SystemTap Tapset Reference Manual.
Tim Moore [Thu, 17 Dec 2009 15:18:34 +0000 (16:18 +0100)]
support for a brief backtrace format
This only prints symbol+offset, or an address if the symbol isn't
known.
* runtime/runtime.h (SYM_VERBOSE_NO, SYM_VERBOSE_FULL,
SYM_VERBOSE_BRIEF): new constants
* runtime/stack.c (_stp_stack_print): support brief format
* runtime/sym.c (_stp_func_print): ditto
* tapset/ucontext-unwind.stp (print_ubacktrace_brief): new function
* testsuite/systemtap.context/fib.c: new test program
* testsuite/systemtap.context/fib.stp: new test
* testsuite/systemtap.context/fib.exp: new test
Tim Moore [Wed, 16 Dec 2009 11:00:55 +0000 (12:00 +0100)]
set the IP in return probes to the returned-to instruction
It's easily available in kretprobes and uretprobes and is consistent
with the rest of the program state.
* translate.cxx (emit_common_header) : add uretprobe_instance to context.
* tapsets.cxx (common_probe_entryfn_prologue): Initialize ri in
context to 0.
(dwarf_derived_probe_group::emit_module_decls): Change IP to return
address in kretprobes.
(uprobe_derived_probe_group::emit_module_decls): enter_uretprobe_probe:
set ri (uretprobe_instance) in context. Change IP to return
address in uretprobes. Don't emit uprobe include and #define
* runtime/runtime.h : Add includes and #define for uprobes.
* runtime/stack.c (_stp_stack_print, _stp_stack_snprint): Add extra
argument for uretprobe_instance.
* tapset/context-unwind.stp (print_backtrace, backtrace): Pass NULL
for uretprobe_instance to _stp_stack_print.
* tapset/ucontext-unwind.stp (print_ubacktrace, ubacktrace): pass
uretprobe_instance to _stp_stack_print
* testsuite/systemtap.context/uprobe_uaddr.exp : new test for uaddr in
function probes
* testsuite/systemtap.context/uprobe_uaddr.stp : new file
Dave Brolley [Mon, 14 Dec 2009 18:08:45 +0000 (13:08 -0500)]
PR 10905: stap-server initscript improvements
o Handle, -B, -I, -R options
o Allow specification of servers by pid
o Allow specification of servers by nickname.
o Advertise options used using avahi.
Use regs->ARM_cpsr instead, this should work with all versions
of linux found in git repo (versions >=2.6.12-rc2). Difference
between condition_codes() and regs->ARM_cpsr should not matter
for systemtap.
Stan Cox [Fri, 11 Dec 2009 21:59:55 +0000 (16:59 -0500)]
Use env(SYSTEMTAP_TESTAPPS) for all systemtap.apps
mysql.exp: Use env(SYSTEMTAP_TESTAPPS).
(mysqlrelease): Update and check for download failure.
postgres.exp: Use env(SYSTEMTAP_TESTAPPS).
stap-tcl.stp: Use .library("library").mark("mark").
tcl.exp: Likewise.
Tim Moore [Fri, 11 Dec 2009 13:03:47 +0000 (14:03 +0100)]
grapher: implement restarting a stap process
* grapher/StapParser.cxx (StapParser::disconnect): new function
* grapher/StapParser.hxx (StapProcess::StapProcess): initialize argv to 0
* grapher/grapher.cxx (StapLauncher::setArgs): Set argv to 0
(StapLauncher launch, launchUsingParser): Refactor launch(),
extracting function a that (re)launches a stap process using an
existing parser.
(StapLauncher::onChildDied): call disconnect() on dead parser.
(GrapherWindow::_graphicalLauncher, setGraphicalLauncher): delete
member, replacing with...
(graphicalLauncher): new variable
(ProcModelColumns): Store parser object in the list model instead of
just a StapProcess object.
(ProcWindow::onRestart): new function
(ProcWindow::refresh): Preserve the list selection when the process
list is refreshed.
(ProcWindow::onSelectionChanged): Manage the restart button's state.
Tim Moore [Thu, 10 Dec 2009 20:34:27 +0000 (21:34 +0100)]
grapher: integrate graph events from stdin with the stap process framework.
This was the original way to do graphing and had bitrotted some.
* grapher/StapParser.cxx (initIO): new catchHUP argument
(ioCallback): Only disconnect signals, etc. on IN_HUP if catchHUP is
true.
(errIoCallback): Write error messages to stderr, not stdout.
* grapher/grapher.cxx (StapLauncher::launch): Don't catchHUP on our
stap process children.
(ProcWindow::refresh): Display something reasonable for the stap
"process" that is feeding stdin.
(main): Use StapParser::initIO to initialize parser reading from
stdin.
Tim Moore [Thu, 10 Dec 2009 14:11:08 +0000 (15:11 +0100)]
grapher: more implementation stap process window
The process arguments are displayed, and the "kill" button is
insensitive when a process is dead or nothing is selected.
* grapher/grapher.cxx (ProcWindow _killButton, _restartButton,
_stapArgsLabel, _scriptArgsLabel): new members
(ProcWindow::ProcWindow): hook 'em up
(ProcWindow::onSelectionChanged): Enable / disable kill button and
display process arguments.
* grapher/processwindow.glade: Replace bizzare handle window with a
horizontal pane. Tweak various widget sizes.
Tim Moore [Thu, 10 Dec 2009 12:13:30 +0000 (13:13 +0100)]
grapher: change SIGCHLD handling and exit cleanup
The signal handler now calls waitpid() and writes the pid and status
to its pipe.
* grapher.cxx (ChildInfo): new class
(handleChild): wait for zombies and write their status down the
pipe.
(ChildDeathReader::ioCallback): Read dead child's pid from signal
handler pipe and emit signal.
(ChildDeathReader::reap): delete
(ChildDeathReader::Callback): delete
(StapLauncher::StapLauncher): Connect to childDied signal.
(StapLauncher setWinParams, reap, cleanUp): delete
(onChildDied): new function that updates the parsers list when a
child dies.
(GrapherWindow): Remove ChildDeathReader::Callback base class
(GrapherWindow::onParserListChanged): New function; exits if program
is quitting and no parsers are left.
(on_menu_file_quit): Kill all children; don't hide (and exit) unless
there are no parsers.
(main): Don't do any cleanup after Gtk loop exits.
Roland McGrath [Thu, 10 Dec 2009 01:30:52 +0000 (17:30 -0800)]
Begin to parameterize loc2c for proper DWARF target address size.
* loc2c.c (stack_slot_type): New function.
(translate): Use it in place of STACK_TYPE and UTYPE macros.
(emit_loc_address, emit_loc_value, c_emit_location): Likewise.
Anton Vorontsov [Fri, 4 Dec 2009 04:37:56 +0000 (07:37 +0300)]
Fix regression in statistic operations
In commit 98c783852039061db8c1611742660aaded0eab77 ("Use proper types
for do_div") I imprudently changed some variables to an unsigned type
while in some places the code actually relies on a sign.
So, let's be a bit smarter now and use temporary variables.
Reported-by: Wenji Huang <wenji.huang@oracle.com> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>