summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-08-19 21:50:42 +0000
committerfche <fche>2005-08-19 21:50:42 +0000
commit98afd80eb5038542fa3a98c75528524b5d4287b6 (patch)
tree2b968e1c8523fd50596431e09f936290220a0d29 /elaborate.cxx
parentefc364eebf15dd7e8b6c93e155af83b6d3971752 (diff)
downloadsystemtap-steved-98afd80eb5038542fa3a98c75528524b5d4287b6.tar.gz
systemtap-steved-98afd80eb5038542fa3a98c75528524b5d4287b6.tar.xz
systemtap-steved-98afd80eb5038542fa3a98c75528524b5d4287b6.zip
2005-08-19 Frank Ch. Eigler <fche@elastic.org>
PR systemtap/1209 * tapsets.cxx * elaborate.cxx (derived_probe_builder): Add get_param function. * elaborate.h: Declare them. * tapsets.cxx (dwarf_query::get_*_param): Call them. (timer_derived_probe, timer_builder): New classes. (register_standard_tapsets): Register timer.jiffies(N) and friend. * translate.cxx (translate_pass): #include <linux/timers.h>. * stap.1.in: Document timer.jiffies(N) probe points. * testsuite/buildok/fourteen.stp: New test. 2005-08-19 Frank Ch. Eigler <fche@elastic.org> * arith.c (_stp_random_pm): New function.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx44
1 files changed, 41 insertions, 3 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 0d4796bd..53cab841 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -50,8 +50,46 @@ derived_probe::derived_probe (probe *p, probe_point *l):
}
}
+
// ------------------------------------------------------------------------
+// Members of derived_probe_builder
+
+bool
+derived_probe_builder::get_param (std::map<std::string, literal*> const & params,
+ const std::string& key,
+ std::string& value)
+{
+ map<string, literal *>::const_iterator i = params.find (key);
+ if (i == params.end())
+ return false;
+ literal_string * ls = dynamic_cast<literal_string *>(i->second);
+ if (!ls)
+ return false;
+ value = ls->value;
+ return true;
+}
+
+bool
+derived_probe_builder::get_param (std::map<std::string, literal*> const & params,
+ const std::string& key,
+ int64_t& value)
+{
+ map<string, literal *>::const_iterator i = params.find (key);
+ if (i == params.end())
+ return false;
+ if (i->second == NULL)
+ return false;
+ literal_number * ln = dynamic_cast<literal_number *>(i->second);
+ if (!ln)
+ return false;
+ value = ln->value;
+ return true;
+}
+
+
+
+// ------------------------------------------------------------------------
// Members of match_key.
match_key::match_key(string const & n)
@@ -173,18 +211,18 @@ match_node::find_builder(vector<probe_point::component *> const & components,
// an entry in the sub table, and its value matches the rest
// of the probe_point.
match_key k(*components[pos]);
- if (0) // session.verbose
+ if (0)
clog << "searching for component " << k.str() << endl;
map<match_key, match_node *>::const_iterator i = sub.find(k);
if (i == sub.end())
{
- if (0) // session.verbose
+ if (0)
clog << "no match found" << endl;
return NULL;
}
else
{
- if (0) // session.verbose
+ if (0)
clog << "matched " << k.str() << endl;
derived_probe_builder * builder = NULL;
if (k.have_parameter)