From 0f16be729dd58136d9791f6fc5d492f34bbbeeba Mon Sep 17 00:00:00 2001 From: fche Date: Mon, 28 Jan 2008 20:59:25 +0000 Subject: update copyright years for recent checkins --- elaborate.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'elaborate.cxx') diff --git a/elaborate.cxx b/elaborate.cxx index 39dae294..c01c3255 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1,5 +1,5 @@ // elaboration functions -// Copyright (C) 2005-2007 Red Hat Inc. +// Copyright (C) 2005-2008 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 -- cgit From 21beacc9a00ea48763048151c370e205c5f23379 Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 12 Feb 2008 21:25:42 +0000 Subject: PR4393: fix relocatable-kernel global $variable access 2008-02-12 Frank Ch. Eigler PR 4393 * tapsets.cxx (emit_address): Support relocatable kernels. (dwarf_derived_probe ctor): Hack around for missing USHRT_MAX. * elaborate.cxx (semantic_pass): Increment rc if exception caught. 2008-02-12 Frank Ch. Eigler * systemtap.pass1-4/buildok.exp: No longer kfail buildok/seventeen. --- elaborate.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'elaborate.cxx') diff --git a/elaborate.cxx b/elaborate.cxx index c01c3255..445c7ff0 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1135,6 +1135,7 @@ semantic_pass (systemtap_session& s) catch (const semantic_error& e) { s.print_error (e); + rc ++; } return rc; -- cgit From 2c5a19c6ba969d8fa30070e7579c1597a0e1c194 Mon Sep 17 00:00:00 2001 From: brolley Date: Wed, 13 Feb 2008 16:43:08 +0000 Subject: 2008-02-13 Dave Brolley PR5609 * staptree.h (probe::collect_derivation_chain): Now takes vector. (probe::get_alias): New virtual method. * elaborate.h (derived_probe::collect_derivation_chain): Now takes vector. * staptree.cxx (probe::collect_derivation_chain): Now takes vector. Don't cast 'this' to (derived_probe*). * elaborate.cxx (derived_probe::collect_derivation_chain): Now takes vector. (alias_derived_probe::get_alias): New virtual method. (alias_derived_probe::alias): New member. (alias_expansion_builder::build): Call checkForRecursiveExpansion and emit a diagnostic if recursion is detected. Pass alias to constructor of alias_derived_probe. (alias_expansion_builder::checkForRecursiveExpansion): New method. * coveragedb.cxx: Pass vector on all calls to collect_derivation_chain. --- elaborate.cxx | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'elaborate.cxx') diff --git a/elaborate.cxx b/elaborate.cxx index 445c7ff0..bc0d1489 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -112,7 +112,7 @@ derived_probe::printsig_nested (ostream& o) const void -derived_probe::collect_derivation_chain (std::vector &probes_list) +derived_probe::collect_derivation_chain (std::vector &probes_list) { probes_list.push_back(this); base->collect_derivation_chain(probes_list); @@ -432,7 +432,8 @@ match_node::build_no_more (systemtap_session& s) struct alias_derived_probe: public derived_probe { - alias_derived_probe (probe* base, probe_point *l): derived_probe (base, l) {} + alias_derived_probe (probe* base, probe_point *l, const probe_alias *a): + derived_probe (base, l), alias(a) {} void upchuck () { throw semantic_error ("inappropriate", this->tok); } @@ -441,6 +442,11 @@ struct alias_derived_probe: public derived_probe // systemtap_session.probes void join_group (systemtap_session&) { upchuck (); } + + virtual const probe_alias *get_alias () const { return alias; } + +private: + const probe_alias *alias; // Used to check for recursion }; @@ -460,11 +466,20 @@ alias_expansion_builder std::map const &, vector & finished_results) { + // 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; + // semantic_errors thrown here are ignored. + sess.print_error (semantic_error (msg.str())); + return; + } + // We're going to build a new probe and wrap it up in an // alias_expansion_probe so that the expansion loop recognizes it as // such and re-expands its expansion. - alias_derived_probe * n = new alias_derived_probe (use, location /* soon overwritten */); + alias_derived_probe * n = new alias_derived_probe (use, location /* soon overwritten */, this->alias); n->body = new block(); // The new probe gets the location list of the alias (with incoming condition joined) @@ -508,6 +523,26 @@ alias_expansion_builder derive_probes (sess, n, finished_results, location->optional); } + + bool checkForRecursiveExpansion (probe *use) + { + // Collect the derivation chain of this probe. + vectorderivations; + use->collect_derivation_chain (derivations); + + // Check all probe points in the alias expansion against the currently-being-expanded probe point + // of each of the probes in the derivation chain, looking for a match. This + // indicates infinite recursion. + // The first element of the derivation chain will be the derived_probe representing 'use', so + // start the search with the second element. + assert (derivations.size() > 0); + assert (derivations[0] == use); + for (unsigned d = 1; d < derivations.size(); ++d) { + if (use->get_alias() == derivations[d]->get_alias()) + return true; // recursion detected + } + return false; + } }; -- cgit