From ed82b7c902d6a2e26452ec51c9cdb9665dbf9e97 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 27 Apr 2009 22:35:05 -0400 Subject: [PATCH] PR10102: tolerate mismatched optional probe * elaborate.cxx: Early return for mismatched optional probe. * testsuite/systemtap.base/optionalprobe.exp: New test case. * testsuite/systemtap.base/optionalprobe.stp: Ditto. --- elaborate.cxx | 3 +++ testsuite/systemtap.base/optionalprobe.exp | 9 +++++++++ testsuite/systemtap.base/optionalprobe.stp | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 testsuite/systemtap.base/optionalprobe.exp create mode 100644 testsuite/systemtap.base/optionalprobe.stp diff --git a/elaborate.cxx b/elaborate.cxx index 47b77c9b2..53f2a8f68 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -406,6 +406,9 @@ match_node::find_and_build (systemtap_session& s, sub_map_iterator_t i = sub.find (match); if (i == sub.end()) // no match { + if (loc->optional) /* PR10102: to tolerate mismatched optional probe */ + return; + string alternatives; for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++) alternatives += string(" ") + i->first.str(); diff --git a/testsuite/systemtap.base/optionalprobe.exp b/testsuite/systemtap.base/optionalprobe.exp new file mode 100644 index 000000000..5484003c0 --- /dev/null +++ b/testsuite/systemtap.base/optionalprobe.exp @@ -0,0 +1,9 @@ +set test "optionalprobe" +spawn stap -p2 -w $srcdir/$subdir/$test.stp +expect { + -timeout 60 + -re "# probes\r\n" { exp_continue } + -re "^begin" { pass $test } + eof { fail $test } + timeout { fail "$test unexpected timeout" } +} diff --git a/testsuite/systemtap.base/optionalprobe.stp b/testsuite/systemtap.base/optionalprobe.stp new file mode 100644 index 000000000..239cf6e3d --- /dev/null +++ b/testsuite/systemtap.base/optionalprobe.stp @@ -0,0 +1,6 @@ +#! stap + +# test optional probe + +probe foo ?, bar !, foo* ?, bar* !, begin { +} -- 2.43.5