From f4fe2e932cc8f445e9e1bc52863e11b669e3afc9 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 3 Mar 2010 00:28:22 -0500 Subject: PR11004: try / catch error-handling script syntax * parse.h (try_block): New class. Update basic visitors. * staptree.cxx: Implement basic visitors. * parse.cxx (expect_kw): Fix to actually look for keywords. (parse_try_block): New function. (lexer ctor): Designate 'try' and 'catch' as keywords. * elaborate.cxx (dead_assignment_remover, dead_statmtexpr_remover): Optimize. (other visitors): Implement. * translate.cxx (c_unparser): Implement via super-handy __local__ labels. (emit_probe, emit_function): Make outer out: label also __local__. * testsuite/buildok/fortyone.stp, semko/fortynine.stp, systemtap.base/trycatch.exp: Test it. * NEWS, doc/langref.txt, stap.1.in: Document it. --- stap.1.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'stap.1.in') diff --git a/stap.1.in b/stap.1.in index 6ef39ba5..531b0f88 100644 --- a/stap.1.in +++ b/stap.1.in @@ -493,7 +493,16 @@ not taken anywhere, then a return statement is not needed, and the function will have a special "unknown" type with no return value. .TP .BR next -Return now from enclosing probe handler. +Return now from enclosing probe handler. This is especially useful in +probe aliases that apply event filtering predicates. +.TP +.BR try " { STMT1 } " catch " { STMT2 }" +Run the statements in the first block. Upon any run-time errors, abort +STMT1 and start executing STMT2. Any errors in STMT2 will propagate to +outer try/catch blocks, if any. +.TP +.BR try " { STMT1 } " catch "(VAR) { STMT2 }" +Same as above, plus assign the error message to the string scalar variable VAR. .TP .BR delete " ARRAY[INDEX1, INDEX2, ...]" Remove from ARRAY the element specified by the index tuple. The value will no -- cgit