summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorfche <fche>2006-11-01 01:55:59 +0000
committerfche <fche>2006-11-01 01:55:59 +0000
commitb20febf337c78ba5793a72fccb0acaef6273239d (patch)
treee00da788f060b08c0e4956149113412ebda50d8c /elaborate.cxx
parent9be994ead1ed762219d6102f15a5a71b707291e1 (diff)
downloadsystemtap-steved-b20febf337c78ba5793a72fccb0acaef6273239d.tar.gz
systemtap-steved-b20febf337c78ba5793a72fccb0acaef6273239d.tar.xz
systemtap-steved-b20febf337c78ba5793a72fccb0acaef6273239d.zip
2006-10-31 Frank Ch. Eigler <fche@redhat.com>
Probe registration rework. Offline dwarf processing for better cross-instrumentation. * elaborate.h (derived_probe): Remove registration-related code generation API. Add new function sole_location(). (derived_probe_group): Reworked this and associated classes. * session.h (systemntap_session): Create individual per-category derived_probe_groups. * elaborate.cxx (derived_probe_group): Reworked. (alias_derived_probe): Switch to new derived_probe API. (semantic_pass_symbols): Ditto. * translate.cxx (mapvar init): Check for array initialization error. (emit_module_init): Handle such failures, at least in theory. (emit_module_exit): Switch to new derived_probe_group API. Call cpu_relax() during shutdown busywait. (emit_common_header): Elide context variables for elided handler fns. (c_unparser::emit_probe): Implement new, improved duplicate elimination technique for probe handlers. Leave two older ones behind as compile options for education. * tapsets.cxx (*): Reworked all probe registration code, moving it from derived_probes into derived_probe_groups. Shrunk output code. Temporarily disabled probe timing and perfmon/mark probes. (dwflpp): Use offline reporting, so that module matching and relocation is performed at run time. (dwarf_query): Remove flavour logic, now supplanted by other duplicate elimination code. (dwarf_derived_probe): Reworked construction, centralized module/section/offset computations. * tapsets.h (all_session_groups): New little helper. * main.cxx (main): For pass-2 message, print number of embeds too. * systemtap.spec.in: Add a "BuildRequires: dejagnu" for make check. * configure.ac: Bump version to 0.5.11. * configure: Regenerated.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx89
1 files changed, 26 insertions, 63 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 99126fb5..f6c9bf9a 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -70,64 +70,18 @@ derived_probe::derived_probe (probe *p, probe_point *l):
}
-// ------------------------------------------------------------------------
-// Members of derived_probe_group
-
-void
-derived_probe_group::register_probe(be_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a be_derived_probe");
-}
-
-
-void
-derived_probe_group::register_probe(dwarf_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a dwarf_derived_probe");
-}
-
-
-void
-derived_probe_group::register_probe(hrtimer_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a hrtimer_derived_probe");
-}
-
-
-void
-derived_probe_group::register_probe(mark_derived_probe* p)
+probe_point*
+derived_probe::sole_location ()
{
- throw semantic_error ("unexpected registration of a mark_derived_probe");
-}
-
-
-void
-derived_probe_group::register_probe(never_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a never_derived_probe");
-}
-
-
-void
-derived_probe_group::register_probe(profile_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a profile_derived_probe");
-}
-
-
-void
-derived_probe_group::register_probe(timer_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a timer_derived_probe");
+ if (locations.size() == 0)
+ throw semantic_error ("derived_probe with no locations", this->tok);
+ else if (locations.size() > 1)
+ throw semantic_error ("derived_probe with too many locations", this->tok);
+ else
+ return locations[0];
}
-void
-derived_probe_group::register_probe(perfmon_derived_probe* p)
-{
- throw semantic_error ("unexpected registration of a perfmon_derived_probe");
-}
-
// ------------------------------------------------------------------------
// Members of derived_probe_builder
@@ -390,14 +344,13 @@ struct alias_derived_probe: public derived_probe
{
alias_derived_probe (probe* base): derived_probe (base) {}
- void register_probe (systemtap_session& s) { }
+ void upchuck () { throw semantic_error ("inappropriate", this->tok); }
+
+ // Alias probes are immediately expanded to other derived_probe
+ // types, and are not themselves emitted or listed in
+ // systemtap_session.probes
- // alias probes should be ultimately expanded to other derived_probe
- // types, and not themselves emitted.
- void emit_registrations_start (translator_output* o, unsigned index) { throw semantic_error ("inappropriate", this->tok); }
- void emit_registrations_end (translator_output* o, unsigned index) { throw semantic_error ("inappropriate", this->tok); }
- void emit_deregistrations (translator_output* o) { throw semantic_error ("inappropriate", this->tok); }
- void emit_probe_entries (translator_output* o) { throw semantic_error ("inappropriate", this->tok); }
+ void join_group (systemtap_session& s) { upchuck (); }
};
@@ -945,7 +898,8 @@ semantic_pass_symbols (systemtap_session& s)
for (unsigned j=0; j<dps.size(); j++)
{
derived_probe* dp = dps[j];
- dp->register_probe (s);
+ s.probes.push_back (dp);
+ dp->join_group (s);
try
{
@@ -996,8 +950,17 @@ semantic_pass (systemtap_session& s)
systemtap_session::systemtap_session ():
+ // NB: pointer members must be manually initialized!
pattern_root(new match_node),
- user_file (0), op (0), up (0),
+ user_file (0),
+ be_derived_probes(0),
+ dwarf_derived_probes(0),
+ timer_derived_probes(0),
+ profile_derived_probes(0),
+ mark_derived_probes(0),
+ hrtimer_derived_probes(0),
+ perfmon_derived_probes(0),
+ op (0), up (0),
kprobes_text_initialized (false),
kprobes_text_start (0), kprobes_text_end (0),
num_errors (0)