From 0d5561a599cacbfaa91bb8ffa23c40122c09aacc Mon Sep 17 00:00:00 2001 From: David Smith Date: Tue, 19 Apr 2011 14:24:26 -0500 Subject: [PATCH] Improved error handling in uretprobe probes. * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Make sure we go through the probe epilogue even in an error. --- tapsets.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tapsets.cxx b/tapsets.cxx index 4cdfa0d07..a1bf75c22 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -6848,8 +6848,14 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "const struct stap_uprobe_spec *sups = &stap_uprobe_specs [sup->spec_index];"; common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING", "sups->probe"); s.op->newline() << "c->ri = inst;"; - s.op->newline() << "if (sup->spec_index < 0 ||" - << "sup->spec_index >= " << probes.size() << ") return;"; // XXX: should not happen + s.op->newline() << "if (sup->spec_index < 0 || " // XXX: should not happen + << "sup->spec_index >= " << probes.size() << ") {"; + s.op->newline(1) << "_stp_error (\"bad spec_index %d (max " << probes.size() + << ")\", sup->spec_index);"; + s.op->newline() << "atomic_dec (&c->busy);"; + s.op->newline() << "goto probe_epilogue;"; + s.op->newline(-1) << "}"; + // XXX: kretprobes saves "c->pi = inst;" too s.op->newline() << "c->regs = regs;"; s.op->newline() << "c->regflags |= _STP_REGS_USER_FLAG;"; -- 2.43.5