summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2006-12-30 04:25:51 +0000
committerfche <fche>2006-12-30 04:25:51 +0000
commit6f313a734d26b13cb77de68638dc1b9913891c07 (patch)
treef9d383b00d4f5373df41734b1a8086b301b63a9a
parentdbb686641c390c199e53ab94c1b365df1a62e2b9 (diff)
downloadsystemtap-steved-6f313a734d26b13cb77de68638dc1b9913891c07.tar.gz
systemtap-steved-6f313a734d26b13cb77de68638dc1b9913891c07.tar.xz
systemtap-steved-6f313a734d26b13cb77de68638dc1b9913891c07.zip
2006-12-29 Frank Ch. Eigler <fche@elastic.org>
* tapsets.cxx (*group:emit_module_init): flush stdout less for timing mode. Also, Set probe_point variable ... * translate.cxx (emit_module_init): ... so on registration failure, a usable error message can be generated.
-rw-r--r--ChangeLog7
-rw-r--r--tapsets.cxx5
-rw-r--r--translate.cxx5
3 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c8f93cf0..f7eba4dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-12-29 Frank Ch. Eigler <fche@elastic.org>
+
+ * tapsets.cxx (*group:emit_module_init): flush stdout less for timing
+ mode. Also, Set probe_point variable ...
+ * translate.cxx (emit_module_init): ... so on registration failure, a
+ usable error message can be generated.
+
2006-12-29 Frank Ch. Eigler <fche@redhat.com>
PR 3523.
diff --git a/tapsets.cxx b/tapsets.cxx
index 968ba624..d08e8633 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3619,6 +3619,7 @@ dwarf_derived_probe_group::emit_module_init (systemtap_session& s)
s.op->newline(1) << "struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];";
s.op->newline() << "unsigned long relocated_addr = _stp_module_relocate (sdp->module, sdp->section, sdp->address);";
s.op->newline() << "if (relocated_addr == 0) continue;"; // quietly; assume module is absent
+ s.op->newline() << "probe_point = sdp->pp;";
s.op->newline() << "if (sdp->return_p) {";
s.op->newline(1) << "sdp->u.krp.kp.addr = (void *) relocated_addr;";
s.op->newline() << "if (sdp->maxactive_p) {";
@@ -3855,6 +3856,7 @@ timer_derived_probe_group::emit_module_init (systemtap_session& s)
s.op->newline() << "for (i=0; i<" << probes.size() << "; i++) {";
s.op->newline(1) << "struct stap_timer_probe* stp = & stap_timer_probes [i];";
+ s.op->newline() << "probe_point = stp->pp;";
s.op->newline() << "init_timer (& stp->timer_list);";
s.op->newline() << "stp->timer_list.function = & enter_timer_probe;";
s.op->newline() << "stp->timer_list.data = i;"; // NB: important!
@@ -3969,6 +3971,7 @@ profile_derived_probe_group::emit_module_decls (systemtap_session& s)
if (i > 0)
{
// Some lightweight inter-probe context resetting
+ // XXX: not quite right: MAXERRORS not respected
s.op->newline() << "c->actioncount = 0;";
}
s.op->newline() << "if (c->last_error == NULL) " << probes[i]->name << " (c);";
@@ -4003,6 +4006,7 @@ profile_derived_probe_group::emit_module_init (systemtap_session& s)
{
if (probes.empty()) return;
+ s.op->newline() << "probe_point = \"timer.profile\";"; // NB: hard-coded for convenience
s.op->newline() << "#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)"; // == using_rpn of yore
s.op->newline() << "rc = register_profile_notifier (& stap_profile_notifier);";
s.op->newline() << "#else";
@@ -4677,6 +4681,7 @@ hrtimer_derived_probe_group::emit_module_init (systemtap_session& s)
s.op->newline() << "for (i=0; i<" << probes.size() << "; i++) {";
s.op->newline(1) << "struct stap_hrtimer_probe* stp = & stap_hrtimer_probes [i];";
+ s.op->newline() << "probe_point = stp->pp;";
s.op->newline() << "hrtimer_init (& stp->hrtimer, CLOCK_MONOTONIC, HRTIMER_REL);";
s.op->newline() << "stp->hrtimer.function = & enter_hrtimer_probe;";
// There is no hrtimer field to identify *this* (i-th) probe handler
diff --git a/translate.cxx b/translate.cxx
index 4d4c83ac..d46428f0 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -1095,9 +1095,10 @@ c_unparser::emit_module_init ()
// NB: this gives O(N**2) amount of code, but luckily there
// are only seven or eight derived_probe_groups, so it's ok.
o->newline() << "if (rc) {";
+ o->newline(1) << "_stp_error (\"probe %s registration error (rc %d)\", probe_point, rc);";
// NB: we need to be in the error state so timers can shutdown cleanly,
// and so end probes don't run.
- o->newline(1) << "atomic_set (&session_state, STAP_SESSION_ERROR);";
+ o->newline() << "atomic_set (&session_state, STAP_SESSION_ERROR);";
if (i>0)
for (int j=i-1; j>=0; j--)
g[j]->emit_module_exit (*session);
@@ -1213,11 +1214,11 @@ c_unparser::emit_module_exit ()
o->newline(1) << "int64_t avg = _stp_div64 (&error, stats->sum, stats->count);";
o->newline() << "_stp_printf (\"probe %s (%s), hits: %lld, cycles: %lldmin/%lldavg/%lldmax\\n\",";
o->newline() << "probe_point, decl_location, (long long) stats->count, (long long) stats->min, (long long) avg, (long long) stats->max);";
- o->newline() << "_stp_print_flush();";
o->newline(-1) << "}";
o->newline(-1) << "}";
}
}
+ o->newline() << "_stp_print_flush();";
o->newline(-1) << "}";
o->newline() << "#endif";
}