summaryrefslogtreecommitdiffstats
path: root/elaborate.h
diff options
context:
space:
mode:
authorgraydon <graydon>2005-06-29 22:42:23 +0000
committergraydon <graydon>2005-06-29 22:42:23 +0000
commit20c6c071f5dfe6942438d97364e74f424217c94b (patch)
tree28e6a1a2dace1f2143ed16fb80f407082536676e /elaborate.h
parent05785c11dfdeaf11d98e7d65486a3870d00b5206 (diff)
downloadsystemtap-steved-20c6c071f5dfe6942438d97364e74f424217c94b.tar.gz
systemtap-steved-20c6c071f5dfe6942438d97364e74f424217c94b.tar.xz
systemtap-steved-20c6c071f5dfe6942438d97364e74f424217c94b.zip
2005-06-27 Graydon Hoare <graydon@redhat.com>
* staptree.{h,cxx} (probe_alias): New structure. * parse.{h,cxx} (parser::parse): Parse probes or probe aliases. (parser::parse_probe): Likewise. * tapsets.{h,cxx}: (derived_probe_builder): (match_key): (match_node): (alias_derived_probe): Move from here, * elaborate.{h,cxx}: to here. * elaborate.h (systemtap_session::pattern_root): New member. (register_library_aliases): New function. * tapsets.cxx: Build one dwarf_derived_probe per target address.
Diffstat (limited to 'elaborate.h')
-rw-r--r--elaborate.h62
1 files changed, 60 insertions, 2 deletions
diff --git a/elaborate.h b/elaborate.h
index 06cec813..3c0c8ed4 100644
--- a/elaborate.h
+++ b/elaborate.h
@@ -13,12 +13,16 @@
#include "parse.h"
#include <string>
#include <vector>
-
+#include <iostream>
+#include <sstream>
+#include <map>
// ------------------------------------------------------------------------
struct systemtap_session;
struct derived_probe;
+struct match_node;
+
struct symresolution_info: public traversing_visitor
{
protected:
@@ -30,7 +34,7 @@ public:
symresolution_info (systemtap_session& s);
// XXX: instead in systemtap_session?
- void derive_probes (probe *p, std::vector<derived_probe*>& dps);
+ void derive_probes (match_node * root, probe *p, std::vector<derived_probe*>& dps);
protected:
vardecl* find_scalar (const std::string& name);
@@ -130,6 +134,57 @@ struct derived_probe: public probe
// }
};
+// ------------------------------------------------------------------------
+
+struct
+derived_probe_builder
+{
+ virtual void build(probe * base,
+ probe_point * location,
+ std::map<std::string, literal *> const & parameters,
+ std::vector<probe *> & results_to_expand_further,
+ std::vector<derived_probe *> & finished_results) = 0;
+ virtual ~derived_probe_builder() {}
+};
+
+
+struct
+match_key
+{
+ std::string name;
+ bool have_parameter;
+ token_type parameter_type;
+
+ match_key(std::string const & n);
+ match_key(probe_point::component const & c);
+
+ match_key & with_number();
+ match_key & with_string();
+ std::string str() const;
+ bool operator<(match_key const & other) const;
+};
+
+
+class
+match_node
+{
+ std::map<match_key, match_node *> sub;
+ derived_probe_builder * end;
+
+ public:
+ match_node();
+ derived_probe_builder * find_builder(std::vector<probe_point::component *> const & components,
+ unsigned pos,
+ std::vector< std::pair<std::string, literal *> > & parameters);
+
+ match_node * bind(match_key const & k);
+ match_node * bind(std::string const & k);
+ match_node * bind_str(std::string const & k);
+ match_node * bind_num(std::string const & k);
+ void bind(derived_probe_builder * e);
+};
+
+// ------------------------------------------------------------------------
class unparser;
@@ -139,6 +194,9 @@ struct systemtap_session
{
systemtap_session ();
+ match_node * pattern_root;
+ void register_library_aliases();
+
// parse trees for the various script files
stapfile* user_file;
std::vector<stapfile*> library_files;