David Smith [Fri, 20 Jul 2012 15:33:06 +0000 (10:33 -0500)]
Fixed PR14378 by supporting @entry() in kprobe.function().return probes.
* tapsets.cxx (gen_mapped_saved_return): Removed from the
dwarf_var_expanding_visitor class. Also renamed the global variables
prefix from '_dwarf' to '_entry' (since now dwarfless kprobe probes
support @entry()).
(dwarf_var_expanding_visitor::gen_mapped_saved_return): Just calls
gen_mapped_saved_return().
(kprobe_var_expanding_visitor): New class.
(kprobe_derived_probe::kprobe_derived_probe): Uses
kprobe_var_expanding_visitor to support @entry().
* testsuite/semko/entry04.stp: New test.
* testsuite/semok/entry04.stp: Ditto.
Fix '@operator' parsing -- strictly enforce use of '@' in identifiers.
Generally, the language makes a policy of not allowing people to use '@'
inside arbitrary identifiers. The new test case gives an example of
behaviour that was still allowed by the parser's older scheme for
preventing this.
Identifiers beginning in '@' are now reclassified as tok_operator by the lexer.
Seems it's not always possible to avoid linux/types.h for the conflict
it presents with sys/select.h. Now include linux/types.h very early, so
glibc can stomp over it with #undef and #define, rather than vice versa.
Josh Stone [Wed, 18 Jul 2012 22:05:59 +0000 (15:05 -0700)]
PR14369: Fix locating SDT w/ $vars, w/o debuginfo
While current SDT can work without debuginfo, trying to use local $vars
still requires a look into DWARF. If that debuginfo is broken or
missing (as with asm probes), then we were reporting the probe entirely
absent, instead of just the $var broken.
This is undesirable if the $var access might have been optimized away,
or was part of a @defined check that should just get 0. So now we try
using debuginfo first, but if that fails go the direct route, and bad
$vars can be resolved or error in the normal way.
Josh Stone [Wed, 18 Jul 2012 21:09:05 +0000 (14:09 -0700)]
PR13934: When SDT args don't use N@OP, split on spaces
Assembly probes are not forced to use the N@OP form. In this case, N is
inferred to be the native word size. Since we don't have a nice
delimiter, just split it on spaces. SDT-asm authors then must not put
any spaces in arguments, to avoid ambiguity.
David Smith [Wed, 18 Jul 2012 18:30:59 +0000 (13:30 -0500)]
Fixed PR11424 by using System.map data to validate dwarfless kprobe probes.
* tapsets.cxx (kprobe_builder::load_function_name_cache): New function.
(kprobe_builder::build): Use parsed System.map data to validate
kprobe.function probe names.
PR14360, PR11207: clean up wildcard code in preparation for token-based macros.
in parse.cxx:
- get rid of ate_comment, enable "a" /* comment */ "b" string gluing
- add ate_whitespace to keep track of token adjacency
- restrict wildcard handling code to parse_probe_point()
- this is now handled by keeping the component tokens of the wildcard
separate, and gluing them together (conditional on adjacency)
Chris Meek [Thu, 12 Jul 2012 14:14:48 +0000 (10:14 -0400)]
BZ802380: Fixed logic issue and resource leak - Coverity
Coverity issues caught:
REVERSE_INULL
There were some logic issues in sdt_query::setup_note_probe_entry()
with a check for whether "name" was NULL after it was dereferenced,
as well as copying a couple possibly not '\0' terminated char *'s to
strings. These should now be fixed, and work as intended.
RESOURCE_LEAK
Also, there was a resource leak with ai_tvar_base in
dwarf_var_expanding_visitor::gen_mapped_saved_return(). That should
now also be fixed.
Josh Stone [Mon, 9 Jul 2012 19:07:48 +0000 (12:07 -0700)]
Fix the build with glibc 2.16
With our elevated compiler warnings as errors, we got:
mainloop.c: In function 'stp_main_loop':
mainloop.c:581:3: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
mainloop.c:581:3: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
mainloop.c:583:35: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
mainloop.c:583:35: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
mainloop.c:631:2: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
mainloop.c:631:2: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
cc1: all warnings being treated as errors
This turns out to be a macro fight between glibc-2.16 and
kernel-headers, via including linux/types.h. We apparently don't
even need that header, so removing it lets us proceed normally.
Those curious can watch this bug to see how the conflict is resolved:
https://bugzilla.redhat.com/show_bug.cgi?id=837641
David Smith [Mon, 2 Jul 2012 20:47:31 +0000 (15:47 -0500)]
Improve nd_syscall testsuite for s390x.
* tapset/nd_syscalls2.stp (nd_syscall.pselect7): For s390x, don't try to
get argument 7 since it will never succeed.
(nd_syscall.compat_pselect7): Ditto.
Serguei Makarov [Thu, 28 Jun 2012 21:07:01 +0000 (17:07 -0400)]
PR12210: Basic implementation of alias suffixes.
This enhancement permits the script writer to attach a suffix when
invoking a probe alias. The components in the suffix are passed on
to the underlying probe point.
e.g. syscall.read.maxactive(10) expands to something like
kernel.function("sys_read").return.maxactive(10); the
maxactive(10) part is a suffix that is attached to the
alias expansion of syscall.read.return.
At this stage, the interaction of the feature with wildcards
is somewhat limited. Namely, alias suffixes appear in wildcard
expansions only when the old implementation would signal an
error due to lack of expansions (see documentation in the next
commit for details). This minimizes the impact on existing code,
but the restriction should be removed as soon as we figure out
a way to make the available suffixes reliably discoverable in
error messages, features such as stap -l, etc.
Chris Meek [Wed, 27 Jun 2012 20:25:40 +0000 (16:25 -0400)]
PR14016: Fixed REVERSE_INULL coverity warnings
In both cases we dereference a pointer, then
proceed to compare the pointer to NULL. This means
the pointer could, potentially have been NULL when
we dereference it.
Chris Meek [Wed, 27 Jun 2012 20:20:49 +0000 (16:20 -0400)]
PR14016: Fixed FORWARD_NULL coverity warnings
In all these cases, we compare a variable to NULL,
but don't exit, then proceed to dereference that
variable. This has the potential to cause problems,
so in each case assert the variable is not NULL
before dereferencing.
Chris Meek [Wed, 27 Jun 2012 20:08:20 +0000 (16:08 -0400)]
PR14016: Fixed DEADCODE coverity warnings
csclient.cxx:
CERTS will always be NULL when it reaches the
cleanup. Added an assert, just for clarity
and as an extra check.
staprun.c
r is no longer used in the for loop, so comparing it
against 0 will always fail, as its explicitly set
to 0 before the loop, and never changed. Safe to
just remove it.
translate.cxx
Since eh_frame_*_seen variables were set to false
within the loop, and only one could be changed to
true on a given itteration, they could never be
true at the same time. This would just cause the
loop to continue execution longer than needed. By
initializing them outside the loop, we can exit
as soon as we've found what we need.
Josh Stone [Tue, 19 Jun 2012 22:22:08 +0000 (15:22 -0700)]
PR14179: Start the runtime shuffle
To aid in code sharing with the dyninst backend, the runtime is being
split into neutral and kernel-specific parts. Runtime code that depends
on running within the kernel should move to runtime/linux/.
*****
* This is still a work in progress, but it remains functional enough
* that normal kernel use should be unaffected. The separation is not
* complete enough yet for the dyninst branch...
*****
Frank Ch. Eigler [Mon, 18 Jun 2012 19:42:24 +0000 (15:42 -0400)]
tapset: panic() and friends
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Pull in panic.stp.
* tapset/guru-delay.stp: Fix typo.
* tapset/panic.stp: Fix 'nother super important typo.
* testsuite/buildok/guru.stp: Build-test the bad boys.
Chris Meek [Mon, 18 Jun 2012 15:12:26 +0000 (11:12 -0400)]
PR14240: Fixed another uncaught exception warning
lex_cast throws an exception, so calling it in autosprinf() caused
an uncaught exception. We really didn't need to cast the rc as a string
just to print it out.
Josh Stone [Fri, 15 Jun 2012 21:16:27 +0000 (14:16 -0700)]
PR14168: Let stap_system() callers describe the command
This fixes the gripe of commit 42da159, that error codes from
"env ... make" were identified as env failures.
* util.cxx (stap_system): Add a "description" parameter that names the
command for the WARNING message.
* util.h (stap_system): Keep the old form as a wrapper which uses
args[0] as the description.
* buildrun.cxx (run_make_cmd): Now more descriptive than ever before,
pass the name "kbuild" to stap_system().
Chris Meek [Fri, 15 Jun 2012 19:21:16 +0000 (15:21 -0400)]
PR14240: Fixed netfilter hookfunction for RHEL5
Previous to kernel 2.6.22 (linux commit 3db05fe), the hook function
definition takes a **skb whereas currently it uses *skb. We need to
emit the right version for this to compile on RHEL5.
Josh Stone [Thu, 14 Jun 2012 23:52:28 +0000 (16:52 -0700)]
PR14244: Assert that the real UID has access to debugfs
Some systems are now defaulting debugfs to mode 0700. If the user has
no access to debugfs, then they won't be able to communicate with the
systemtap module. Thus, this should be a non-starter, before even
loading the module at all.
This was previously causing staprun to fail after loading the module,
when it checked R/W access to the module's .ctl file. But since we also
restrict removing modules to those you can control, staprun would not
unload the new module either.
William Cohen [Thu, 14 Jun 2012 16:02:21 +0000 (12:02 -0400)]
Update the Beginners Guide version information
The "version:" flag in publican.cfg does not really work the way
expected. It will change the name of the generated pdf file during
the build, but it does not completely override the <productnumber> in
Book_Info.xml. Need manual fixing for the time being.
Serguei Makarov [Wed, 13 Jun 2012 17:28:38 +0000 (13:28 -0400)]
NEWS: describe the required changes to embedded-C functions.
- SystemTap now mangles local variables to avoid collisions with C
headers included by tapsets. This required a change in how
embedded-C functions access local parameters and the return value slot.
Instead of THIS->foo in an embedded-C function, please use the newly
defined macro STAP_ARG_foo (substitute the actual name of the
argument for 'foo'); instead of THIS->__retvalue, use the newly
defined STAP_RETVALUE. All of the tapsets and test cases have been
adapted to use this new notation.
If you need to run code which uses the old THIS-> notation, run stap
with the --compatible=1.7 option.
Serguei Makarov [Wed, 13 Jun 2012 17:21:31 +0000 (13:21 -0400)]
PR10299: enable locals mangling in translate.cxx.
It is now *required* to use STAP_ARG_* and STAP_RETVALUE to access
parameters in embedded-C functions -- the actual underlying names
and locations of the parameters are subject to be changed/renamed
arbitrarily.
David Smith [Tue, 12 Jun 2012 13:28:52 +0000 (08:28 -0500)]
Improve conversions.exp test by also testing tracepoint/timer.profile probes.
* testsuite/systemtap.stress/conversions.exp: Move main logic into a
procedure so that more than begin probes can be tested. Add tracepoint
and timer.profile testing.
* testsuite/systemtap.stress/conversions_profile.stp: New file.
* testsuite/systemtap.stress/conversions_trace.stp: New file.
Studying docbook-style-xsl in Fedora, and the corresponding xslt-fo
stylesheets on the web, found some xsl:param options that make the
tapsets.pdf a little more lean and a touch more mean. See also
http://snapshots.docbook.org/xsl/doc/fo/
* doc/SystemTap_Tapset_Reference/Makefile.am: Pass some powerful
stringparams to xmlto.
documentation: generate tapset reference pdf with fop if available
* configure.ac: Look for fop program. It runs much faster than
pdfdblatex or whatnot.
* doc/SystemTap_Tapset_Reference/Makefile.am: Pass --with-fop to
xmlto if fop was found.
Josh Stone [Thu, 7 Jun 2012 20:46:38 +0000 (13:46 -0700)]
testsuite: Fix pretty-bits/char to work with relative paths
This is more fallout from the automake update (commit c66be968a4ea)
which led to relative $srcdir. The pretty-bits and pretty-char tests
are passing $srcdir headers to @cast kernel types. That gets compiled
with Kbuild, with the working directory is changed to the kernel root,
so we need to give full paths for those headers.
This adds a new tcl proc "fullpath" which inserts [pwd]/ on relative
paths, and updates those pretty tests to use it.