summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <joshua.i.stone@intel.com>2008-09-10 18:30:45 -0700
committerJosh Stone <joshua.i.stone@intel.com>2008-09-10 18:30:45 -0700
commit223f5b6b6e2c945c442a5dde7e63e637237f575b (patch)
tree69ec2cdf7ae362da6793895649fb43720654a6c5
parentdd13da3b90d71b94c8dc09942fee97f8513df348 (diff)
downloadsystemtap-steved-223f5b6b6e2c945c442a5dde7e63e637237f575b.tar.gz
systemtap-steved-223f5b6b6e2c945c442a5dde7e63e637237f575b.tar.xz
systemtap-steved-223f5b6b6e2c945c442a5dde7e63e637237f575b.zip
Ensure that "stap -l ..." only prints probe names, not variables.
-rw-r--r--ChangeLog5
-rw-r--r--main.cxx17
-rw-r--r--testsuite/ChangeLog4
-rw-r--r--testsuite/systemtap.base/probe_list.exp19
4 files changed, 37 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c575535..3855d477 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-10 Josh Stone <joshua.i.stone@intel.com>
+
+ * main.cxx (printscript): Ensure no variables are printed in probe lists
+ unless -L was specified.
+
2008-09-10 Frank Ch. Eigler <fche@elastic.org>
PR6876: translator speedup for many $vars
diff --git a/main.cxx b/main.cxx
index 634feb03..563e4b01 100644
--- a/main.cxx
+++ b/main.cxx
@@ -182,14 +182,15 @@ printscript(systemtap_session& s, ostream& o)
if (seen.find (pp) == seen.end())
{
o << pp;
- // This list will be empty unless s.unoptimized = true -- i.e., -L mode
- for (unsigned j=0; j<p->locals.size(); j++)
- {
- o << " ";
- vardecl* v = p->locals[j];
- v->printsig (o);
- }
- o << endl;
+ // Print the locals for -L mode only
+ if (s.unoptimized)
+ for (unsigned j=0; j<p->locals.size(); j++)
+ {
+ o << " ";
+ vardecl* v = p->locals[j];
+ v->printsig (o);
+ }
+ o << endl;
seen.insert (pp);
}
}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 3effc92f..288705b1 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-10 Josh Stone <joshua.i.stone@intel.com>
+
+ * systemtap.base/probe_list.exp: New test for correct probe listing.
+
2008-09-09 Frank Ch. Eigler <fche@elastic.org>
* systemtap.base/uprobes.*: Tweak regexps for read-only src tree
diff --git a/testsuite/systemtap.base/probe_list.exp b/testsuite/systemtap.base/probe_list.exp
new file mode 100644
index 00000000..b3e6884b
--- /dev/null
+++ b/testsuite/systemtap.base/probe_list.exp
@@ -0,0 +1,19 @@
+# This test ensures that "-l" lists only include probe names, and not any of
+# the local variables. There was a bug that "-l" would print variables that
+# couldn't be optimized away, due to an incorrect assumption in the
+# implementation.
+
+# NB: This is a bit abusively formed. Currently -l internally writes "probe"
+# and "{}" around its argument. For this test we want to introduce a variable
+# that can't be optimized away. The trailing comment mark lets the auto "{}"
+# get ignored.
+spawn stap -l "begin { if (a) next }#"
+
+expect {
+ # the output should not include anything else, like the 'a' local.
+ -re "^begin\r\n$" {
+ pass "probe list is correct"
+ return
+ }
+}
+fail "probe list is incorrect"