summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2008-08-05 12:31:21 -0400
committerStan Cox <scox@redhat.com>2008-08-05 12:31:21 -0400
commita93f0b31fe6c8961aef9da22ce2cf41d8fd52240 (patch)
treeb346e338493c0b28d69a88c53bec234ffb1b6573
parenta4cc1d081ede55ed6c743147d62fcc3519f73a71 (diff)
downloadsystemtap-steved-a93f0b31fe6c8961aef9da22ce2cf41d8fd52240.tar.gz
systemtap-steved-a93f0b31fe6c8961aef9da22ce2cf41d8fd52240.tar.xz
systemtap-steved-a93f0b31fe6c8961aef9da22ce2cf41d8fd52240.zip
Add test for $$vars, $$params, $$locals.
-rw-r--r--ChangeLog5
-rw-r--r--NEWS4
-rw-r--r--tapsets.cxx1
-rw-r--r--testsuite/ChangeLog3
-rw-r--r--testsuite/systemtap.base/vars.exp32
5 files changed, 45 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 618ca96e..09e2ff37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-05 Stan Cox <scox@redhat.com>
+
+ * NEWS: Updated $$vars, $$parms, $$locals.
+ * tapsets.cxx (visit_target_symbol): Missing break typo.
+
2008-08-04 Stan Cox <scox@redhat.com>
* tapsets.cxx (dwarf_var_expanding_copy_visitor::visit_target_symbol):
diff --git a/NEWS b/NEWS
index 65af9271..b85c097e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@
* What's new in version 0.7
+- A formatted string representation of the variables, parameters, or local
+ variables at a probe point is now supported via the special $$vars,
+ $$parms, and $$locals context variables.
+
- .statement("func@file:*") and .statement("func@file:M-N") probes are now
supported to allow matching a range of lines in a function. This allows
tracing the execution of a function.
diff --git a/tapsets.cxx b/tapsets.cxx
index ca91659b..71c92470 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4280,6 +4280,7 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
case DW_TAG_variable:
if (e->base_name == "$$parms")
continue;
+ break;
case DW_TAG_formal_parameter:
if (e->base_name == "$$locals")
continue;
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 67d741e5..fcbd7254 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,6 @@
+2008-08-05 Stan Cox <scox@redhat.com>
+
+ * systemtap.base/vars.exp: New test.
2008-08-03 Wenji Huang <wenji.huang@oracle.com>
diff --git a/testsuite/systemtap.base/vars.exp b/testsuite/systemtap.base/vars.exp
new file mode 100644
index 00000000..7541c01b
--- /dev/null
+++ b/testsuite/systemtap.base/vars.exp
@@ -0,0 +1,32 @@
+# Script for testing $$vars, $$parms, $$locals
+
+set test "vars"
+
+# grab C statement that $$vars yields
+set cmd [concat stap -p3 -e {"probe kernel.statement(\"bio_copy_user@fs/bio.c+1\") \{print (\$\$vars)\}"} 2>&1 | grep {"printf.*="} | sed -e {"s/^.*MAXSTRINGLEN, \"//"} -e {s/..\".*$//}]
+catch {eval exec $cmd} vars
+
+# grab C statement that $$parms yields
+set cmd [regsub "vars" $cmd "parms"]
+catch {eval exec $cmd} parms
+
+# grab C statement that $$locals yields
+set cmd [regsub "parms" $cmd "locals"]
+catch {eval exec $cmd} locals
+
+# syntax check of $$vars C statement
+set vars_ok [regexp "(\[a-z_\]+=%#llx *)+" $vars]
+if {!$vars_ok} {
+ fail "$test"
+} else {
+ pass "$test"
+}
+
+# $$vars should be equivalent to $$parms + $$locals
+if {![string equal [string trim $vars] \
+ [string trim [concat $parms " " $locals]]]} {
+ fail "$test parms/locals"
+} else {
+ pass "$test parms/locals"
+}
+