diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2010-03-03 00:28:22 -0500 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2010-03-03 00:33:43 -0500 |
commit | f4fe2e932cc8f445e9e1bc52863e11b669e3afc9 (patch) | |
tree | ba062952c0a37f02ebcf0eb2f533d44ee41fdb25 /staptree.h | |
parent | d105f6642677bd9ef1b20d1ba180ba0163cb0fa6 (diff) | |
download | systemtap-steved-f4fe2e932cc8f445e9e1bc52863e11b669e3afc9.tar.gz systemtap-steved-f4fe2e932cc8f445e9e1bc52863e11b669e3afc9.tar.xz systemtap-steved-f4fe2e932cc8f445e9e1bc52863e11b669e3afc9.zip |
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.
Diffstat (limited to 'staptree.h')
-rw-r--r-- | staptree.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -527,6 +527,16 @@ struct block: public statement }; +struct try_block: public statement +{ + block* try_block; // may be 0 + block* catch_block; // may be 0 + symbol* catch_error_var; // may be 0 + void print (std::ostream& o) const; + void visit (visitor* u); +}; + + struct expr_statement; struct for_loop: public statement { @@ -698,6 +708,7 @@ struct visitor virtual ~visitor () {} virtual void visit_block (block *s) = 0; + virtual void visit_try_block (try_block *s) = 0; virtual void visit_embeddedcode (embeddedcode *s) = 0; virtual void visit_null_statement (null_statement *s) = 0; virtual void visit_expr_statement (expr_statement *s) = 0; @@ -740,6 +751,7 @@ struct visitor struct traversing_visitor: public visitor { void visit_block (block *s); + void visit_try_block (try_block *s); void visit_embeddedcode (embeddedcode *s); void visit_null_statement (null_statement *s); void visit_expr_statement (expr_statement *s); @@ -805,6 +817,7 @@ struct varuse_collecting_visitor: public functioncall_traversing_visitor current_lvalue(0), current_lrvalue(0) {} void visit_embeddedcode (embeddedcode *s); + void visit_try_block (try_block *s); void visit_delete_statement (delete_statement *s); void visit_print_format (print_format *e); void visit_assignment (assignment *e); @@ -834,6 +847,7 @@ struct throwing_visitor: public visitor virtual void throwone (const token* t); void visit_block (block *s); + void visit_try_block (try_block *s); void visit_embeddedcode (embeddedcode *s); void visit_null_statement (null_statement *s); void visit_expr_statement (expr_statement *s); @@ -901,6 +915,7 @@ struct update_visitor: public visitor virtual ~update_visitor() { assert(targets.empty()); } virtual void visit_block (block *s); + virtual void visit_try_block (try_block *s); virtual void visit_embeddedcode (embeddedcode *s); virtual void visit_null_statement (null_statement *s); virtual void visit_expr_statement (expr_statement *s); @@ -957,6 +972,7 @@ struct deep_copy_visitor: public update_visitor } virtual void visit_block (block *s); + virtual void visit_try_block (try_block *s); virtual void visit_embeddedcode (embeddedcode *s); virtual void visit_null_statement (null_statement *s); virtual void visit_expr_statement (expr_statement *s); |