* tapsets.cxx (plt_expanding_visitor::visit_target_symbol): Throw a
semantic_error for missing $var, so it may be caught and chained for
later. This ensures that the visitor always has a provide() too.
* testsuite/semko/plt1.stp: New, check that missing $var is an error.
* testsuite/semok/plt1.stp: New, check that $$name works, as does
@defined on a missing $var.
provide(myname);
return;
}
+
+ // variable not found -> throw a semantic error
+ // (only to be caught right away, but this may be more complex later...)
+ string alternatives = "$$name";
+ throw semantic_error(_F("unable to find plt variable '%s' (alternatives: %s)",
+ e->name.c_str(), alternatives.c_str()), e->tok);
}
catch (const semantic_error &er)
{
--- /dev/null
+#! stap -p2
+
+probe process("stap").plt {
+ println($no_such_var)
+}
+
--- /dev/null
+#! stap -p2
+
+probe process("stap").plt {
+ println($$name)
+ println(@defined($no_such_var) ? $no_such_var : 0)
+}