]> sourceware.org Git - systemtap.git/log
systemtap.git
10 years agoTreat autocast pointer indirection as tracepoints do
Josh Stone [Tue, 10 Jun 2014 20:20:13 +0000 (13:20 -0700)]
Treat autocast pointer indirection as tracepoints do

With '&' addressof, @cast, and other oddities, it wasn't always clear
whether the type die in an autocast described the given value or the thing
that value is pointing too.

Tracepoints already solved that problem, so we can reuse its is_pointer
logic.  Now we always try to make the type die refer to the pointee, and
is_pointer indicates if our value is such a pointer.  If not, then its an
error to try dereferencing it, for example with a direct base type.

10 years agoelaborate: Don't catch semantic_error in blocks
Josh Stone [Tue, 10 Jun 2014 20:15:02 +0000 (13:15 -0700)]
elaborate: Don't catch semantic_error in blocks

In typeresolution_info::visit_block(), we were catching and printing
semantic_errors, but this causes them to be repeated when type resolution
loops around again.  Instead let higher levels catch the error, where it
will end the iteration properly too.

This probably originated on the assumption that all probe and function code
is contained in a block statement, but with optimization that may not even
be true, so visit_block is really not the right place to catch errors.

10 years agoMerge branch 'master' into autocast
Josh Stone [Mon, 9 Jun 2014 17:04:33 +0000 (10:04 -0700)]
Merge branch 'master' into autocast

10 years agotestsuite: drop the verbose -log in stap_run_batch
Josh Stone [Mon, 9 Jun 2014 17:01:42 +0000 (10:01 -0700)]
testsuite: drop the verbose -log in stap_run_batch

Dejagnu already echos the program output, so logging it again just makes
systemtap.log hard to read.

10 years agoautocast: add parsing and semantic tests
Josh Stone [Sat, 7 Jun 2014 00:57:33 +0000 (17:57 -0700)]
autocast: add parsing and semantic tests

10 years agoFix BZ1099555 by reworking gtod.exp.
David Smith [Mon, 9 Jun 2014 14:11:13 +0000 (09:11 -0500)]
Fix BZ1099555 by reworking gtod.exp.

* testsuite/systemtap.base/gtod.exp: Rework so that we don't care about
  what order the output comes. All we care about now is the variance
  between the kernel's time and systemtap's time.
* testsuite/systemtap.base/gtod.c (main): Print the iteration number first.
* testsuite/systemtap.base/gtod.stp: Ditto.

10 years agostap.1, stappaths.7 man pages: minor text improvements
Frank Ch. Eigler [Sun, 8 Jun 2014 13:57:22 +0000 (09:57 -0400)]
stap.1, stappaths.7 man pages: minor text improvements

10 years agostap.1 typo fix
Frank Ch. Eigler [Sun, 8 Jun 2014 13:37:18 +0000 (09:37 -0400)]
stap.1 typo fix

10 years agoautocast: disallow writes for non-gurus
Josh Stone [Sat, 7 Jun 2014 00:26:58 +0000 (17:26 -0700)]
autocast: disallow writes for non-gurus

Like any other deref access, autocast should only allow writes if
guru mode is chosen with stap -g.

10 years agoautocast: Avoid duplicating errors
Josh Stone [Fri, 6 Jun 2014 23:58:16 +0000 (16:58 -0700)]
autocast: Avoid duplicating errors

Don't retry an autocast expansion if we already have a saved error, and
wait to print errors until type resolution is in assert_resolvability.

10 years agoPR15123 still encontered: mention workarounds in error::dwarf.7stap man page
Frank Ch. Eigler [Fri, 6 Jun 2014 19:59:58 +0000 (15:59 -0400)]
PR15123 still encontered: mention workarounds in error::dwarf.7stap man page

10 years agoconfigure.ac: Tolerate relative elftuils src path and add autoreconf -i hint.
Mark Wielaard [Fri, 6 Jun 2014 19:39:42 +0000 (21:39 +0200)]
configure.ac: Tolerate relative elftuils src path and add autoreconf -i hint.

configure: Regenerated.

10 years agostap -V version string: include build-time elfutils version
Frank Ch. Eigler [Fri, 6 Jun 2014 18:25:12 +0000 (14:25 -0400)]
stap -V version string: include build-time elfutils version

We have some translator facilities that are based on _ELFUTILS_PREREQ,
a compile-time elfutils version check.  Others might change behavior
based on the run-time elfutils version.  These versions may differ,
as the system elfutils libraries are upgraded without stap being
rebuilt.  This patch changes stap -V to report both run-time and
build-time elfutils versions (if they are different).

10 years agoUpdate gtod.exp for BZ1099555 to make output more clear.
David Smith [Thu, 5 Jun 2014 15:46:14 +0000 (10:46 -0500)]
Update gtod.exp for BZ1099555 to make output more clear.

* testsuite/systemtap.base/gtod.exp: Split test into 3 sub tests so that
  failures can be more easily identified.

10 years agoPR17027: adapt pr16806.exp for RHEL6
Jonathan Lebon [Thu, 5 Jun 2014 15:09:11 +0000 (11:09 -0400)]
PR17027: adapt pr16806.exp for RHEL6

This test failed on RHEL6 for two reasons:
- The 'timeout' program doesn't support non-integer arguments
- We assumed the uprobes module was already inserted.

Fix the first by changing the timeout to 1s (I verified that this
doesn't change the lethality of the test under the right conditions).

Fix the second by doing a sample run first to allow stap the chance to
self-compile and pass the uprobes module to staprun -u.

10 years agoman/stapprobes.3stap: add blurb about ENUMERATED
Jonathan Lebon [Thu, 5 Jun 2014 14:11:14 +0000 (10:11 -0400)]
man/stapprobes.3stap: add blurb about ENUMERATED

10 years agoNEWS: add blurb about ENUMERATED
Jonathan Lebon [Thu, 5 Jun 2014 14:10:49 +0000 (10:10 -0400)]
NEWS: add blurb about ENUMERATED

10 years agodwflpp.cxx: pass linenos vector by reference
Jonathan Lebon [Wed, 4 Jun 2014 21:42:46 +0000 (17:42 -0400)]
dwflpp.cxx: pass linenos vector by reference

This is a follow-up to commit f01d4ff. Pass linenos vector by reference
and remove unused variable range_it.

10 years agostatement probes: add ENUMERATED lineno_type
Brian Chrisman [Wed, 4 Jun 2014 21:40:08 +0000 (17:40 -0400)]
statement probes: add ENUMERATED lineno_type

This patch adds support for statement probes of the form

   .statement("foo@file.c:1,3-4,6")

The statement.exp testcase is expanded to cover this new type.

10 years agodwflpp::literal_stmt_for_local add details for retrieve attribute errors.
Mark Wielaard [Thu, 5 Jun 2014 09:43:38 +0000 (11:43 +0200)]
dwflpp::literal_stmt_for_local add details for retrieve attribute errors.

10 years agodwflpp::die_location_as_function_string don't mix std::string and char *.
Mark Wielaard [Thu, 5 Jun 2014 09:41:08 +0000 (11:41 +0200)]
dwflpp::die_location_as_function_string don't mix std::string and char *.

Especially using the result of string.c_str() after string goes out of
scope is not adviced.

10 years agosystemtap_session::modules_must_be_signed might use uninitialized memory.
Mark Wielaard [Thu, 5 Jun 2014 09:13:31 +0000 (11:13 +0200)]
systemtap_session::modules_must_be_signed might use uninitialized memory.

statm >> status might not actually assign anything to status.
operator >> on ifstream doesn't assign anything the underlying file
doesn't exist. So status will just have random contents that happened
to be on the stack. Make sure to initialize status first.

10 years agoExtra details to explain the error or provide alternatives to the user.
Mark Wielaard [Thu, 5 Jun 2014 08:12:57 +0000 (10:12 +0200)]
Extra details to explain the error or provide alternatives to the user.
Each one printed after the main error message and tokens aligned on
separate lines. Just push_back anything you want that better explains
the error to the user (not meant for extra verbose developer messages).

Use it for the new explanations of the "not accessible at this address"
errors. Split in die_location_as_string, die_location_as_function_string
and suggested_locations_string.

10 years agoReport address locations where things are accessible in error message.
Mark Wielaard [Wed, 4 Jun 2014 18:48:23 +0000 (20:48 +0200)]
Report address locations where things are accessible in error message.

Instead of just saying "not accessible at this address" tell at which
addresses the location is accessible. Uses dwarf_getlocations which
requires elfutils 0.158+ (if not available, just don't suggest anything).

10 years agoFix accessible at this address error message crash.
Mark Wielaard [Wed, 4 Jun 2014 18:40:25 +0000 (20:40 +0200)]
Fix accessible at this address error message crash.

commit 6fcc2aa1 "Improve not accessible at this address error message"
introduced a regression by crashing when the debugfile couldn't be found.

10 years agopr16719.exp: Use /bin/ls, not /usr/bin/ls which might not exist.
Mark Wielaard [Wed, 4 Jun 2014 18:30:35 +0000 (20:30 +0200)]
pr16719.exp: Use /bin/ls, not /usr/bin/ls which might not exist.

10 years agoexecve.exp: don't double quote result_string.
Mark Wielaard [Wed, 4 Jun 2014 18:21:35 +0000 (20:21 +0200)]
execve.exp: don't double quote result_string.

10 years agoImprove not accessible at this address error message.
Mark Wielaard [Wed, 4 Jun 2014 13:24:41 +0000 (15:24 +0200)]
Improve not accessible at this address error message.

Add dwflpp::pc_die_location_as_string and dwflpp::pc_die_location_as_string
to provide more human readable PC and DWARF DIE offset names and source
locations (including which function was inlined where) to help track down
why an argument or variable isn't accessible at a certain address.

10 years agoFixed BZ1099791 by updating the runtime to correctly find the vdso.
David Smith [Tue, 3 Jun 2014 16:05:20 +0000 (11:05 -0500)]
Fixed BZ1099791 by updating the runtime to correctly find the vdso.

* translate.cxx (find_vdso): Add comment mentioning the logic in
  _stp_vma_match_vdso needs to match.
* runtime/vma.c (_stp_vma_match_vdso): Add logic from find_vdso() to parse
  the path, looking for the vdso.

10 years agoPR16716 partial fix: Fix types in syscall.epoll_{create,ctl,pwait,wait}.
David Smith [Mon, 2 Jun 2014 17:43:14 +0000 (12:43 -0500)]
PR16716 partial fix: Fix types in syscall.epoll_{create,ctl,pwait,wait}.

* tapset/linux/syscalls.stp (syscall.epoll_create): Fix types.
  (syscall.epoll_ctl): Ditto.
  (syscall.epoll_wait): Ditto.
  (syscall.epoll_pwait): Add convenience variables.
* tapset/linux/nd_syscalls.stp: Ditto.
* tapset/linux/aux_syscalls.stp (_opoll_op_str): Updated and improved.
  (_epoll_create1_flag_str): Ditto.
* runtime/linux/compat_unistd.h: Added __NR_compat_epoll_wait.
* testsuite/buildok/syscalls-detailed.stp: Add test for new epoll_pwait
  convenience variables.
* testsuite/buildok/nd_syscalls-detailed.stp: Ditto.
* testsuite/systemtap.syscall/poll.c: Add more error testing.

10 years agofixed typo in proc_by_pid.exp that caused an error
Abegail Jakop [Mon, 2 Jun 2014 13:42:34 +0000 (09:42 -0400)]
fixed typo in proc_by_pid.exp that caused an error

Typo caused a variable to be treated as an array, which
only arose when trying to set a runtime flag for the test case.

10 years agodwflpp.cxx: check addr returned by lower_bound()
Jonathan Lebon [Sun, 1 Jun 2014 19:58:48 +0000 (15:58 -0400)]
dwflpp.cxx: check addr returned by lower_bound()

This is a follow-up to commit 71b8e66. The lower_bound() function
returns an iterator to the first addr which does not compare less than
the entrypc. This means that the returned addr is either equal or
greater than the entrypc (depending on whether the latter is in the
vector).

This patch simply checks that the addr returned by lower_bound() is
equal, not just greater or equal.

10 years agotestsuite: Subvert parseko/four.stp for autocast
Josh Stone [Sat, 31 May 2014 00:21:21 +0000 (17:21 -0700)]
testsuite: Subvert parseko/four.stp for autocast

This formerly-bad syntax is now expected to pass!  So tweak it in a way
that's bad even under autocast, and copy the good style to parseok.

10 years agotestsuite: Clean up parseok/parseko that used -p2
Josh Stone [Sat, 31 May 2014 00:00:22 +0000 (17:00 -0700)]
testsuite: Clean up parseok/parseko that used -p2

Many of these tests really are exercising the parser, so should be -p1.
A few were really semantic tests, now moved to semok or semko.  This
also lets them be tested by parseok/semko.stp.

10 years agoMerge branch 'master' of ssh://sourceware.org/git/systemtap
Abegail Jakop [Fri, 30 May 2014 20:36:54 +0000 (16:36 -0400)]
Merge branch 'master' of ssh://sourceware.org/git/systemtap

10 years agoedited the description for -x in man page
Abegail Jakop [Fri, 30 May 2014 20:18:42 +0000 (16:18 -0400)]
edited the description for -x in man page

10 years agodwflpp.cxx: use lower_bound() instead of manual binary search
Jonathan Lebon [Fri, 30 May 2014 19:42:00 +0000 (15:42 -0400)]
dwflpp.cxx: use lower_bound() instead of manual binary search

This is a follow-up to commit 1d50099. We previously implemented our own
binary search to find the line record associated with the function's
entrypc. To be on the safe side, we instead rely on lower_bound() for
binary searching, which will pick the first element in a range of equal
addresses, thus avoiding issues such as BZ1099133.

10 years agoAdd ia64-specific syscall tapset fix.
David Smith [Fri, 30 May 2014 16:01:41 +0000 (11:01 -0500)]
Add ia64-specific syscall tapset fix.

* tapset/linux/nd_syscalls2.stp: Remove extra _ia64_pipe[01] functions,
  just use the functions in syscalls2.stp.

10 years agoUpdate syscall tapset for rawhide (3.15.0-0.rc5.git3.1.fc21.x86_64).
David Smith [Fri, 30 May 2014 15:56:53 +0000 (10:56 -0500)]
Update syscall tapset for rawhide (3.15.0-0.rc5.git3.1.fc21.x86_64).

* tapset/linux/syscalls.stp (syscall.ioctl): Update for rawhide.
* tapset/linux/syscalls2.stp (syscall.compat_utime): Ditto.

10 years agoBZ1099133: prologue searching: check previous line too
Jonathan Lebon [Fri, 30 May 2014 15:47:51 +0000 (11:47 -0400)]
BZ1099133: prologue searching: check previous line too

We perform binary search to retrieve the line record matching the
entrypc. However, we may by chance fall on the second of two line
records for the same entrypc. Check for this after binary search is
done.

10 years agochanged check for -x PID, added tests
Abegail Jakop [Fri, 30 May 2014 15:25:09 +0000 (11:25 -0400)]
changed check for -x PID, added tests

session.cxx: revised approach to checking path for given PID

checks that the path produced from a given PID is valid using
readlink(). added in new error messages to be more specific.

tapsets.cxx: fixed spelling mistake

proc_by_pid*: test files

10 years agoBZ1099825: probe_by_pid.exp: small tweak in C program
Jonathan Lebon [Fri, 30 May 2014 14:26:01 +0000 (10:26 -0400)]
BZ1099825: probe_by_pid.exp: small tweak in C program

Since PR6941 (commit 277a2b9), prologue-searching is skipped for
optimized code. However, we do not skip it for GCC < 4.5, which may
provide bad location info (see GDB's PR13777).

On RHEL6, this testcase was failing because prologue-searching was not
skipped, and fell inside the loop in main(). To allow for a safe landing
zone, we slightly tweak the C program so that there is a safe
instruction to land on post-prologue that is not in the loop.

10 years agoRelax static-probes.d input file syntax.
Stan Cox [Thu, 29 May 2014 20:04:13 +0000 (16:04 -0400)]
Relax static-probes.d input file syntax.

* dtrace.in (dtrace_bnf): Allow probe_ident to start with any alphanumeric.
  Make trailing probe declaration ';' optional.
  (_PypProvider::probe_write): Improve error messages.

10 years agoinfer process path with -x PID
Abegail Jakop [Thu, 29 May 2014 19:31:08 +0000 (15:31 -0400)]
infer process path with -x PID

session.cxx: interpret -x PID as /proc/PID/exe
tapsets.cxx: changed error messages
stap.1: updated man page

10 years agoDon't give predefined types special treatment.
Stan Cox [Thu, 29 May 2014 15:11:40 +0000 (11:11 -0400)]
Don't give predefined types special treatment.

* dtrace.in (dtrace_bnf):  Remove type_spec.  Handle all types as type_name.

10 years agoFixed BZ1100813 by fixing build errors in nfsd.stp.
David Smith [Wed, 28 May 2014 21:00:44 +0000 (16:00 -0500)]
Fixed BZ1100813 by fixing build errors in nfsd.stp.

* tapset/linux/nfsd.stp (__rqstp_uid): Fix pointer casting, needed by
  32-bit platforms.
  (__rqstp_gid): Ditto.

10 years agoPR16991: tweak output for UNKNOWN root dentry; add hex address
Frank Ch. Eigler [Wed, 28 May 2014 16:23:04 +0000 (12:23 -0400)]
PR16991: tweak output for UNKNOWN root dentry; add hex address

10 years agoFixed PR16991 by avoiding an inifinte loop in task_dentry_path().
David Smith [Wed, 28 May 2014 15:54:57 +0000 (10:54 -0500)]
Fixed PR16991 by avoiding an inifinte loop in task_dentry_path().

* tapset/linux/dentry.stp (task_dentry_path): Return "UNKNOWN" for
  unmounted synthetic filesystems.
* testsuite/systemtap.base/task_dentry_path.exp: New file.
* testsuite/systemtap.base/task_dentry_path.sh: Ditto.
* testsuite/systemtap.base/task_dentry_path.stp: Ditto.

10 years agoBZ1099472: cast-scope.exp: adjust relative lineno
Jonathan Lebon [Wed, 28 May 2014 15:24:34 +0000 (11:24 -0400)]
BZ1099472: cast-scope.exp: adjust relative lineno

10 years agoBZ1099757: vars.exp: fix and strengthen
Jonathan Lebon [Wed, 28 May 2014 15:12:18 +0000 (11:12 -0400)]
BZ1099757: vars.exp: fix and strengthen

Since PR16615 (merge commit 4636ca3), linenos in statement probes have
become more precise and stringent. As a result, vars.exp was failing
because it was trying to probe a statement at a lineno with no line
records.

We fix this by first retrieving the first valid lineno using stap -l.
The test has also been refactored in general to be more robust. We can
now more easily add more functions to test (e.g. we now test both
bio_copy_user() and vfs_read()).

10 years agoman/stapprobes.3stap: clarify relative linenos
Jonathan Lebon [Wed, 28 May 2014 13:57:21 +0000 (09:57 -0400)]
man/stapprobes.3stap: clarify relative linenos

Since PR16615 (merge commit 4636ca3), relative line numbers are relative
to the decl_line of the function. Adjust man page to reflect this.

10 years agotapsets.cxx (trivial): clear up comment
Jonathan Lebon [Tue, 27 May 2014 21:32:54 +0000 (17:32 -0400)]
tapsets.cxx (trivial): clear up comment

We used to support both kernel mode and user mode before, but no more.
Update comment to not cause confusion.

10 years agodwflpp (trivial): fix missing _F()
Jonathan Lebon [Mon, 26 May 2014 18:05:58 +0000 (14:05 -0400)]
dwflpp (trivial): fix missing _F()

10 years agoNEWS: add blurb about PR16941
Jonathan Lebon [Mon, 26 May 2014 18:07:43 +0000 (14:07 -0400)]
NEWS: add blurb about PR16941

10 years agoMerge branch 'jlebon/listing' (PR16941)
Jonathan Lebon [Mon, 26 May 2014 14:43:45 +0000 (10:43 -0400)]
Merge branch 'jlebon/listing' (PR16941)

10 years agoMerge branch 'jlebon/library' into jlebon/listing
Jonathan Lebon [Mon, 26 May 2014 14:39:14 +0000 (10:39 -0400)]
Merge branch 'jlebon/library' into jlebon/listing

10 years agolist.exp: fix regexes and strengthen
Jonathan Lebon [Fri, 16 May 2014 14:45:27 +0000 (10:45 -0400)]
list.exp: fix regexes and strengthen

Fix regular expressions so that we expect the full path from stap rather
than just process("stap"). Also strengthen the testcase by making
matches against all output lines, rather than just checking if a single
line matches.

10 years agoderive_probes(): properly handle optionality
Jonathan Lebon [Tue, 13 May 2014 21:15:01 +0000 (17:15 -0400)]
derive_probes(): properly handle optionality

We previously overrode a location's optionality if it was derived from a
globby process probe. However, this causes further probe points to be
derived to also be optional, even though the 'higher level' probe point
had its optionality restored to what the user really wants. The end
result was that we would list probes as not optional even though the
endpoint probe was optional.

What we really mean when we say process probes born out of a higher
globby process probe should be optional is that only some of the matched
binaries will actually resolve, so it's OK if some don't resolve.
However, those that *do* resolve should respect the user's wish with
regards to optionality.

To do this, we must not override the probe_point's optional flag in
derive_probes.

This is mostly a cosmetic change, although some runtime elements do rely
on optionality to decide whether to emit a warning upon failing to
register a probe.

This patch also makes process.library probes born out of a higher globby
library probe follow the same logic.

10 years agolabels.exp: adjust lineno
Jonathan Lebon [Thu, 15 May 2014 15:56:10 +0000 (11:56 -0400)]
labels.exp: adjust lineno

10 years agolibrary probes: update stapprobes(3stap)
Jonathan Lebon [Thu, 8 May 2014 20:44:51 +0000 (16:44 -0400)]
library probes: update stapprobes(3stap)

Clarify that we normally search among NEEDED libraries but that
non-NEEDED libraries are also supported.

10 years agolabel probes: rework logic
Jonathan Lebon [Thu, 15 May 2014 15:08:36 +0000 (11:08 -0400)]
label probes: rework logic

Ever since PR16615 (merge commit 4636ca3), statement/function probes
where we specify the full "func@file:N" have been too precise for label
probes.

Imagine the following C program:

   ...
   <expression-statement>
mylabel:
   <expression-statement>
   ...

The line at which 'mylabel' occurs is not actually associated with any
line records. Thus, when using the new iterate_over_srcfile_lines(),
specifying the lineno of the label results in no records found, whereas
prior to PR16615, the next lineno would be picked up.

Regardless, the previous mechanism of using iterate_over_srcfile_lines()
to then call back to query_srcfile_label() which in turn called
iterate_over_labels() was a roundabout way of making sure that the
specified lineno lies in a filtered function's DIE.

We now rework iterate_over_labels() to directly handle lineno matching
when necessary. Supported cases:

process.function("foo@file.c:N").label("*")
   --> matches label in foo at N

process.function("foo@file.c+N").label("*")
   --> matches label in foo at N + decl_line of foo

process.function("foo@file.c:N-M").label("*")
   --> matches labels in foo between N and M

process.function("foo@file.c:*").label("*")
   --> matches all labels in foo

This patch also pushes down the priority of "func@file:N" type probes so
that if a .label or .callee[s] is present, then the relevant
iterate_over_*() is called, rather than iterate_over_srcfile_lines().

10 years agolibrary probes: suggest libraries on mismatch
Jonathan Lebon [Wed, 7 May 2014 18:27:29 +0000 (14:27 -0400)]
library probes: suggest libraries on mismatch

Suggest from the iterated libraries if no matching libraries were found.

10 years agoalias probes: mark final aliases as well-formed
Jonathan Lebon [Thu, 15 May 2014 22:06:17 +0000 (18:06 -0400)]
alias probes: mark final aliases as well-formed

When building probes from aliases, we mark them as well-formed if they
reached their final derivation so that in listing mode, we stop at this
final alias form.

10 years agolibrary probes: also try non-NEEDED libraries
Jonathan Lebon [Wed, 7 May 2014 18:16:24 +0000 (14:16 -0400)]
library probes: also try non-NEEDED libraries

This patch adds back support for non-NEEDED libraries even when the user
supplied a non-canonical path. However, a WARNING is emitted to notify
the user. This WARNING can be suppressed by specifying the fully
resolved path to the library.

10 years agoprocess probes: throw error upon unresolved executable
Jonathan Lebon [Mon, 26 May 2014 16:01:18 +0000 (12:01 -0400)]
process probes: throw error upon unresolved executable

When find_executable() fails to resolve something, it simply returns the
same path it was fed. Depending on the context, the caller may be able
to deal with an unresolved path.

In the case of process probes for dwarf_builder and other base_query
users, dealing with it meant simply that the dwflpp failed to find the
executable which meant iterate_over_modules() never even took off (and
we thus yielded the good ol' "no match" error).

However, in the case of library probes, this may not always work because
if the library path is fully specified, we will switch to it without
resorting to iterate_over_libraries() (see also previous patch) and
without ever actually checking if the process path was fully resolved,
thus allowing a probe such as the following to be created:

process("garbage").library("/full/path/to/library.so").function("foo")

So instead, we add explicit checks to verify that process probes were
properly resolved by find_executable(). As an added benefit, users get a
clearer reason of why the probe point failed:

BEFORE:

semantic error: while resolving probe point: identifier 'process' at <input>:1:7
        source: probe process("asdf").library("mylib.so").function("foo") {}
                      ^

semantic error: no match

AFTER:

semantic error: while resolving probe point: identifier 'process' at <input>:1:7
        source: probe process("asdf").library("mylib.so").function("foo") {}
                      ^

semantic error: cannot find executable 'asdf'

10 years agolibrary probes: strengthen library path resolution
Jonathan Lebon [Wed, 7 May 2014 14:59:13 +0000 (10:59 -0400)]
library probes: strengthen library path resolution

One of two things happens to library probes the first time we enter
dwarf_builder::build():
   - If the full path can be resolved using find_executable(), then we
     would right away switch focus to the library, rather than the
     process.
   - Otherwise, we would focus on the process and then use
     iterate_over_libraries() to find a library match.

These decisions are made in two spots: in dwarf_builder::build(), prior
to creating the dwflpp object, and in base_query::base_query().

When we resort to iterate_over_libraries(), new probes are created for
each matching library. And since the path inserted in those new probes
is the full path, find_executable() will find it upon recursing into
dwarf_builder::build().

One issue is that if find_executable() succeeds on the first time, we
will focus on the library, regardless of whether the library is NEEDED
or not. Whereas if find_executable() fails, only NEEDED libraries could
ever be picked up by iterate_over_libraries().

This is mostly fine, except that it creates an inconsistency. For
example, let's say executable 'bar' depends on 'libfoo.so' located in
/lib/. Doing a "libfoo.so" library probe would prioritize a libfoo.so
file in the current directory before the one in /lib/, which is the
'real' one. On the other hand, doing "libfoo.*" would match the
libfoo.so file in /lib/ because of the glob char.

It also fixes the potential issue of having a fully specified library
path with a bad process path: we would focus on the library yet in
query_module() try to iterate_over_libraries() on the library, thinking
that the library was not resolved.

In this series of patches, we change the behaviour as follow
   - Only switch to the library on the first entry of
     dwarf_builder::build() if the path is already fully resolved.
     Otherwise, always use iterate_over_libraries().
   - If iterate_over_libraries() fails, then try a direct
     find_executable() invocation, and warn that the found library is
     not a NEEDED one.

This patch does the first part only. The second part is done in the next
patch.

10 years agolibrary probes: don't add libraries to visited_modules
Jonathan Lebon [Tue, 6 May 2014 20:39:04 +0000 (16:39 -0400)]
library probes: don't add libraries to visited_modules

The dwarf_query's visited_modules set is used to keep track of which
modules are visited for suggestions. It works by emptying out the visited
modules into the dwarf_builder's modules_seen after we're done iterating
through the modules. By the end, modules_seen contains the full list of
modules to suggest from.

Since .library(glob) probes resolve to multiple probes for each matching
library, dwarf_builder's modules_seen will already pick each of them up
from the individually created dwarf_query objects.

So in the end, the modules_seen from which we make suggestions will
already contain them.

10 years agojava probes: mark initial pp as well-formed
Jonathan Lebon [Fri, 16 May 2014 19:23:59 +0000 (15:23 -0400)]
java probes: mark initial pp as well-formed

10 years agoprobe: remove unused create_alias() function
Jonathan Lebon [Thu, 15 May 2014 20:59:09 +0000 (16:59 -0400)]
probe: remove unused create_alias() function

10 years agodwarf_query: tweak final_function_name() signature
Jonathan Lebon [Thu, 15 May 2014 19:01:43 +0000 (15:01 -0400)]
dwarf_query: tweak final_function_name() signature

Almost all of the users of final_function_name() call it with a const
char* for the filename, rather than a string. There may be cases where
the filename is NULL (e.g. if the function was derived using the
symtab), in which case we don't want to cast to a string.

10 years agoquery_srcfile_line(): add well-formed probe point
Jonathan Lebon [Wed, 14 May 2014 15:24:19 +0000 (11:24 -0400)]
query_srcfile_line(): add well-formed probe point

We create the final well-formed probe point before actually creating the
derived probe.

10 years agoquery_plt_statement(): add well-formed probe point
Jonathan Lebon [Wed, 14 May 2014 14:48:39 +0000 (10:48 -0400)]
query_plt_statement(): add well-formed probe point

If the user provides a .plt[(string)] probe, then we'll end up in
query_one_plt during plt iteration, in which we create a specific_loc
where we replace the possibly globby string with the found plt. Mark
this specific loc as well-formed.

If the user provides a .plt[(string)].statement(number) probe, then
we'll end up in query_plt_statement() directly, in which case we need to
create the final well-formed probe point in which we omit the .plt part.

10 years agoquery_inline_instance_info(): add well-formed probe point
Jonathan Lebon [Wed, 14 May 2014 13:34:08 +0000 (09:34 -0400)]
query_inline_instance_info(): add well-formed probe point

We create the final well-formed probe point before actually creating the
derived probe.

10 years agoquery_func_info(): add well-formed probe point
Jonathan Lebon [Wed, 14 May 2014 04:14:48 +0000 (00:14 -0400)]
query_func_info(): add well-formed probe point

We create the final well-formed probe point before actually creating the
derived probe.

10 years agoquery_addr(): add well-formed probe point
Jonathan Lebon [Tue, 13 May 2014 21:40:52 +0000 (17:40 -0400)]
query_addr(): add well-formed probe point

We create the final well-formed probe point before actually creating the
derived probe.

10 years agoquery_label(): add well-formed probe point
Jonathan Lebon [Tue, 13 May 2014 20:57:12 +0000 (16:57 -0400)]
query_label(): add well-formed probe point

The probe points created in query_label() are already well-formed. We
use the new interface installed in dwarf_query to simplify it.

10 years agoquery_callee(): add well-formed probe point
Jonathan Lebon [Tue, 13 May 2014 20:40:10 +0000 (16:40 -0400)]
query_callee(): add well-formed probe point

The probe points created in query_callee() are already well-formed. We
use the new interface installed in dwarf_query to simplify it.

10 years agodwarf_query: add probe point editing helper functions
Jonathan Lebon [Wed, 14 May 2014 16:32:39 +0000 (12:32 -0400)]
dwarf_query: add probe point editing helper functions

As mentioned in the previous commit, these functions will help us to
modify the newly mounted probe point into a well-formed one.

10 years agodwarf_query: add mount/unmount_well_formed_probe_point()
Jonathan Lebon [Wed, 14 May 2014 16:20:36 +0000 (12:20 -0400)]
dwarf_query: add mount/unmount_well_formed_probe_point()

In commits e772a6e and 9891c54, we improved the way query_callee() and
query_label() add intermediate probes to the derivation chain by playing
with the dwarf_query. This technique will be required many times in
other places that we will need to fix up.

Therefore, we create two new dwarf_query helper functions. The
mount_well_formed_probe_point() function simply sets the current
base_loc and base_probe of the dwarf_query object to a new one, which is
denoted well-formed.

At first, this new location is simply a copy of the previous location,
with the exception of a fully resolved process/module path. Then,
depending on the probe point type, specific functors are replaced by
their final/non-globby versions to create a truly well-formed probe
point.

More helper functions to edit the functors will be added in the next
patch.

The unmount_well_formed_probe_point() refocuses the dwarf_query to the
previous base_loc/base_probe so that further probe points can be
derived.

10 years agokprobe_builder: remember the .call component
Jonathan Lebon [Tue, 13 May 2014 20:43:24 +0000 (16:43 -0400)]
kprobe_builder: remember the .call component

Although it doesn't make a difference, we remember whether .call was
specified and include it in the created probe so that it is listed as
well.

There's no need to mark it well-formed. It is the last destination, and
it is already well-formed.

10 years agosdt_query: set well-formed intermediate probe
Jonathan Lebon [Wed, 14 May 2014 14:31:07 +0000 (10:31 -0400)]
sdt_query: set well-formed intermediate probe

The specific_loc intermediate probe created in
sdt_query::convert_location() is already well-formed. We mark it as such
so that listings will use this probe.

10 years agoperf_builder: add well-formed intermediate probe
Jonathan Lebon [Tue, 13 May 2014 20:55:06 +0000 (16:55 -0400)]
perf_builder: add well-formed intermediate probe

10 years agohwbkpt_builder: add well-formed intermediate probe
Jonathan Lebon [Tue, 13 May 2014 20:24:35 +0000 (16:24 -0400)]
hwbkpt_builder: add well-formed intermediate probe

10 years agosimplify derived_probe::script_location()
Jonathan Lebon [Tue, 13 May 2014 20:18:43 +0000 (16:18 -0400)]
simplify derived_probe::script_location()

Rather than relying on yucky heuristics, we go the explicit way. The
script_location() function now relies on the new probe_point member
'well_formed', which is true if the probe point represents the 'final'
script-level expression, after wildcard expansion.

Since only each individual probe builder knows what constitutes a
well-formed probe point, it will be up to those to set the 'well_formed'
flag as needed. If the probe point that we want to list is also the
final one, which is the case for many simpler probe points, then no
further work is needed. The following patches modify the appropriate
builders to do just this.

10 years agolisting_mode.exp: new testcase
Jonathan Lebon [Mon, 12 May 2014 21:01:20 +0000 (17:01 -0400)]
listing_mode.exp: new testcase

10 years agolisting_mode.exp: rename to listing_mode_sanity.exp
Jonathan Lebon [Mon, 12 May 2014 20:59:28 +0000 (16:59 -0400)]
listing_mode.exp: rename to listing_mode_sanity.exp

10 years agond_syscall.exp: fix SYSTEMTAP_DEBUGINFO_PATH override
Jonathan Lebon [Mon, 26 May 2014 21:34:27 +0000 (17:34 -0400)]
nd_syscall.exp: fix SYSTEMTAP_DEBUGINFO_PATH override

This is a follow-up to commit 27ce133. Tcl's exec proc can't handle env
var setting as part of its args:

couldn't execute "SYSTEMTAP_DEBUGINFO_PATH=/dev/null": no such file or
directory
FAIL: testsuite/systemtap.syscall/nd_sys.stp compilation

We need to explicitly manipulate the env array to set the
SYSTEMTAP_DEBUGINFO_PATH and then restore it afterwards if needed.

10 years agoImprove BZ16956 by testing nd_syscall tapset without debuginfo.
David Smith [Wed, 21 May 2014 20:21:41 +0000 (15:21 -0500)]
Improve BZ16956 by testing nd_syscall tapset without debuginfo.

* testsuite/systemtap.syscall/nd_syscall.exp: Make sure the nd_syscall
  tapset isn't using debuginfo by setting SYSTEMTAP_DEBUGINFO_PATH to
  /dev/null.

10 years agoFix BZ16960 by handling !CONFIG_USER_NS better.
David Smith [Wed, 21 May 2014 19:09:41 +0000 (14:09 -0500)]
Fix BZ16960 by handling !CONFIG_USER_NS better.

* buildrun.cxx (compile_pass): Convert the from_kuid_munged() test to a
  compile test, instead of an export test.
* runtime/linux/runtime.h: Restore original CONFIG_USER_NS support.
* runtime/linux/autoconf-from_kuid_munged.c: New autoconf test.

10 years agolinux runtime: switch to vmalloc for context[] element allocation
Frank Ch. Eigler [Wed, 21 May 2014 17:43:48 +0000 (13:43 -0400)]
linux runtime: switch to vmalloc for context[] element allocation

The new eventcount.stp changes can result in relatively large context
structures (33712 bytes each on f19/x86-64), which the stp_kmalloc
widget can sometimes fail to allocate.  Switching to the numa-aware
vmalloc front-end lets these allocations succeed.

TBD: those contexts shouldn't be that large.

10 years agoeventcount.stp sample: add some more sorting options, config disclosure
Frank Ch. Eigler [Wed, 21 May 2014 17:11:26 +0000 (13:11 -0400)]
eventcount.stp sample: add some more sorting options, config disclosure

10 years agostapprobes.3stap: highlight obsolete nature of kernel.mark probes
Frank Ch. Eigler [Wed, 21 May 2014 13:20:28 +0000 (09:20 -0400)]
stapprobes.3stap: highlight obsolete nature of kernel.mark probes

10 years agoPR16955: adapt testsuite
Jonathan Lebon [Sun, 18 May 2014 19:29:03 +0000 (15:29 -0400)]
PR16955: adapt testsuite

- pr10854.exp: use -w to suppress warnings re. blacklisted functions
- rlimit.exp: ditto

10 years agoPR16955: improve blacklisting diagnostics
Jonathan Lebon [Fri, 16 May 2014 20:48:26 +0000 (16:48 -0400)]
PR16955: improve blacklisting diagnostics

Create a new enum to describe the reason why the function was
blacklisted. In dwarf_query::add_probe_point(), emit a warning if
blacklisted.

10 years agolinux/runtime.h: more CONFIG_USER_NS fallout
Frank Ch. Eigler [Sat, 17 May 2014 20:15:01 +0000 (16:15 -0400)]
linux/runtime.h: more CONFIG_USER_NS fallout

Partially unrolling commit 7d35a948401, because on modern kernels
(3.14+), the from_k?id_munged functions are defined as inlines, and
should be used regardless of CONFIG_USER_NS etc.  The buildrun.cxx
exportedness test for from_kuid_munged would fail, triggering our
runtime to use a do-nothing macro instead.

Until a more programmatic way is found for those unidentified older
kernels that have CONFIG_USER_NS but no from_k?id_munged inlines,
for now a user will have to work around the build problem with

  % stap -DSTAP_FAKE_KID_MUNGED

10 years agoMore linux 3.14 porting, sans CONFIG_USER_NS
Frank Ch. Eigler [Sat, 17 May 2014 19:36:46 +0000 (15:36 -0400)]
More linux 3.14 porting, sans CONFIG_USER_NS

This time, cover the remaining tapset/runtime stuff.

10 years agoPR16956: add "kernel<linux/types.h>" to all nd_syscall.* @cast ops
Frank Ch. Eigler [Sat, 17 May 2014 16:54:37 +0000 (12:54 -0400)]
PR16956: add "kernel<linux/types.h>" to all nd_syscall.* @cast ops

We can't take blood from stone - dwarf from a kernel whom we are
targeting for non-dwarf processing.  So generate dwarf from the
headers if necessary.

10 years agowarn about missing kernel symbol table
Frank Ch. Eigler [Sat, 17 May 2014 16:31:46 +0000 (12:31 -0400)]
warn about missing kernel symbol table

On some distros (e.g., arch linux), no System.map* file survives the
build process, but there may be ways to fabricate doppelgangers.

* session.cxx (systemtap_session::parse_kernel_functions): Warn if
  none found.
* warning::symbols: new man page
* warning::debuginfo: xref.

10 years agosession: don't suppress warnings in dump mode if -vv
Jonathan Lebon [Fri, 16 May 2014 21:11:16 +0000 (17:11 -0400)]
session: don't suppress warnings in dump mode if -vv

Just like how derive_probes() still prints errors in dump mode if -vv is
supplied, we do the same for warnings.

10 years agowhitespace tweak for examples html index
Frank Ch. Eigler [Fri, 16 May 2014 16:06:49 +0000 (12:06 -0400)]
whitespace tweak for examples html index

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