diff options
author | fche <fche> | 2005-06-16 14:59:17 +0000 |
---|---|---|
committer | fche <fche> | 2005-06-16 14:59:17 +0000 |
commit | b55bc428b7e03ce7bcf6ec1eb502f5f443fbd0b8 (patch) | |
tree | 46949feb976927d594b1f0039e6e23e23da2ae86 /tapsets.h | |
parent | f7c895c8d708122a8f241b2ed7fee519a0b1df43 (diff) | |
download | systemtap-steved-b55bc428b7e03ce7bcf6ec1eb502f5f443fbd0b8.tar.gz systemtap-steved-b55bc428b7e03ce7bcf6ec1eb502f5f443fbd0b8.tar.xz systemtap-steved-b55bc428b7e03ce7bcf6ec1eb502f5f443fbd0b8.zip |
2005-06-14 Graydon Hoare <graydon@redhat.com>
* tapsets.h: New file.
(derived_probe_builder): Callback for making derived probes.
(match_key): Component of pattern-matching tree.
(match_node): Other component of pattern-matching tree.
* tapsets.cxx: Add pattern-matching system for probes.
(alias_derived_probe): Skeleton for alias probes.
(dwarf_derived_probe): Skeleton for dwarf probes.
(register_standard_tapsets): Registry for standard tapsets.
Diffstat (limited to 'tapsets.h')
-rw-r--r-- | tapsets.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tapsets.h b/tapsets.h new file mode 100644 index 00000000..e1ca5f8d --- /dev/null +++ b/tapsets.h @@ -0,0 +1,72 @@ +#ifndef TAPSETS_H +#define TAPSETS_H + +// -*- C++ -*- +// Copyright (C) 2005 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. + +#include "config.h" +#include "staptree.h" +#include "elaborate.h" +#include "translate.h" +#include <iostream> +#include <sstream> +#include <vector> +#include <map> + +struct +derived_probe_builder +{ + virtual derived_probe * build(probe * base, + probe_point * location, + std::map<std::string, literal *> const & parameters) = 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); +}; + + +void +register_standard_tapsets(match_node & root); + + +#endif // TAPSETS_H |