]> sourceware.org Git - systemtap.git/log
systemtap.git
8 years agoRemove functioncall::var_assigned_to_retval
Josh Stone [Wed, 25 Nov 2015 22:10:17 +0000 (14:10 -0800)]
Remove functioncall::var_assigned_to_retval

It's unusual to have a value specific to one visitor stored in the tree
node itself.  This particular value is only used by c_unparser.  Make it
a c_unparser member instead, saved and restored as necessary to allow
for nested calls.

8 years agoMerge branch 'master' of ssh://sourceware.org/git/systemtap
Josh Stone [Wed, 25 Nov 2015 01:26:03 +0000 (17:26 -0800)]
Merge branch 'master' of ssh://sourceware.org/git/systemtap

8 years agoPR18884 bonus: optimize tmps in more places
Josh Stone [Wed, 25 Nov 2015 01:23:25 +0000 (17:23 -0800)]
PR18884 bonus: optimize tmps in more places

Anywhere a tmpvar is subject to a single assignment, use the new
c_assign which can use an override with literal values.

8 years agoPR18884: skip tmps for any literal, not by tok->type
Josh Stone [Wed, 25 Nov 2015 01:12:35 +0000 (17:12 -0800)]
PR18884: skip tmps for any literal, not by tok->type

Some literal expressions get created dynamically, like const-folding an
expression of two literals.  Those will probably not have a tok->type
that looks like a literal, but they're still reasonable candidates to
skip temporary storage and output directly into C.

Add a new c_assign for any tmpvar=expression, which will check for
literals to override the tmp, or else assign them as normal.  Literals
are detected with a dynamic_cast of the expression, without looking at
the token at all.  In many places that were roughly doing this based on
tok->type, use the new c_assign to handle it automatically.

The new test transok/literal_tmp.stp compares the PR18884 examples,
asserting that they now have *exactly* the same generated code.

8 years agoRestrict optimization of literals in "%s\n" to streams only
Josh Stone [Tue, 24 Nov 2015 22:55:56 +0000 (14:55 -0800)]
Restrict optimization of literals in "%s\n" to streams only

This "use_print" optimization is only effective for printing to streams
with _stp_print().  Then a literal string argument to "%s\n" can just
have that literal token-pasted with the newline string.  But when
printing to strings, like sprintln, that optimization isn't actually
taken, so it was getting the newline twice.

Add new tests with sprint and sprintln on string literals, then clean up
the code that does the optimization -- for streams only.

8 years agotestsuite: swap dot.exp and sprint.exp
Josh Stone [Tue, 24 Nov 2015 22:36:02 +0000 (14:36 -0800)]
testsuite: swap dot.exp and sprint.exp

These two test drivers had swapped names for their respective .stp
files.  The contents are unchanged, just rename-swapped.

8 years agoEliminate the use of tex(nomencl.sty) in TeX documentation files
William Cohen [Tue, 24 Nov 2015 01:22:26 +0000 (20:22 -0500)]
Eliminate the use of tex(nomencl.sty) in TeX documentation files

RHEL 7 does not package the nomencl.sty file and having this style
file used in systemtap makes it difficult to build the documentation.
The only place it was being used was in the tutorial.tex and it was
not generating a useful glossary.  The glossary generation of
tutorial.tex has been disabled for the time being.

8 years agoparse: intern keywords
Josh Stone [Mon, 23 Nov 2015 22:47:55 +0000 (14:47 -0800)]
parse: intern keywords

8 years agoparse: check atwords without an explicit '@'
Josh Stone [Mon, 23 Nov 2015 22:38:52 +0000 (14:38 -0800)]
parse: check atwords without an explicit '@'

8 years agoparse: unorder keywords and atwords
Josh Stone [Mon, 23 Nov 2015 22:36:21 +0000 (14:36 -0800)]
parse: unorder keywords and atwords

8 years agoSupport backspace handling in monitor mode for probe toggling.
Felix Lu [Mon, 23 Nov 2015 20:07:51 +0000 (15:07 -0500)]
Support backspace handling in monitor mode for probe toggling.

8 years agoSwap argument order to check for bytes written.
Felix Lu [Mon, 23 Nov 2015 19:47:13 +0000 (14:47 -0500)]
Swap argument order to check for bytes written.

8 years agoFix monitor mode to be compatible with the private global feature.
Felix Lu [Mon, 23 Nov 2015 18:53:26 +0000 (13:53 -0500)]
Fix monitor mode to be compatible with the private global feature.

The synthetic functions and variables did not have a __global_
prefix, causing the symbol resolution to fail at finding them.
Commit 0c7e069fe82 assumes that there is a token for every probe
while two synthetic probes are generated in monitor mode with
null context. parse_synthetic_probe uses "<synthetic>" again
if no token is found for the probe. The __global_ prefix is shown
in monitor mode where global variables are shown so they needed
to be unmangled as done in commit 8f54215ef850c809.

* elaborate.cxx: above changes
* parse.cxx: fall back to "<synthetic>" if token is nullptr
* staprun/monitor.c: use return values of function calls
* staptree.cxx: check for token nullptr in functiondecl::printsig

8 years agoFix undeclared pipe2 problem.
Felix Lu [Mon, 23 Nov 2015 16:10:43 +0000 (11:10 -0500)]
Fix undeclared pipe2 problem.

Use pipe and fcntl instead.

8 years agotestsuite: allow pn to report *both* open and openat
Josh Stone [Fri, 20 Nov 2015 22:27:35 +0000 (14:27 -0800)]
testsuite: allow pn to report *both* open and openat

8 years agotestsuite: add a semicolon in perf.sh function poly()
Josh Stone [Fri, 20 Nov 2015 22:26:41 +0000 (14:26 -0800)]
testsuite: add a semicolon in perf.sh function poly()

8 years agoMerge branch 'funstuff'
Josh Stone [Fri, 20 Nov 2015 20:15:57 +0000 (12:15 -0800)]
Merge branch 'funstuff'

8 years agoFix undeclared F_SETPIPE_SZ error
Felix Lu [Fri, 20 Nov 2015 19:05:45 +0000 (14:05 -0500)]
Fix undeclared F_SETPIPE_SZ error

Removed usage for now. This may be needed later to ensure
pipe does not overflow.

8 years agoFixed PR19275 by updating stap_run.
David Smith [Fri, 20 Nov 2015 16:53:51 +0000 (10:53 -0600)]
Fixed PR19275 by updating stap_run.

* testsuite/lib/stap_run.exp: The stap_run() function now fails if it
  receives any unexpected output. The 'all_pass_string' was modified to be
  only one copy of "systemtap test success" instead of allowing of
  multiple copies.
* testsuite/systemtap.base/array_slicing.exp: Handle stap_run
  changes. Also, fixed the test names so that they aren't '$test_name'.
* testsuite/systemtap.base/at_var_tracepoint.exp: Update for stap_run
  changes.
* testsuite/systemtap.base/at_var_tracepoint.stp: Ditto.
* testsuite/systemtap.base/be_order.stp: Ditto.
* testsuite/systemtap.base/div0.exp: Ditto.
* testsuite/systemtap.base/error_fn.exp: Ditto.
* testsuite/systemtap.base/global_init.stp: Ditto.
* testsuite/systemtap.base/global_var_kernel.exp: Ditto.
* testsuite/systemtap.base/global_vars.stp: Ditto.
* testsuite/systemtap.base/if.exp: Ditto.
* testsuite/systemtap.base/if.stp: Ditto.
* testsuite/systemtap.base/kprobes.exp: Ditto.
* testsuite/systemtap.base/logical_and.stp: Ditto.
* testsuite/systemtap.base/maxactive.exp: Ditto.
* testsuite/systemtap.base/pp.exp: Ditto.
* testsuite/systemtap.base/print.exp: Ditto.
* testsuite/systemtap.base/proc_by_pid.exp: Ditto.
* testsuite/systemtap.base/process_by_pid.exp: Ditto.
* testsuite/systemtap.base/procfs_maxsize.exp: Ditto.
* testsuite/systemtap.base/procfs_umask.exp: Ditto.
* testsuite/systemtap.base/stmt_counting.exp: Ditto.
* testsuite/systemtap.base/stmt_counting_functions.stp: Ditto.
* testsuite/systemtap.base/stmt_counting_straight.stp: Ditto.
* testsuite/systemtap.base/timers.exp: Ditto.
* testsuite/systemtap.base/tri.stp: Ditto.
* testsuite/systemtap.context/context_ns.exp: Ditto.
* testsuite/systemtap.context/pid_ns.stp: Ditto.
* testsuite/systemtap.context/usymfileline.exp: Ditto.
* testsuite/systemtap.printf/memory1.exp: Ditto.
* testsuite/systemtap.stress/current.exp: Ditto.

8 years agoupdate NEWS
Felix Lu [Fri, 20 Nov 2015 15:23:57 +0000 (10:23 -0500)]
update NEWS

8 years agoupdate systemtap.spec
Felix Lu [Thu, 19 Nov 2015 16:36:02 +0000 (11:36 -0500)]
update systemtap.spec

Include build requirements for json-c and ncurses.

8 years agoPR18848: Add manual testing readme guide
Felix Lu [Thu, 19 Nov 2015 15:14:54 +0000 (10:14 -0500)]
PR18848: Add manual testing readme guide

8 years agoPR18848: Only compile monitor mode if json-c and ncurses developer
Felix Lu [Thu, 19 Nov 2015 14:31:08 +0000 (09:31 -0500)]
PR18848: Only compile monitor mode if json-c and ncurses developer
libraries are installed. Updated automake/conf files.

* session.cxx: error if using monitor mode when not compiled with
required libraries

8 years agoPR18848: Fix pipe buffer overflow problem, improve monitor UI
Felix Lu [Tue, 17 Nov 2015 20:32:22 +0000 (15:32 -0500)]
PR18848: Fix pipe buffer overflow problem, improve monitor UI

The pipe used in monitor mode was not being read the moment
data was available, causing an overflow. pselect now watches
the pipe fd for data to read. The UI now cuts off the probe name
if terminal size is not wide enough.

8 years agoPR18848: fix json array string
Felix Lu [Mon, 16 Nov 2015 22:04:51 +0000 (17:04 -0500)]
PR18848: fix json array string

Arrays were not made into key-value pairs when global scalars were
turned into a json object. Currently, only the array sizes are shown.

8 years agoPR18848: add --monitor option in man/stap.1
Felix Lu [Mon, 16 Nov 2015 21:23:43 +0000 (16:23 -0500)]
PR18848: add --monitor option in man/stap.1

Stap man page now provides an overview of the --monitor option
along with the main commands.

8 years agoPR18848: add help page, switch to page scrolling for output
Felix Lu [Mon, 16 Nov 2015 20:05:28 +0000 (15:05 -0500)]
PR18848: add help page, switch to page scrolling for output

Status bar can be toggled to show a manual page describing the
various commands available. Module output now scrolls by pages
instead of lines.

8 years agoPR18848: Fix json parsing error
Felix Lu [Mon, 16 Nov 2015 16:40:36 +0000 (11:40 -0500)]
PR18848: Fix json parsing error

Quotes in the probe names for the json string were not escaped to
form a valid json object. They had to be escaped once for the
systemtap parser and once more for the json parser.

* elaborate.cxx: escape quotes twice when generating json string
* staprun/monitor.c: check for correct parse result

8 years agoPR18848: use a pipe to redirect module output instead of proc file
Felix Lu [Fri, 13 Nov 2015 14:50:54 +0000 (09:50 -0500)]
PR18848: use a pipe to redirect module output instead of proc file

The module output can be written directly into a pipe by the reader
thread for the monitor interface to read.

* runtime/monitor.c: deleted
* runtime/print_flush.c: removed monitor path
* staprun/monitor.c: read output from pipe
* staprun/relay.c: create pipe and redirect output
* translate.cxx: remove proc file creation

8 years agoPR18848: increase history limit of output queue, add more keybindings
Felix Lu [Mon, 9 Nov 2015 16:57:09 +0000 (11:57 -0500)]
PR18848: increase history limit of output queue, add more keybindings
for scrolling probes and output

History size increased to 8192, arrows keys and pageup/pagedown keys
can be used as an alternative for scrolling

8 years agoPR18848: add module output scrollback, status window now refreshed
Felix Lu [Mon, 9 Nov 2015 16:00:48 +0000 (11:00 -0500)]
PR18848: add module output scrollback, status window now refreshed
on input

Users can now use the u and d keys to scroll back and forward through
the output. The scrollback uses a moving window approach over a queue.
The status window is now updated upon input for a smoother experience.

8 years agoPR18848: add probe scrolling capability
Felix Lu [Wed, 4 Nov 2015 16:24:03 +0000 (11:24 -0500)]
PR18848: add probe scrolling capability

Users can now use j and k keys to scroll down and up the probe list
respectively.

8 years agoPR18848: increase timeout timer and remove strsignal
Felix Lu [Wed, 4 Nov 2015 14:49:36 +0000 (09:49 -0500)]
PR18848: increase timeout timer and remove strsignal

8 years agoPR18848: improve keyboard input response time
Felix Lu [Tue, 3 Nov 2015 21:18:01 +0000 (16:18 -0500)]
PR18848: improve keyboard input response time

pselect now watches stdin for input.

8 years agoPR18848: zero pad the uptime
Felix Lu [Tue, 3 Nov 2015 20:59:10 +0000 (15:59 -0500)]
PR18848: zero pad the uptime

Uptime was not padded before if the unit was a single digit value.

8 years agoPR18848: only handle SIGWINCH in monitor mode
Felix Lu [Tue, 3 Nov 2015 20:58:37 +0000 (15:58 -0500)]
PR18848: only handle SIGWINCH in monitor mode

8 years agoPR18848: move resizing functionality out of signal handler
Felix Lu [Tue, 3 Nov 2015 20:16:06 +0000 (15:16 -0500)]
PR18848: move resizing functionality out of signal handler

Calling many functions in signal handler may be unsafe. A global
variable is now set on SIGWINCH.

8 years agoPR18848: handle terminal resizing
Felix Lu [Tue, 3 Nov 2015 19:12:06 +0000 (14:12 -0500)]
PR18848: handle terminal resizing

The curses UI now adjusts it's windows to the new dimensions of the
terminal upon receiving a SIGWINCH.

8 years agoPR18848: display current probe input
Felix Lu [Mon, 2 Nov 2015 20:56:32 +0000 (15:56 -0500)]
PR18848: display current probe input

Input prompt now shows what the user has entered.

8 years agoPR18848: add command line option to specify interval for polling stats
Felix Lu [Mon, 2 Nov 2015 20:10:23 +0000 (15:10 -0500)]
PR18848: add command line option to specify interval for polling stats

Users can display the stats every N seconds with --monitor=N

* buildrun.cxx: append monitor interval.
* cmdline.cxx: --monitor optional argument
* session.cxx: new monitor_interval attribute
* staprun/common.c: parse --monitor optarg
* staprun/mainloop.c: decrease pselect timeout to poll input quicker
* staprun/monitor.c: render monitor stats every N seconds

8 years agoPR18848: improve monitor ui and refactor input function.
Felix Lu [Mon, 2 Nov 2015 14:36:05 +0000 (09:36 -0500)]
PR18848: improve monitor ui and refactor input function.

Improved hint on keyboard mappings. New function to write
to procfs interface.

8 years agoPR18848: add most functionality to curses interface
Felix Lu [Wed, 28 Oct 2015 18:44:35 +0000 (14:44 -0400)]
PR18848: add most functionality to curses interface

Currently, a file is used to redirect stp_print output to curses window.
Previous curses interface code in mainloop got refactored into monitor.c.

* runtime/monitor.c: New file. procfs functions for stp_print redirection
* runtime/print_flush.c: Redirect stp_print to curses interface in
  monitor mode
* staprun/monitor.c: New file implementing curses interface
* staprun/mainloop.c: Move code into monitor.c
* staprun/Makefile.*: Link json-c and curses library, include monitor.c
  to source list
* translate.cxx: Create procfs file for stp_print redirection

8 years agoPR18848: change json format and retain entire probe name.
Felix Lu [Tue, 27 Oct 2015 19:15:43 +0000 (15:15 -0400)]
PR18848: change json format and retain entire probe name.

* elaborate.cxx: global variables are no longer in a list.

8 years agoPR18848: Add json parser and comparators to allow sorting
Felix Lu [Wed, 21 Oct 2015 16:00:48 +0000 (12:00 -0400)]
PR18848: Add json parser and comparators to allow sorting

Probe list will be sorted at runtime based on a user input on
either name, hit count, or cycles.

* staprun/mainloop: include json-c and parse the monitor read interface.

8 years agoPR18848: modify printf format
Felix Lu [Wed, 21 Oct 2015 15:31:09 +0000 (11:31 -0400)]
PR18848: modify printf format

Format changed to %d from %lld

8 years agoPR18848: convert procfs read to json format
Felix Lu [Wed, 21 Oct 2015 13:33:01 +0000 (09:33 -0400)]
PR18848: convert procfs read to json format

Json format allows for easy sorting of probes through json arrays.
This can be done at runtime based on probe attributes.

* elaborate.cxx: convert monitor_mode_read to output json.

8 years agoPR18848: monitor status formatting
Felix Lu [Fri, 16 Oct 2015 20:29:35 +0000 (16:29 -0400)]
PR18848: monitor status formatting

Removed h:m:s indicators in uptime and global scalar values are now
displayed.

* elaborate.cxx: changes in monitor_mode_read()

8 years agoPR18848: output monitor data in stapio event loop
Felix Lu [Fri, 16 Oct 2015 15:50:39 +0000 (11:50 -0400)]
PR18848: output monitor data in stapio event loop

* staprun/mainloop.c: polls procfs monitor interface for data

8 years agoPR18848: remove print statement
Felix Lu [Thu, 15 Oct 2015 19:20:17 +0000 (15:20 -0400)]
PR18848: remove print statement

elaborate.cxx: removed a debug print statement

8 years agoPR18848: new command line argument -M for staprun
Felix Lu [Thu, 15 Oct 2015 18:51:24 +0000 (14:51 -0400)]
PR18848: new command line argument -M for staprun

Pass stap --monitor command to staprun.

* buildrun.cxx: add -M argument to flags
* staprun/common.c: -M option to parse_args
* staprun/mainloop.c: add a timeout to pselect in monitor mode
  to prevent blocking and allow the procfs monitor interface to
  be polled.
* staprun/staprun.h: monitor extern declaration

8 years agoPR18848: refactor functions
Felix Lu [Wed, 7 Oct 2015 18:56:11 +0000 (14:56 -0400)]
PR18848: refactor functions

Renamed the initialization function and removed some redundant
parameters.

8 years agoPR18848: move embedded code for module size into tapset
Felix Lu [Wed, 7 Oct 2015 17:42:24 +0000 (13:42 -0400)]
PR18848: move embedded code for module size into tapset

* elaborate.cxx: remove monitor synthetic function
* tapset/linux/context.stp: new module_size function

8 years agoPR18848: use jiffies tapset function
Felix Lu [Wed, 7 Oct 2015 15:33:59 +0000 (11:33 -0400)]
PR18848: use jiffies tapset function

Switch the implementation of uptime to use the jiffies and hz tapset
functions instead of using embedded C

* elaborate.cxx: remove old embedded C function to get uptime. Added
  a synthetic begin probe to obtain starting time. Synthetic variables
  are now hidden in monitor mode and not reset.
* translate.cxx: remove jiffies inclusion in monitor mode.

8 years agoPR18848: new procfs monitor mode option
Felix Lu [Tue, 6 Oct 2015 20:15:07 +0000 (16:15 -0400)]
PR18848: new procfs monitor mode option

Presents a procfs read interface to obtain data about the running
script and another procfs write interface to control the script

* cmdline.cxx: new "monitor" option
* cmdline.h: new field in enum
* elaborate.cxx: new functions monitor_mode_read and monitor_mode_write
  synthesizes procfs probes for the interfaces
* session.cxx: new monitor flag
* session.h: new monitor flag
* translate.cxx: extra code is generated to provide statistics for
  monitor mode, function emission is delayed to allow stap_probes to
  be first defined

8 years agoUpdate the PR19241 fix so that 'out_fd' gets correctly handled.
Martin Cermak [Fri, 20 Nov 2015 11:22:05 +0000 (12:22 +0100)]
Update the PR19241 fix so that 'out_fd' gets correctly handled.

This is an update to commit d879410b. Before this update, stap
in "stream mode" was using invalid output file descriptor per
https://sourceware.org/bugzilla/show_bug.cgi?id=19241#c2.

8 years agoAllow buildok/{rpc-all-probes,rpc-detailed} to access private var.
Martin Cermak [Fri, 20 Nov 2015 10:00:30 +0000 (11:00 +0100)]
Allow buildok/{rpc-all-probes,rpc-detailed} to access private var.

Tests buildok/rpc-all-probes.stp and buildok/rpc-detailed.stp are
examining '@__private30 global __rpc_create_args' array.  That can
only be accessed using '--compatible=2.9' by the test script.

This approach to testing private stuff will probably need to change
in the future.  For now, this update aligns buildok/{rpc-all-probes,\
rpc-detailed}.stp to other buildok tests examining private variables
or functions.

8 years agoMark c_tmpcounter final
Josh Stone [Fri, 20 Nov 2015 02:25:11 +0000 (18:25 -0800)]
Mark c_tmpcounter final

8 years agoRemove the last visitors from c_tmpcounter
Josh Stone [Fri, 20 Nov 2015 02:01:20 +0000 (18:01 -0800)]
Remove the last visitors from c_tmpcounter

Now c_tmpcounter doesn't doesn't have any duplicated visitors at all.
It only overrides a few key virtual methods in c_unparser to get the
functionality it needs.

8 years agoSubclass c_tmpcounter directly from c_unparser
Josh Stone [Fri, 20 Nov 2015 00:25:22 +0000 (16:25 -0800)]
Subclass c_tmpcounter directly from c_unparser

The c_tmpcounter is meant to be a shadow of c_unparser, walking the same
walk to declare the temps that c_unparser will need.  But this was done
manually in a fragile balancing act, with a lot of duplicated logic and
little to ensure it was correct unless it failed to compile at all.

Now c_tmpcounter is a subclass of c_unparser so it can be a real shadow,
truly walking the same walk via the exact same code.  The normal output
is just dumped into a nulled ostream for this pass.  When a var is
accessed the first time through its value(), c_tmpcounter writes its
declaration to the real ostream.  A var that's created but not used will
be left out automatically, like a tmpvar that gets an override().

8 years agoMark stap_staticmarkers-detailed.stp as ROOT_ONLY for dyninst
Josh Stone [Thu, 19 Nov 2015 21:20:03 +0000 (13:20 -0800)]
Mark stap_staticmarkers-detailed.stp as ROOT_ONLY for dyninst

You have to be root to read the protected staprun binary.  This already
had setup_kfail in the plain buildok.exp, so do the same for dyninst.

8 years agoAvoid using the nomencl compatible option
William Cohen [Thu, 19 Nov 2015 22:05:12 +0000 (17:05 -0500)]
Avoid using the nomencl compatible option

Some versions of nomencl such as the one on RHEL 5 are missing the
compatible option.  Thus, tutorial.tex should avoid using it so the
documentation can be built.

8 years agoImprove kmodule.exp by adding tests that load the module after stap.
David Smith [Thu, 19 Nov 2015 18:38:09 +0000 (12:38 -0600)]
Improve kmodule.exp by adding tests that load the module after stap.

* testsuite/systemtap.base/kmodule.exp: Add subtests that see if the same
  scripts work if the module is loaded after the systemtap module is
  loaded. This currently fails for non-dwarf kprobe probes (PR19216).

8 years agoMake testsuite/systemtap.base/switch_file.exp more robust.
David Smith [Wed, 18 Nov 2015 20:17:50 +0000 (14:17 -0600)]
Make testsuite/systemtap.base/switch_file.exp more robust.

8 years agoRefix PR18889 by switching to symbol_name+offset module probing.
David Smith [Wed, 18 Nov 2015 19:03:44 +0000 (13:03 -0600)]
Refix PR18889 by switching to symbol_name+offset module probing.

* tapsets.cxx: Add symbol_name+offset support for dwarf kprobes present in
  modules. This is somewhat based on work by James Bottomley from the
  following email:
    <https://sourceware.org/ml/systemtap/2008-q3/msg00182.html>
* runtime/transport/symbols.c (_stp_module_notifier): On kernel's >= 3.16,
  use symbol_name+offset probing for modules.
* runtime/linux/kprobes.c: Switch to using symbol_name+offset probing for
  modules.

8 years agoRevert "PR18889 part: module-init notification via module_{load,free} tracepoints"
David Smith [Wed, 18 Nov 2015 18:53:33 +0000 (12:53 -0600)]
Revert "PR18889 part: module-init notification via module_{load,free} tracepoints"

This reverts commit 2278079efc01124dd509241f6c6eadbd6e19cb2a. This code
will be replaced with a new method for handling probes in kernel module's
init sections.

8 years agoRevert "PR18889: switch to STP_TRACEPOINT* frontend for kernel tracepoint registration"
David Smith [Wed, 18 Nov 2015 18:52:08 +0000 (12:52 -0600)]
Revert "PR18889: switch to STP_TRACEPOINT* frontend for kernel tracepoint registration"

This reverts commit 2e67c14dad1c661d2ce0b0ed218b371c1af218ba. This code
will be replaced with a different method for handling probes in kernel
module's init sections.

8 years agoMake the "shebang trick" work for RPM packaged testcases.
Martin Cermak [Wed, 18 Nov 2015 10:00:07 +0000 (11:00 +0100)]
Make the "shebang trick" work for RPM packaged testcases.

Some testcases use the "shebang trick" described in stap_run_batch()
testsuite function.  Commit d2995e6f breaks this for RPM packaged
testcases by putting the absolute path to stap into the shebang.

This update reverts cb69017 update to stap_run_batch() and fixes the
specfile shebang rewriter instead, so that it only applies to
systemtap examples contained in the systemtap-client package, where
the "shebang trick" is unwelcome.  With this update, testcases
contained in the systemtap-testsuite RPM remain unchanged, so that
the "shebang trick" works for them.

8 years agoCompact print_format and its format_component
Josh Stone [Tue, 17 Nov 2015 23:31:00 +0000 (15:31 -0800)]
Compact print_format and its format_component

The delimiter doesn't need to be a full component -- just a simple
interned_string will do.  The format_component can compact its flags and
enum fields down to a single byte each, taking it from 48 bytes on
x86_64 to just 32 bytes.

8 years agoMerge branch 'master' into string_ref
Josh Stone [Tue, 17 Nov 2015 02:39:35 +0000 (18:39 -0800)]
Merge branch 'master' into string_ref

8 years agoStore tok_junk messages as an additional enum
Josh Stone [Tue, 17 Nov 2015 02:29:51 +0000 (18:29 -0800)]
Store tok_junk messages as an additional enum

There's a limited corpus of messages for tok_junk to use.  Rather than
wasting space for an empty string on every single token, which takes 32
bytes on Fedora 23 x86_64, we can store just an int-sized enum and
produce a string message from this.

This reduces struct token from 80 bytes to 48, saving 20% memory overall
when parsing large tapsets like qemu's.

8 years agoDrop the string name from struct probe
Josh Stone [Tue, 17 Nov 2015 01:58:13 +0000 (17:58 -0800)]
Drop the string name from struct probe

The name is only used occasionally, so saving the string is wasting
space.  It's simply "probe_"+index, so let's store the index as an
identifier, and generate the name on the fly.  This saves noticeable
time and space when parsing large tapsets like qemu's.

8 years agoDrop probe_name from several var_expanding_visitors
Josh Stone [Tue, 17 Nov 2015 01:56:24 +0000 (17:56 -0800)]
Drop probe_name from several var_expanding_visitors

None of these values are actually used -- probably cargo-copied from
some original visitor.

8 years agoMove trivial interned_string conversions into the header
Josh Stone [Tue, 17 Nov 2015 00:05:58 +0000 (16:05 -0800)]
Move trivial interned_string conversions into the header

This doesn't actually change much in performance, as they still have to
call the proper intern() function, but it does make backtraces from
intern() a little more direct to the source.

8 years agoTestsuite: Raise --rlimit-cpu, update stap_run_batch()
Martin Cermak [Mon, 16 Nov 2015 13:56:01 +0000 (14:56 +0100)]
Testsuite: Raise --rlimit-cpu, update stap_run_batch()

Need to increase --rlimit-cpu, since especially certain buildok
tests seem to reach the old value easily. It turns out that not
only "32-bit arm machines are quite slow", so not distinguishing
the machine type any more and just raising the treshold:

The goal is to raise the limit for low cost. Note that the
"-E 'probe timer.s(900) ...'' limit affects the generated source
that some testcases rely on verbatimely. So setting --rlimit-cpu
just slightly under 15 mins should improve test results without
need to modify those testcases source.

The stap_run_batch() update is needed to deal properly with RPM
packaged testcases, which have slightly modified source code
compared to their git versions due to commit d2995e6f. This update
is an addition to commit 6b131ba7 making it work with RPM packaged
testcases too.

8 years agoTerminate parsing on duplicate variable or function declaration.
Martin Cermak [Sat, 14 Nov 2015 18:17:27 +0000 (19:17 +0100)]
Terminate parsing on duplicate variable or function declaration.

This fixes condition that makes the parser stop on attempt to
declare duplicate global variable or function.  It also (newly)
makes the parser terminate on global versus private variable or
function declaration attempt.

This update makes parseko/eleven.stp and parseko/twelve.stp
expectedly fail.  It also adds parseko/private0[12].stp that
expectedly fail on attempt do declare conflicting global versus
private variable or function.

8 years agoparser: construct literal_string directly from t->content
Josh Stone [Sat, 14 Nov 2015 02:28:11 +0000 (18:28 -0800)]
parser: construct literal_string directly from t->content

We do have to use a local string buffer when literals are concatenated,
but this is a rare case.  Most often, we can use t->content directly.

8 years agoparser: use interned_string for expect targets
Josh Stone [Sat, 14 Nov 2015 02:24:32 +0000 (18:24 -0800)]
parser: use interned_string for expect targets

We can avoid a lot of intern->string->intern round trips this way.

8 years agoparse: use const& fname for decl parsing
Josh Stone [Sat, 14 Nov 2015 02:20:44 +0000 (18:20 -0800)]
parse: use const& fname for decl parsing

8 years agoConstruct print_format::print_format_string with an intern
Josh Stone [Sat, 14 Nov 2015 02:15:40 +0000 (18:15 -0800)]
Construct print_format::print_format_string with an intern

Since it's ending up as an interned_string, it's best to construct it as
such to pass through sharing from any source.  Now print_format::create
can pass through its t->content directly for this.

8 years agoTake a plain string for print_format::string_to_components
Josh Stone [Sat, 14 Nov 2015 02:12:51 +0000 (18:12 -0800)]
Take a plain string for print_format::string_to_components

This is mostly called with print_format::raw_components, which is a string,
and an interned value isn't needed for sharing within, so avoid it.

It might be nicer to make raw_components an interned_string itself, but a
few places in tapsets.cxx are building that string incrementally, so they'd
need a bit of refactoring to use separate string buffers first.

8 years agoConstruct literal_string from interned_string only
Josh Stone [Sat, 14 Nov 2015 01:52:01 +0000 (17:52 -0800)]
Construct literal_string from interned_string only

We don't need an explicit constructor from std::string, because the
conversion from string->interned_string is already implicit.

8 years agoAdd special treatment for single-char string interns
Josh Stone [Sat, 14 Nov 2015 01:49:04 +0000 (17:49 -0800)]
Add special treatment for single-char string interns

A large number of interned strings are just one character, mostly from
lexer tokens that aren't really sharing substrings yet.  Add a small
chartable to provide static memory for any given char to turn into a
string_ref(&c, 1).

8 years agoAdd special treatment for empty string interns
Josh Stone [Sat, 14 Nov 2015 01:44:08 +0000 (17:44 -0800)]
Add special treatment for empty string interns

Empty strings and NULL char* no longer reach the string table at all, but
just return a default empty interned_string().

8 years agoAdd an sdt probe in interned_string::intern
Josh Stone [Sat, 14 Nov 2015 01:39:06 +0000 (17:39 -0800)]
Add an sdt probe in interned_string::intern

Useful for analyzing what strings are being interned ($arg1), whether
they're new to the string table ($arg2), and who added it (ustack(n)).

8 years agoFix PR19241 by scanning for available CPUs.
Martin Cermak [Fri, 13 Nov 2015 15:21:15 +0000 (16:21 +0100)]
Fix PR19241 by scanning for available CPUs.

Per PR19241/rhbz1280321, staprun was failing to start when CPU0
was offline or offline.  In bulk mode, staprun was failing if
any CPU but the last one was offline.  This patch fixes it by
scanning for available online CPUS up to NR_CPUS.

8 years agoUpdate user_string_n2_quoted() so that semok/context-globals.stp is happy.
Martin Cermak [Fri, 13 Nov 2015 13:10:36 +0000 (14:10 +0100)]
Update user_string_n2_quoted() so that semok/context-globals.stp is happy.

Rename the local 'str' variable within user_string_n2_quoted() to '__str'
so that it doesn't collide with global variable of the same name defined
in the semok/context-globals.stp testcase.

8 years agokill interned_string::c_str(), allowing shared substr()
Josh Stone [Thu, 12 Nov 2015 22:14:22 +0000 (14:14 -0800)]
kill interned_string::c_str(), allowing shared substr()

For the most part, c_str() is just used for "%s" in warnings, errors,
and debug messages.  We can afford to pay the cost of to_string() there,
while allowing string_ref to share memory the rest of the time.

NB: when using `to_string().c_str()`, it's important not to let that
pointer outlive the string temporary!  It's good only for the range of
its full expression; if you need it longer, bind the string to a local
reference first.

8 years agoFix PR19234 by adapting user_string_n_quoted.exp.
Martin Cermak [Thu, 12 Nov 2015 15:07:06 +0000 (16:07 +0100)]
Fix PR19234 by adapting user_string_n_quoted.exp.

Adapt user_string_n_quoted.exp to the new behavior of
user_string_n2_quoted() introduced by commit bfd1c4ccc2.

8 years agoFix PR19236 by undefining the unmangled variable name.
Martin Cermak [Thu, 12 Nov 2015 14:44:10 +0000 (15:44 +0100)]
Fix PR19236 by undefining the unmangled variable name.

8 years agoExtend private.exp to cover the PR13721 workaround scenario.
Martin Cermak [Wed, 11 Nov 2015 09:41:19 +0000 (10:41 +0100)]
Extend private.exp to cover the PR13721 workaround scenario.

8 years agoExtend global_end.exp to cover private globals too.
Martin Cermak [Wed, 11 Nov 2015 09:40:02 +0000 (10:40 +0100)]
Extend global_end.exp to cover private globals too.

8 years agoFix synthetic probes generation for written and unread private globals.
Martin Cermak [Wed, 11 Nov 2015 09:23:16 +0000 (10:23 +0100)]
Fix synthetic probes generation for written and unread private globals.

Mangling a private global happens based on the name of the file where the
variable got defined.  Stap automatically prints written and unread globals
and private globals at the end of the session.  For autogeneration purposes
of respective derived synthetic probes, we need to keep track of the file
where given variable got defined.

8 years agoAvoid undefined behavior in get_number_param
Josh Stone [Wed, 11 Nov 2015 02:03:08 +0000 (18:03 -0800)]
Avoid undefined behavior in get_number_param

An uninitialized assignment led the compiler to assume it must be
initialized after all, which led to an optimization reversing the
conditions of an '&&'.  This triggered valgrind when the condition
actually was uninitialized after all.  See GCC PR68281.

Ditch the long and long long get_number_param for just int64_t, which is
just a pass-through to get_param.  A few fields are now int64_t to
match, so they can never truncate input values on 32-bit systems.  The
other Dwarf_Addr get_number_param is now careful to only copy good
values from get_param.

Just to be paranoid, all base_query and dwarf_query POD members are now
zeroed in the initializer lists, even when the constructor will set a
better value right away.

8 years agoMark selected internal tapset global vars as '@__private30'.
Martin Cermak [Tue, 10 Nov 2015 07:32:05 +0000 (08:32 +0100)]
Mark selected internal tapset global vars as '@__private30'.

Mark tapset global vars, that are only intended to be used
internally within given tapset, as '@__private30'.  This
restriction appears to have no imparct from the testsuite
perspective.  However, it's still possible that some user
script may rely on one of those.  This restriction can be
worked around using 'stap --compatible=2.9' setting.

8 years agoFix parsing multiple, comma separated, private global vars.
Martin Cermak [Tue, 10 Nov 2015 07:20:26 +0000 (08:20 +0100)]
Fix parsing multiple, comma separated, private global vars.

8 years agoFix several uninitialized class members
Josh Stone [Tue, 10 Nov 2015 02:37:37 +0000 (18:37 -0800)]
Fix several uninitialized class members

Reported by Coverity as UNINIT_CTOR.

8 years agoFix the uselib syscall testcase by updating the expected output.
Martin Cermak [Mon, 9 Nov 2015 08:37:14 +0000 (09:37 +0100)]
Fix the uselib syscall testcase by updating the expected output.

8 years agoMark internal tapset functions as '@__private30' where possible.
Martin Cermak [Sat, 7 Nov 2015 14:43:29 +0000 (09:43 -0500)]
Mark internal tapset functions as '@__private30' where possible.

Add '@__private30' macro that gives 'private' keyword for compatibility
mode 3.0 and higher. Mark internal tapset functions as private using
it where possible. Testcases examining private tapset functions must
now use the --compatible=2.9 option.

8 years agoPrefix global functions in the generated code.
Martin Cermak [Thu, 5 Nov 2015 20:50:55 +0000 (15:50 -0500)]
Prefix global functions in the generated code.

Add '__global_' prefix to global functions in the generated code.
Treat selected internal synthetic functions as private.
Fix using a private function in user script and test-cover it.

* elaborate.cxx: Correctly match global function names to respective
  functiondecls. Match synthetic private functions coming from
  tapset-procfs.cxx (*_procfs_value_*), and tapsets.cxx
  (_sdt_arg_get_addr_) to respective functiondecls.
* main.cxx: Update the --dump-functions feature to correctly deal with
  new internal function names.
* parse.cxx: Add the "__global_" prefix to global functions in the
  generated code.
* staptree.cxx: Update functiondecl::printsig() so that it outputs
  unmangled function name.
* tapset-procfs.cxx: Treat internal synthetic functions
  '*_procfs_value_get*', '*_procfs_value_set*', '*_procfs_value_append*'
  as private.
* tapsets.cxx: Treat internal synthetic functions '*_sdt_arg_get_addr_*'
  as private.
* optim_arridx.exp: Adapt the testcase to new naming.
* private.exp: Add subtest examining use of a private function in
  user script.

8 years agoFix the 'if.exp' testcase so that the second test result matters.
David Smith [Thu, 5 Nov 2015 16:52:10 +0000 (10:52 -0600)]
Fix the 'if.exp' testcase so that the second test result matters.

* testsuite/systemtap.base/if.exp: Make sure we look for the
  'all_pass_string' twice, since the test case prints it twice.

This page took 0.0652 seconds and 5 git commands to generate.