From 56e12059fd1e281889b708b3d351092d9e3ed0be Mon Sep 17 00:00:00 2001 From: fche Date: Mon, 13 Jun 2005 14:27:49 +0000 Subject: 2005-06-13 Frank Ch. Eigler Start separating out translator-side probe point recognition. * tapsets.cxx: New file. (be_derived_probe): Support for begin/end probes. (derive_probe): Ditto. Reject anything unrecognized. * translator.cxx: Move out old code. * Makefile.am: Add new source file. * testsuite/semok/*: Switch to begin/end probes only. --- translate.cxx | 107 ---------------------------------------------------------- 1 file changed, 107 deletions(-) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index dcccf1bd..7336d172 100644 --- a/translate.cxx +++ b/translate.cxx @@ -29,33 +29,6 @@ stringify(T t) } - -// ------------------------------------------------------------------------ -// toy provider/unparser pair - - -struct test_derived_probe: public derived_probe -{ - test_derived_probe (probe* p); - test_derived_probe (probe* p, probe_point* l); - - void emit_registrations (translator_output* o, unsigned i); - void emit_deregistrations (translator_output* o, unsigned i); - void emit_probe_entries (translator_output* o, unsigned i); -}; - - - -void -symresolution_info::derive_probes (probe *p, vector& dps) -{ - // XXX: there will be real ones coming later - for (unsigned i=0; ilocations.size(); i++) - dps.push_back (new test_derived_probe (p, p->locations[i])); -} - - - struct c_unparser: public unparser, public visitor { systemtap_session* session; @@ -120,32 +93,6 @@ struct c_unparser: public unparser, public visitor }; - -// ------------------------------------------------------------------------ - - -// Perform inter-script dependency analysis [XXX: later], -// then provider elaboration and derived probe construction -// and finally semantic analysis -// on the reachable set of probes/functions from the user_file -int -resolution_pass (systemtap_session& s) -{ - int rc = 0; - - for (unsigned i=0; iprobes.size(); i++) - { - probe* p = s.user_file->probes[i]; - // XXX: should of course be based on each probe_point - derived_probe *dp = new test_derived_probe (p); - s.probes.push_back (dp); - } - - // XXX: add builtin variables/functions - return rc; -} - - // ------------------------------------------------------------------------ @@ -195,60 +142,6 @@ translator_output::line () -// ------------------------------------------------------------------------ - - -test_derived_probe::test_derived_probe (probe* p): derived_probe (p) -{ -} - - -test_derived_probe::test_derived_probe (probe* p, probe_point* l): - derived_probe (p, l) -{ -} - - -void -test_derived_probe::emit_registrations (translator_output* o, unsigned i) -{ - // XXX - o->newline() << "rc = 0; /* no registration for probe " << i << " */"; -} - -void -test_derived_probe::emit_deregistrations (translator_output* o, unsigned i) -{ - // XXX - o->newline() << "rc = 0; /* no deregistration for probe " << i << " */"; -} - - -void -test_derived_probe::emit_probe_entries (translator_output* o, unsigned j) -{ - for (unsigned i=0; inewline() << "/* location " << i << ": " << *l << " */"; - o->newline() << "static void enter_" << j << "_" << i << " ()"; - o->newline() << "{"; - o->newline(1) << "struct context* c = & contexts [0];"; - // XXX: assert #0 is free; need locked search instead - o->newline() << "if (c->busy) { errorcount ++; return; }"; - o->newline() << "c->busy ++;"; - o->newline() << "c->actioncount = 0;"; - o->newline() << "c->nesting = 0;"; - // NB: locals are initialized by probe function itself - o->newline() << "probe_" << j << " (c);"; - o->newline() << "c->busy --;"; - o->newline(-1) << "}" << endl; - } -} - - -// ------------------------------------------------------------------------ - // A shadow visitor, meant to generate temporary variable declarations // for function or probe bodies. Member functions should exactly match -- cgit