diff options
author | Josh Stone <jistone@redhat.com> | 2009-02-18 12:53:08 -0800 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-02-18 12:53:08 -0800 |
commit | 23ad66b41ded81502948584816390c634f66c5ee (patch) | |
tree | db900ca0141a16152c3bf27395cd4975cad6a1ab /staptree.h | |
parent | 2aa2ccb83142c3bf98ac8ee1558a0ee72dff3a1f (diff) | |
parent | 482fe2af17347b472232c5d7c4b26e53606e395e (diff) | |
download | systemtap-steved-23ad66b41ded81502948584816390c634f66c5ee.tar.gz systemtap-steved-23ad66b41ded81502948584816390c634f66c5ee.tar.xz systemtap-steved-23ad66b41ded81502948584816390c634f66c5ee.zip |
Enable typecasting with @cast
println(@cast(myptr, "task_struct")->pid)
println(@cast(myptr, "task_struct", "kernel")->pid)
Merge branch 'typecast', bump ChangeLog entries to push date
Diffstat (limited to 'staptree.h')
-rw-r--r-- | staptree.h | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,5 +1,5 @@ // -*- C++ -*- -// Copyright (C) 2005-2008 Red Hat Inc. +// Copyright (C) 2005-2009 Red Hat Inc. // Copyright (C) 2006 Intel Corporation. // // This file is part of systemtap, and is free software. You can @@ -238,6 +238,15 @@ struct target_symbol: public symbol }; +struct cast_op: public target_symbol +{ + expression *operand; + std::string type, module; + void print (std::ostream& o) const; + void visit (visitor* u); +}; + + struct arrayindex: public expression { std::vector<expression*> indexes; @@ -680,6 +689,7 @@ struct visitor virtual void visit_print_format (print_format* e) = 0; virtual void visit_stat_op (stat_op* e) = 0; virtual void visit_hist_op (hist_op* e) = 0; + virtual void visit_cast_op (cast_op* e) = 0; }; @@ -720,6 +730,7 @@ struct traversing_visitor: public visitor void visit_print_format (print_format* e); void visit_stat_op (stat_op* e); void visit_hist_op (hist_op* e); + void visit_cast_op (cast_op* e); }; @@ -759,6 +770,7 @@ struct varuse_collecting_visitor: public functioncall_traversing_visitor void visit_pre_crement (pre_crement *e); void visit_post_crement (post_crement *e); void visit_foreach_loop (foreach_loop *s); + void visit_cast_op (cast_op* e); bool side_effect_free (); bool side_effect_free_wrt (const std::set<vardecl*>& vars); @@ -808,6 +820,7 @@ struct throwing_visitor: public visitor void visit_print_format (print_format* e); void visit_stat_op (stat_op* e); void visit_hist_op (hist_op* e); + void visit_cast_op (cast_op* e); }; // A visitor similar to a traversing_visitor, but with the ability to rewrite @@ -868,6 +881,7 @@ struct update_visitor: public visitor virtual void visit_print_format (print_format* e); virtual void visit_stat_op (stat_op* e); virtual void visit_hist_op (hist_op* e); + virtual void visit_cast_op (cast_op* e); private: std::stack<void *> targets; @@ -922,6 +936,7 @@ struct deep_copy_visitor: public update_visitor virtual void visit_print_format (print_format* e); virtual void visit_stat_op (stat_op* e); virtual void visit_hist_op (hist_op* e); + virtual void visit_cast_op (cast_op* e); }; #endif // STAPTREE_H |