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>
Tim Moore [Wed, 9 Dec 2009 21:09:39 +0000 (22:09 +0100)]
show the status of stap processes in the process window
Also, the "kill" button now works.
* grapher/StapParser.hxx (_ioConnection, _errIoConnection): new
members for sigc connections.
(initIo): New function
(parsers, parserListChangedSignal): new variables
* grapher/StapParser.cxx (ioCallback): disconnect signals when child
dies
(initIo): new function
* grapher/grapher.cxx (StapLauncher): eliminate death callback in
favor of childDied signal. Use global parsers list
(ProcWindow::_listSelection): new member
(ProcWindow::show, hide, onParserListChanged, onSelectionChanged,
onKill): new functions
(ProcWindow::ProcWindow): Set up cell renderer for status icon
* grapher/processwindow.glade: labels for display script and stap arguments
Stan Cox [Wed, 9 Dec 2009 15:57:36 +0000 (10:57 -0500)]
Handle .probes section big endian 32 bit case.
sdt.h (STAP_PROBE_ADDR): Add 32 bit big endian case.
(STAP_PROBE_DATA_): Use .balign
tapsets.cxx (sdt_query::get_next_probe): Stop if there is no probe name.
Tim Moore [Tue, 8 Dec 2009 22:17:47 +0000 (23:17 +0100)]
grapher: start of a dialog for displaying active stap processes
The names of active scripts are displayed in a list; mock buttons
suggest being able to stop and restart them.
* grapher/processwindow.glade: new file
* grapher/Makefile.am: add processwindow.glade to installed files
* grapher/StapParser.hxx (StapProcess): new class
(StapParser): factor out members that are now in StapProcess
(ioCallback): Use the new childDied signal instead of aborting the
whole grapher when a child dies.
* grapher/grapher.cxx (ProcModelColumns, ProcWindow): classes for
displaying stap process window.
(GrapherWindow::on_menu_proc_window): new function
Tim Moore [Tue, 8 Dec 2009 11:44:03 +0000 (12:44 +0100)]
refactor list of data sets out of GraphWidget into a global data structure.
Also, add a sigc signal for broadcasting data set changes.
* grapher/GraphData.hxx (GraphDataList) new typedef
(getGraphData, graphDataSignal): new functions
* grapher/Graph.hxx (DatasetList): remove typedef in favor of
systemtap::GraphDataList
* grapher/GraphWidget.cxx (GraphWidget, onGraphDataChanged): Use
graphDataSignal to notice new data sets that need to be added. Use
the global data set list instead of one embedded in GraphWidget.
* grapher/StapParser.hxx: delete the _widget member; use signals to
broadcast that there are new data sets instead of calling into the widget.
Stan Cox [Tue, 8 Dec 2009 16:57:00 +0000 (11:57 -0500)]
Add .library("lib").mark("mark") and use it for .mark semaphores.
tapset-utrace.cxx (TOK_LIBRARY): New.
(utrace_derived_probe::utrace_derived_probe): Add library and has_library.
(utrace_builder::build): Handle library.
(utrace_derived_probe_group::emit_probe_decl): Add sdt_sem_offset to
emitted stap_utrace_probes. Add stap_task_finder_target
mmap_callback for handling shared library. Handle sdt_sem_offset in
emitted_stp_utrace_probe_cb. Add stap_utrace_mmap_found.
(register_tapset_utrace): Handle .library
tapset-utrace.cxx (TOK_LIBRARY): New.
(base_query::base_query): Add path and has_library.
(dwarf_derived_probe::dwarf_derived_probe) Likewise.
(dwarf_derived_probe::register_patterns): Handle .library
(sdt_query::convert_location): Likewise.
(dwarf_builder::build): Likewise.
(uprobe_derived_probe_group::emit_module_decls): Emit
sdt_sem_address. Add sdt_sem_offset to emitted stap_uprobe_spec.
Add offset and vm_flags to signature of stap_uprobe_change_plus, and
handle sdt_sem_offset. Allow writeable segments in emitted
stap_uprobe_mmap_found.
sdt_misc.exp: Test .library
util.cxx (find_executable): Add env_path to sig and use it in getenv.
util.h (find_executable): Likewise. Make "PATH" the default.
dtrace.in (provider): Turn on semaphores.
sdt.h: Likewise.
David Smith [Mon, 7 Dec 2009 21:17:58 +0000 (15:17 -0600)]
PR 10641 fixed by checking module name in unprivileged mode.
* main.cxx (checkOptions): If in unprivileged mode, make sure module name
starts with 'stap_'.
* testsuite/parseko/cmdline05.stp: New testcase.
* testsuite/parseok/cmdline03.stp: New testcase.
Tim Moore [Mon, 7 Dec 2009 17:51:55 +0000 (18:51 +0100)]
make the list items in the data set list unselectable
The checkbox selects the list, so it is just sloppy to allow the item
to be selected.
* grapher/GraphWidget.hxx (no_select_fun): New function; just returns
false.
* grapher/GraphWidget.cxx (GraphWidget): Connect list store selection
to function that prevents selection.
Tim Moore [Mon, 7 Dec 2009 15:50:44 +0000 (16:50 +0100)]
Change data set list display to use a check box for inclusion in a graph
Incidently, this supports removing a data set from a graph.
Also, remove the Add, Remove, and Cancel buttons from the data set dialog.
* grapher/GraphWidget.hxx (DataModelColumns::_dataEnabled): new member
_listConnection: new member
* grapher/GraphWidget.cxx (GraphWidget): Delete connections for
removed buttons. Connect to dialog show and hide signals instead of
map. Add "Enabled" column to dialog list.
(onDataAdd, onDataRemove): delete
(onDataDialogOpen): Initialize list store with all data sets and
hook up row_changed signal
(onDataDialogClose, onRowChanged): new functions
* grapher/graph-dialog.glade: Remove obsolete buttons (Add, Remove, Cancel).
Tim Moore [Mon, 7 Dec 2009 11:43:56 +0000 (12:43 +0100)]
option to display graph times relative to the start time
This avoids having humongous numbers displayed on the graphs' x
axis. Also, the dialog for adding a data set to a graph was cleaned
up.
* grapher/graph-dialog.glade: Add check box for display of relative
time and a label for the data set list. Force the list of data sets
to be larger.
* grapher/Graph.hxx (_timeBase): new member
* grapher/Graph.cxx (draw): Subtract _timeBase from displayed time
value.
* grapher/GraphWidget.hxx (DataModelColumns): Add a column for a data
set's title, which is optional at the moment.
* grapher/GraphWidget.hxx (_globalTimeBase, _timeBaseInitialized,
_relativeTimesButton, _displayRelativeTimes): new members
* grapher/GraphWidget.hxx (GraphWidget): Hook up check button for
displaying relative time.
(on_expose_event): Determine base time if needed; set base time in
graphs.
(onDataDialogOpen): Insert graph data set's name (key) and title
into the list of data sets.
Tim Moore [Fri, 4 Dec 2009 16:12:06 +0000 (17:12 +0100)]
hover text on the additional graphs
* grapher/Graph.cxx (window2GraphCoords): Take the entire graph's
position into account too.
* grapher/GraphWidget.cxx (GraphWidget): Hook up the data dialog's OK
button.
(onDataDialogOpen): If a data set doesn't have a title, use it's
name (key) instead.
Tim Moore [Fri, 4 Dec 2009 13:11:25 +0000 (14:11 +0100)]
tweak multiline hover text to have proper interline spacing
* grapher/CairoWidget.cxx (CairoTextBox::draw): Use font information
to caculate legible spacing. Also change the font to something more
readable.
* testsuite/systemtap.examples/general/grapher.stp: Put carriage
returns in the right spots.
Tim Moore [Fri, 4 Dec 2009 12:08:01 +0000 (13:08 +0100)]
support multiline data output from scripts run under the grapher
This is accompanied by support for multiline output in hover text.
* grapher/StapParser.cxx (ioCallback): Read data 'til the end of line
character, not just '\n'. Be careful to use I/O functions that don't
treat '\n' specially.
* grapher/StapParser.hxx: ditto
* grapher/CairoWidget.cxx (CairoTextBox::draw): Perform line breaks
for hover text.
* testsuite/systemtap.examples/general/grapher.stp: Do multiline
output of keyboard events. Also, fix longstanding breaking in the
pty probe.
Tim Moore [Thu, 3 Dec 2009 18:31:08 +0000 (19:31 +0100)]
Hover text for event-style graphs
Don't draw the data value for an event; only display it in hover text.
* grapher/Graph.hxx (window2GraphCoords): new function
* grapher/Graph.cxx (window2GraphCoords): ditto
* grapher/GraphStyle.cxx (GraphStyleEvent::dataIndexAtPoint): new
function implementation.
David Smith [Wed, 2 Dec 2009 21:16:10 +0000 (15:16 -0600)]
Fix PR 11034 by directly allocating per-cpu context data.
* translate.cxx (emit_common_header): Change type of 'contexts' to an
array of struct context pointers.
(emit_module_init): Allocate a context structure for each possible cpu.
Free each if an error occurs.
(emit_module_exit): Update contexts reference. Free each possible cpu's
context structure.
* tapsets.cxx (common_probe_entryfn_prologue): Use array instead of percpu
data for context structure.
Tim Moore [Wed, 2 Dec 2009 18:27:07 +0000 (19:27 +0100)]
Make the hover text conform to data displayed.
Start of code to be more selective about the association between the
hover text and the underling graph. Also, show the data set name in hover text.
* grapher/GraphStyle.hxx (dataIndexAtPoint): New virtual function.
* grapher/GraphStyle.cxx (dataIndexAtPoint): Implementation for bar graphs
* grapher/GraphWidget.cxx (onHoverTimeout): Use dataIndexAtPoint.
Anton Vorontsov [Fri, 27 Nov 2009 22:33:47 +0000 (01:33 +0300)]
Use proper types for do_div
do_div accepts unsigned 64-bit integer type for dividend, signed types
would cause do_div's typecheck fail:
stat-common.c: In function 'needed_space':
stat-common.c:50: error: comparison of distinct pointer types lacks a cast
...same errors in time.c and tapset-timers.cxx's generated code...
A fix for time.c is special, on ppc32 cycles_t is 32-bit, so technically
we don't need do_div, but since the whole _stp_gettimeofday_ns() operates
on 64-bit types we'd better be safe and use uint64_t for the math.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Anton Vorontsov [Fri, 27 Nov 2009 22:33:51 +0000 (01:33 +0300)]
Change KERNEL_RELOC_SYMBOL to "_stext" on ppc32
Currently staprun fails at send_relocation_kernel(), this is because
ppc32 doesn't have ".__start" symbol. I think we should use _stext,
just as other arches.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Mark Wielaard [Tue, 1 Dec 2009 13:29:51 +0000 (14:29 +0100)]
Convert string.stp documentation to standard markup.
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Add string.stp chapter.
* tapset/string.stp: Convert documentation to standard markup and add
documentation that was missing.