summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-12-03 13:38:04 -0500
committerFrank Ch. Eigler <fche@elastic.org>2008-12-03 13:38:04 -0500
commit33d34a13b7632fada659a7ea2541c390dd31b541 (patch)
tree1949862da3b067056d7b8b978674bad4b2c703c9
parentb5e66adadbad65fddc40a2143e3692e41cf6d1af (diff)
parent271d408e09e033857658c83cb722078fab02edda (diff)
downloadsystemtap-steved-33d34a13b7632fada659a7ea2541c390dd31b541.tar.gz
systemtap-steved-33d34a13b7632fada659a7ea2541c390dd31b541.tar.xz
systemtap-steved-33d34a13b7632fada659a7ea2541c390dd31b541.zip
merged
* 'master' of ssh://sources.redhat.com/git/systemtap: PR7053: Add checking empty aggregate and default print where @count==0. Add man page entry for stap -B
-rw-r--r--elaborate.cxx38
-rw-r--r--stap.1.in2
-rw-r--r--testsuite/ChangeLog4
-rw-r--r--testsuite/systemtap.base/global_stat.exp13
4 files changed, 55 insertions, 2 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 84866c35..edd4668d 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1243,7 +1243,43 @@ void add_global_var_display (systemtap_session& s)
}
else
pf->args.push_back(g_sym);
- b->statements.push_back(feb);
+
+ /* PR7053: Checking empty aggregate for global variable */
+ if (l->type == pe_stats) {
+ stat_op *so= new stat_op;
+ so->ctype = sc_count;
+ so->type = pe_long;
+ so->stat = g_sym;
+ so->tok = l->tok;
+ comparison *be = new comparison;
+ be->op = ">";
+ be->tok = l->tok;
+ be->left = so;
+ be->right = new literal_number(0);
+
+ /* Create printf @count=0x0 in else block */
+ print_format* pf_0 = new print_format;
+ pf_0->print_to_stream = true;
+ pf_0->print_with_format = true;
+ pf_0->print_with_delim = false;
+ pf_0->print_with_newline = false;
+ pf_0->print_char = false;
+ pf_0->raw_components += l->name;
+ pf_0->raw_components += " @count=0x0\\n";
+ pf_0->tok = print_tok;
+ pf_0->components = print_format::string_to_components(pf_0->raw_components);
+ expr_statement* feb_else = new expr_statement;
+ feb_else->value = pf_0;
+ feb_else->tok = print_tok;
+ if_statement *ifs = new if_statement;
+ ifs->tok = l->tok;
+ ifs->condition = be;
+ ifs->thenblock = feb ;
+ ifs->elseblock = feb_else;
+ b->statements.push_back(ifs);
+ }
+ else /* other non-stat cases */
+ b->statements.push_back(feb);
}
else // Array
{
diff --git a/stap.1.in b/stap.1.in
index 7b26bc2d..d4f8946a 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -156,7 +156,7 @@ be used to override limit parameters described below.
.BI \-R " DIR"
Look for the systemtap runtime sources in the given directory.
.TP
-.BI \-r " DIR"
+.BI \-r " /DIR"
Build for kernel in given build tree.
.TP
.BI \-r " RELEASE"
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 1ba4e287..ea8caa37 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -2,6 +2,10 @@
* systemtap.base/debugpath.exp: Correct test case for new -r behavior.
+2008-12-02 Wenji Huang <wenji.huang@oracle.com>
+ PR7053.
+ * systemtap.base/global_stat.exp: New test.
+
2008-11-29 Frank Ch. Eigler <fche@elastic.org>
* systemtap.base/uprobes.exp: Simplify -p5 test.
diff --git a/testsuite/systemtap.base/global_stat.exp b/testsuite/systemtap.base/global_stat.exp
new file mode 100644
index 00000000..704556f6
--- /dev/null
+++ b/testsuite/systemtap.base/global_stat.exp
@@ -0,0 +1,13 @@
+if {![installtest_p]} {
+ untested global_stat
+ return
+}
+
+spawn stap -e {global var; probe never {var<<<1} probe begin {exit()}}
+expect {
+ -timeout 60
+ "var @count=0x0" { pass "global_stat" }
+ timeout {fail "global_stat: unexpected timeout"}
+ eof {fail "global_stat: unexpected EOF"}
+}
+wait;close