From 98afd80eb5038542fa3a98c75528524b5d4287b6 Mon Sep 17 00:00:00 2001 From: fche Date: Fri, 19 Aug 2005 21:50:42 +0000 Subject: 2005-08-19 Frank Ch. Eigler 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 . * stap.1.in: Document timer.jiffies(N) probe points. * testsuite/buildok/fourteen.stp: New test. 2005-08-19 Frank Ch. Eigler * arith.c (_stp_random_pm): New function. --- elaborate.cxx | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'elaborate.cxx') 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 const & params, + const std::string& key, + std::string& value) +{ + map::const_iterator i = params.find (key); + if (i == params.end()) + return false; + literal_string * ls = dynamic_cast(i->second); + if (!ls) + return false; + value = ls->value; + return true; +} + +bool +derived_probe_builder::get_param (std::map const & params, + const std::string& key, + int64_t& value) +{ + map::const_iterator i = params.find (key); + if (i == params.end()) + return false; + if (i->second == NULL) + return false; + literal_number * ln = dynamic_cast(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 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::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) -- cgit