diff options
author | Charley Wang <chwang@redhat.com> | 2009-11-10 12:22:18 -0500 |
---|---|---|
committer | Charley Wang <chwang@redhat.com> | 2009-11-10 12:22:18 -0500 |
commit | f1a0157a5bacc6c7f739a621ee86fec2be9b0080 (patch) | |
tree | 5be55af0801b2553afdf905524f7924219aec88d | |
parent | 7885012ba0a7c1d7c974dd9528afa90aeed916a6 (diff) | |
download | systemtap-steved-f1a0157a5bacc6c7f739a621ee86fec2be9b0080.tar.gz systemtap-steved-f1a0157a5bacc6c7f739a621ee86fec2be9b0080.tar.xz systemtap-steved-f1a0157a5bacc6c7f739a621ee86fec2be9b0080.zip |
PR10877: Give token* to each component instead of each probe_point
-rw-r--r-- | elaborate.cxx | 11 | ||||
-rw-r--r-- | parse.cxx | 8 | ||||
-rw-r--r-- | staptree.cxx | 9 | ||||
-rw-r--r-- | staptree.h | 4 | ||||
-rw-r--r-- | tapset-procfs.cxx | 12 | ||||
-rw-r--r-- | tapset-utrace.cxx | 3 | ||||
-rw-r--r-- | tapsets.cxx | 4 |
7 files changed, 25 insertions, 26 deletions
diff --git a/elaborate.cxx b/elaborate.cxx index 626db280..c1465e97 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -372,7 +372,7 @@ match_node::find_and_build (systemtap_session& s, throw semantic_error (string("probe point truncated at position ") + lex_cast (pos) + - " (follow:" + alternatives + ")", loc->tok); + " (follow:" + alternatives + ")", loc->components.back()->tok); } map<string, literal *> param_map; @@ -452,7 +452,7 @@ match_node::find_and_build (systemtap_session& s, lex_cast (pos) + " (alternatives:" + alternatives + ")" + " didn't find any wildcard matches", - loc->tok); + loc->components[pos]->tok); } } else @@ -465,10 +465,11 @@ match_node::find_and_build (systemtap_session& s, for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++) alternatives += string(" ") + i->first.str(); + throw semantic_error (string("probe point mismatch at position ") + lex_cast (pos) + " (alternatives:" + alternatives + ")", - loc->tok); + loc->components[pos]->tok); } match_node* subnode = i->second; @@ -534,7 +535,7 @@ alias_expansion_builder // Don't build the alias expansion if infinite recursion is detected. if (checkForRecursiveExpansion (use)) { stringstream msg; - msg << "Recursive loop in alias expansion of " << *location << " at " << location->tok->location; + msg << "Recursive loop in alias expansion of " << *location << " at " << location->components.front()->tok->location; // semantic_errors thrown here are ignored. sess.print_error (semantic_error (msg.str())); return; @@ -558,7 +559,7 @@ alias_expansion_builder } // the token location of the alias, - n->tok = location->tok; + n->tok = location->components.front()->tok; // and statements representing the concatenation of the alias' // body with the use's. @@ -1085,7 +1085,7 @@ parser::parse_probe (std::vector<probe *> & probe_ret, && t->type == tok_operator && t->content == "=") { if (pp->optional || pp->sufficient) - throw parse_error ("probe point alias name cannot be optional nor sufficient", pp->tok); + throw parse_error ("probe point alias name cannot be optional nor sufficient", pp->components.front()->tok); aliases.push_back(pp); next (); continue; @@ -1094,7 +1094,7 @@ parser::parse_probe (std::vector<probe *> & probe_ret, && t->type == tok_operator && t->content == "+=") { if (pp->optional || pp->sufficient) - throw parse_error ("probe point alias name cannot be optional nor sufficient", pp->tok); + throw parse_error ("probe point alias name cannot be optional nor sufficient", pp->components.front()->tok); aliases.push_back(pp); epilogue_alias = 1; next (); @@ -1402,10 +1402,10 @@ parser::parse_probe_point () || t->type == tok_keyword)) throw parse_error ("expected identifier or '*'"); - if (pl->tok == 0) pl->tok = t; probe_point::component* c = new probe_point::component; c->functor = t->content; + c->tok = t; pl->components.push_back (c); // NB we may add c->arg soon @@ -1430,7 +1430,7 @@ parser::parse_probe_point () continue; } - // We only fall through here at the end of a probe point (past + // We only fall through here at the end of a probe point (past // all the dotted/parametrized components). if (t && t->type == tok_operator && diff --git a/staptree.cxx b/staptree.cxx index bc552454..4c3b3090 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -76,23 +76,22 @@ symboldecl::~symboldecl () { } -probe_point::probe_point (std::vector<component*> const & comps, - const token * t): - components(comps), tok(t), optional (false), sufficient (false), +probe_point::probe_point (std::vector<component*> const & comps): + components(comps), optional (false), sufficient (false), condition (0) { } // NB: shallow-copy of compoonents & condition! probe_point::probe_point (const probe_point& pp): - components(pp.components), tok(pp.tok), optional (pp.optional), sufficient (pp.sufficient), + components(pp.components), optional (pp.optional), sufficient (pp.sufficient), condition (pp.condition) { } probe_point::probe_point (): - tok (0), optional (false), sufficient (false), condition (0) + optional (false), sufficient (false), condition (0) { } @@ -630,17 +630,17 @@ struct probe_point std::string functor; literal* arg; // optional component (); + const token* tok; // points to component's functor component(std::string const & f, literal * a = NULL); }; std::vector<component*> components; - const token* tok; // points to first component's functor bool optional; bool sufficient; expression* condition; void print (std::ostream& o) const; probe_point (); probe_point(const probe_point& pp); - probe_point(std::vector<component*> const & comps,const token * t); + probe_point(std::vector<component*> const & comps); std::string str(); }; diff --git a/tapset-procfs.cxx b/tapset-procfs.cxx index fd8ad62a..aa75af42 100644 --- a/tapset-procfs.cxx +++ b/tapset-procfs.cxx @@ -479,30 +479,30 @@ procfs_builder::build(systemtap_session & sess, // Make sure it doesn't start with '/'. if (end_pos == 0) throw semantic_error ("procfs path cannot start with a '/'", - location->tok); + location->components.front()->tok); component = path.substr(start_pos, end_pos - start_pos); // Make sure it isn't empty. if (component.size() == 0) throw semantic_error ("procfs path component cannot be empty", - location->tok); + location->components.front()->tok); // Make sure it isn't relative. else if (component == "." || component == "..") - throw semantic_error ("procfs path cannot be relative (and contain '.' or '..')", location->tok); + throw semantic_error ("procfs path cannot be relative (and contain '.' or '..')", location->components.front()->tok); start_pos = end_pos + 1; } component = path.substr(start_pos); // Make sure it doesn't end with '/'. if (component.size() == 0) - throw semantic_error ("procfs path cannot end with a '/'", location->tok); + throw semantic_error ("procfs path cannot end with a '/'", location->components.front()->tok); // Make sure it isn't relative. else if (component == "." || component == "..") - throw semantic_error ("procfs path cannot be relative (and contain '.' or '..')", location->tok); + throw semantic_error ("procfs path cannot be relative (and contain '.' or '..')", location->components.front()->tok); } if (!(has_read ^ has_write)) - throw semantic_error ("need read/write component", location->tok); + throw semantic_error ("need read/write component", location->components.front()->tok); finished_results.push_back(new procfs_derived_probe(sess, base, location, path, has_write)); diff --git a/tapset-utrace.cxx b/tapset-utrace.cxx index 4bd4ecc1..795d88b7 100644 --- a/tapset-utrace.cxx +++ b/tapset-utrace.cxx @@ -379,7 +379,6 @@ utrace_var_expanding_visitor::visit_target_symbol_cached (target_symbol* e) else pp->components.push_back(base_loc->components[c]); } - pp->tok = e->tok; pp->optional = base_loc->optional; add_probe->locations.push_back(pp); @@ -644,7 +643,7 @@ struct utrace_builder: public derived_probe_builder // We can't probe 'init' (pid 1). XXX: where does this limitation come from? if (pid < 2) throw semantic_error ("process pid must be greater than 1", - location->tok); + location->components.front()->tok); // XXX: could we use /proc/$pid/exe in unwindsym_modules and elsewhere? } diff --git a/tapsets.cxx b/tapsets.cxx index 2a893c95..21eeabbe 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2775,7 +2775,7 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname, if (has_maxactive && (maxactive_val < 0 || maxactive_val > USHRT_MAX)) throw semantic_error ("maxactive value out of range [0," + lex_cast(USHRT_MAX) + "]", - q.base_loc->tok); + q.base_loc->components.front()->tok); // Expand target variables in the probe body if (!null_die(scope_die)) @@ -2947,7 +2947,7 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex /* trick from visit_target_symbol_context */ target_symbol *tsym = new target_symbol; - tsym->tok = q.base_loc->tok; + tsym->tok = q.base_loc->components.front()->tok; tsym->base_name = "$"; tsym->base_name += arg_name; |