summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS5
-rw-r--r--doc/langref.tex8
-rw-r--r--stapprobes.5.in10
-rw-r--r--testsuite/ChangeLog5
-rw-r--r--testsuite/systemtap.base/stmt_rel.exp9
-rw-r--r--testsuite/systemtap.base/stmt_rel.stp43
7 files changed, 82 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ae5f02b..b9caff15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-09 Stan Cox <scox@redhat.com>
+
+ * NEWS: Updated kernel.statement relative line number.
+ * stapprobes.5.in: Likewise.
+
2008-06-09 David Smith <dsmith@redhat.com>
* tapsets.cxx (utrace_derived_probe::join_group): Removed
diff --git a/NEWS b/NEWS
index ca7d741f..e8ddb69c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
* What's new in version 0.7
+- .statement("func@file+line") probes are now supported to allow a
+ match relative to the entry of the function incremented by line
+ number. This allows using the same systemtap script if the rest
+ of the file.c source only changes slightly.
+
- Stack backtraces for x86 and x86-64 are generated by a dwarf
debuginfo-based unwinder based on the code from <jbeulich@novell.com>.
This should give more accurate backtraces.
diff --git a/doc/langref.tex b/doc/langref.tex
index 46d350f6..28a9f1b6 100644
--- a/doc/langref.tex
+++ b/doc/langref.tex
@@ -751,7 +751,11 @@ In most cases, the path should be relative to the top of the
linux source directory, although an absolute path may be necessary for some kernels.
If a relative pathname doesn't work, try absolute.
\item The third part is optional if the file name part was given. It identifies
-the line number in the source file, preceded by a colon.
+the line number in the source file, preceded by a '':'' or ''+''.
+The line number is assumed to be an
+absolute line number if preceded by a '':'', or relative to the entry of
+function if preceded by a ''+''.
+
\end{enumerate}
Alternately, specify PATTERN as a numeric constant to indicate a relative
module address or an absolute kernel address.
@@ -825,6 +829,8 @@ Example:
# Refers to the statement at line 2917 within the
# kernel/sched.c file:
kernel.statement("*@kernel/sched.c:2917")
+# Refers to the statement at line bio_init+3 within the fs/bio.c file:
+kernel.statement("bio_init@fs/bio.c+3")
\end{verbatim}
\end{vindent}
diff --git a/stapprobes.5.in b/stapprobes.5.in
index b49c8291..025aa2a8 100644
--- a/stapprobes.5.in
+++ b/stapprobes.5.in
@@ -256,7 +256,10 @@ linux source directory, although an absolute path may be necessary for some kern
If a relative pathname doesn't work, try absolute.
.IP \(bu 4
Finally, the third part is optional if the file name part was given,
-and identifies the line number in the source file, preceded by a ":".
+and identifies the line number in the source file preceded by a ":"
+or a "+". The line number is assumed to be an
+absolute line number if preceded by a ":", or relative to the entry of
+function if preceded by a "+".
.PP
As an alternative, PATTERN may be a numeric constant, indicating an
(module-relative or kernel-_stext-relative) address. In guru mode
@@ -493,7 +496,10 @@ refers to the first byte of the statement whose compiled instructions
include the given address in the kernel.
.TP
kernel.statement("*@kernel/sched.c:2917")
-refers to the statement of line 2917 within the "kernel/sched.c".
+refers to the statement of line 2917 within "kernel/sched.c".
+.TP
+kernel.statement("bio_init@fs/bio.c+3")
+refers to the statement at line bio_init+3 within "fs/bio.c".
.TP
syscall.*.return
refers to the group of probe aliases with any name in the third position
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 0c414115..bdae76e3 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-09 Stan Cox <scox@redhat.com>
+
+ * systemtap.base/stmt_rel.stp: New test.
+ * systemtap.base/stmt_rel.exp: Likewise.
+
2008-06-06 David Smith <dsmith@redhat.com>
* systemtap.base/utrace_p4.exp: Updated for utrace probe changes.
diff --git a/testsuite/systemtap.base/stmt_rel.exp b/testsuite/systemtap.base/stmt_rel.exp
new file mode 100644
index 00000000..e929b292
--- /dev/null
+++ b/testsuite/systemtap.base/stmt_rel.exp
@@ -0,0 +1,9 @@
+# test integer limits. Set and print variables and print constants.
+
+set test "stmt_rel"
+set ::result_string {PASS bio_init
+PASS line number
+PASS address
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.base/stmt_rel.stp b/testsuite/systemtap.base/stmt_rel.stp
new file mode 100644
index 00000000..a5f1cc2a
--- /dev/null
+++ b/testsuite/systemtap.base/stmt_rel.stp
@@ -0,0 +1,43 @@
+global stack2, stack2pp, stack2func
+
+probe kernel.statement("bio_init@fs/bio.c+2") {
+ stack2 = tokenize(backtrace(), " ")
+ stack2func = probefunc()
+ stack2pp = pp()
+}
+probe kernel.statement("bio_init@fs/bio.c+3") {
+ stack3 = tokenize(backtrace(), " " )
+ stack3func = probefunc()
+ stack3pp = pp()
+
+ stack2pp = tokenize(stack2pp,":")
+ stack2pp = tokenize("",":")
+ stack3pp = tokenize(stack3pp,":")
+ stack3pp = tokenize("",":")
+
+ stack2line = strtol (substr(stack2pp,0,strlen(stack2pp)-2), 10)
+ stack3line = strtol (substr(stack3pp,0,strlen(stack3pp)-2), 10)
+
+ if (stack2func == stack3func) {
+ printf ("PASS %s\n", stack2func)
+ }
+ else {
+ printf ("FAIL %s %s\n", stack2func, stack3func)
+ }
+
+ if ((stack2line + 1) == stack3line) {
+ printf ("PASS line number\n")
+ }
+ else {
+ printf ("FAIL line number %d %d\n", stack2line, stack3line)
+ }
+
+ if (stack2 < stack3) {
+ printf ("PASS address\n")
+ }
+ else {
+ printf ("FAIL address %s %s\n", stack2, stack3)
+ }
+
+ exit()
+}