From: Wenji Huang Date: Mon, 10 Aug 2009 23:29:50 +0000 (-0400) Subject: Avoid assertion error for no matched function in statement probe X-Git-Tag: release-1.0~174 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=e679283a5ae5555db19d613fa3299f96cfc94eb7;p=systemtap.git Avoid assertion error for no matched function in statement probe * dwflpp.cxx (iterate_over_functions): Return for NULL pointer. * testsuite/systemtap.base/statement.exp: Add test case. --- diff --git a/dwflpp.cxx b/dwflpp.cxx index c31fbe4e8..d02698b2a 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -791,6 +791,8 @@ dwflpp::iterate_over_srcfile_lines (char const * srcfile, auto_free_ref free_srcsp(srcsp); get_module_dwarf(); + if (!this->function) + return; if (line_type == RELATIVE) { diff --git a/testsuite/systemtap.base/statement.exp b/testsuite/systemtap.base/statement.exp index d8fce8d8a..8d4c59f5b 100644 --- a/testsuite/systemtap.base/statement.exp +++ b/testsuite/systemtap.base/statement.exp @@ -34,5 +34,17 @@ expect { } wait if { $hint == 1 && $probes == 1 } then { pass "$test -p2" } else { fail "$test -p2 ($probes)" } + +set no_func stmtnofunc +set func_script "probe process(\"%s\").statement(\"foo@%s.c:*\"){}" +set script [format $func_script "./$test" "$test"] +spawn stap -p2 -e $script +expect { + -timeout 60 + -re {semantic error: no match while resolving probe point.*\r\n} { xfail $no_func } + timeout { fail "$no_func (timeout)" } + eof { fail $no_func } +} +wait exec rm -f $test