From c3799d720b60bd74a60de4addcd0d77a90f7842a Mon Sep 17 00:00:00 2001 From: Ananth N Mavinakayanahalli Date: Wed, 14 May 2008 10:56:37 +0530 Subject: PR 5955 - Accept ; terminated globals --- ChangeLog | 7 ++++ NEWS | 5 +++ parse.cxx | 3 ++ testsuite/parseko/twentyfive.stp | 3 ++ testsuite/parseko/twentyfour.stp | 3 ++ testsuite/systemtap.base/global_vars.exp | 5 +++ testsuite/systemtap.base/global_vars.stp | 57 ++++++++++++++++++++++++++++++++ 7 files changed, 83 insertions(+) create mode 100644 testsuite/parseko/twentyfive.stp create mode 100644 testsuite/parseko/twentyfour.stp create mode 100644 testsuite/systemtap.base/global_vars.exp create mode 100644 testsuite/systemtap.base/global_vars.stp diff --git a/ChangeLog b/ChangeLog index e913e76b..13f6254e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-13 Ananth N Mavinakayanahalli + PR 5955. + * parse.cxx (parser::parse_global): accept ";" terminated globals + * NEWS - update documentation + * testsuite/systemtap.base/global_vars.(stp/exp) - supporting tests + * testsuite/parseko/twenty(four/five).stp - supporting tests + 2008-05-12 Jim Keniston PR 4311 - Function boundary tracing without debuginfo: Phase II diff --git a/NEWS b/NEWS index 03fb7117..5d45b4a8 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,11 @@ probe process(PID).syscall.return { } probe process("PATH").syscall.return { } +- Globals now accept ; terminators + + global odds, evens; + global little[10], big[5]; + * What's new in version 0.6 - A copy of the systemtap tutorial and language reference guide diff --git a/parse.cxx b/parse.cxx index ea22f36d..82116009 100644 --- a/parse.cxx +++ b/parse.cxx @@ -1215,6 +1215,9 @@ parser::parse_global (vector & globals, vector&) t = peek (); } + if (t && t->type == tok_operator && t->content == ";") // termination + next(); + if (t && t->type == tok_operator && t->content == ",") // next global { next (); diff --git a/testsuite/parseko/twentyfive.stp b/testsuite/parseko/twentyfive.stp new file mode 100644 index 00000000..bebc72f8 --- /dev/null +++ b/testsuite/parseko/twentyfive.stp @@ -0,0 +1,3 @@ +#! stap -p1 + +global a,;b diff --git a/testsuite/parseko/twentyfour.stp b/testsuite/parseko/twentyfour.stp new file mode 100644 index 00000000..41ea076d --- /dev/null +++ b/testsuite/parseko/twentyfour.stp @@ -0,0 +1,3 @@ +#! stap -p1 + +global a;,b diff --git a/testsuite/systemtap.base/global_vars.exp b/testsuite/systemtap.base/global_vars.exp new file mode 100644 index 00000000..059ebf8d --- /dev/null +++ b/testsuite/systemtap.base/global_vars.exp @@ -0,0 +1,5 @@ +# Check that global variables terminated with a ; work fine + +set test "global_vars" + +stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string diff --git a/testsuite/systemtap.base/global_vars.stp b/testsuite/systemtap.base/global_vars.stp new file mode 100644 index 00000000..737e2556 --- /dev/null +++ b/testsuite/systemtap.base/global_vars.stp @@ -0,0 +1,57 @@ +/* + * global_vars.stp + * + * Check that global variables with a ; termination work fine + */ + +probe begin { println("systemtap starting probe") } +probe end { println("systemtap ending probe") } + +global a; +global c, d; +global g = 42; +global e[1], f; +global gstr = "foobar"; + +global gstr_saved; +probe begin(-9223372036854775808) { + c = g + d = c + g + a = d + f = c + e[0] = "a"; + gstr_saved = gstr +} + +probe end { + if (c == 42) + println("systemtap test success") + else + printf("systemtap test failure - c:%d != 42\n", c) + + if (d == (c + g)) + println("systemtap test success") + else + printf("systemtap test failure - d:%d != %d\n", d, (c+g)) + + if (a == d) + println("systemtap test success") + else + printf("systemtap test failure - a:%d != %d\n", a, d) + + if (f == c) + println("systemtap test success") + else + printf("systemtap test failure - f:%d != %d\n", f, c) + + if (e[0] == "a") + println("systemtap test success") + else + printf("systemtap test failure - e:%s != a\n", e[0]) + + if (gstr_saved == "foobar") + println("systemtap test success") + else + printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved) +} + -- cgit