summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-08-21 12:11:41 +0000
committerfche <fche>2005-08-21 12:11:41 +0000
commit5e309481a22d06f4565cb3cb751d0679db0595a7 (patch)
treee0715d1df3a3c0c6907927d84e938023c82b106d /tapsets.cxx
parentc03e045877248e394ec05921b672c066bdba5696 (diff)
downloadsystemtap-steved-5e309481a22d06f4565cb3cb751d0679db0595a7.tar.gz
systemtap-steved-5e309481a22d06f4565cb3cb751d0679db0595a7.tar.xz
systemtap-steved-5e309481a22d06f4565cb3cb751d0679db0595a7.zip
2005-08-21 Frank Ch. Eigler <fche@redhat.com>
PR systemtap/1195, systemtap/1193 * elaborate.cxx (alias_expansion_builder): Set new block token. * parse.cxx (parse_symbol): Set new target_symbol token. * runtest.sh: Store more pertinent failure data. * tapsets.cxx (emit_probe_entries): Rewrite error-handling path. * translate.cxx (emit_common_header): Goodbye errorcount, hello last_error & last_stmt. (c_unparser::visit_statement): New "header" for all other stmts. (c_assignop, visit_binary_expression): Adapt to last_error. * tapset/builtin_logging.stp: Adapt to last_error. 2005-08-21 Frank Ch. Eigler <fche@redhat.com> * arith.c (*): Adapt to last_error context variable.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx47
1 files changed, 18 insertions, 29 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 45a77a8a..43f18c66 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -118,21 +118,17 @@ be_derived_probe::emit_probe_entries (translator_output* o, unsigned j)
o->newline() << "c->busy ++;";
o->newline() << "mb ();"; // for smp
- o->newline() << "c->errorcount = 0;";
- o->newline() << "c->actioncount = 0;";
+ o->newline() << "c->last_error = 0;";
o->newline() << "c->nesting = 0;";
o->newline() << "c->regs = 0;";
+ o->newline() << "c->actioncount = 0;";
// NB: locals are initialized by probe function itself
o->newline() << "probe_" << j << " (c);";
- // see translate.cxx: visit_functioncall and elsewhere to see all the
- // possible context indications that a probe exited prematurely
- o->newline() << "if (c->errorcount || c->actioncount > MAXACTION"
- << " || c->nesting+2 >= MAXNESTING) {";
- o->newline(1) << "printk (KERN_ERR \"probe execution failure (e%d,n%d,a%d)\",";
- o->newline(1) << "c->errorcount, c->nesting, c->actioncount);";
- o->newline(-1) << "atomic_set (& session_state, STAP_SESSION_ERROR);";
+ o->newline() << "if (c->last_error) {";
+ o->newline(1) << "if (c->last_error[0]) _stp_error (\"%s near %s\", c->last_error, c->last_stmt);";
+ o->newline() << "atomic_set (& session_state, STAP_SESSION_ERROR);";
o->newline(-1) << "}";
o->newline() << "c->busy --;";
@@ -860,7 +856,7 @@ dwflpp
if (deref) ;
fprintf(memstream,
"deref_fault:\n"
- " c->errorcount++; \n"
+ " c->last_error = \"pointer dereference fault\";\n"
" goto out;\n");
fclose (memstream);
@@ -1460,6 +1456,7 @@ var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
// synthesize a function
functiondecl *fdecl = new functiondecl;
embeddedcode *ec = new embeddedcode;
+ ec->tok = e->tok;
ec->code = q.dw.literal_stmt_for_local(addr,
e->base_name.substr(1),
e->components);
@@ -1709,20 +1706,17 @@ dwarf_derived_probe::emit_probe_entries (translator_output* o, unsigned probenum
o->newline() << "c->busy ++;";
o->newline() << "mb ();"; // for smp
- o->newline() << "c->errorcount = 0;";
- o->newline() << "c->actioncount = 0;";
+ o->newline() << "c->last_error = 0;";
o->newline() << "c->nesting = 0;";
o->newline() << "c->regs = regs;";
+ o->newline() << "c->actioncount = 0;";
+
// NB: locals are initialized by probe function itself
o->newline() << "probe_" << probenum << " (c);";
- // see translate.cxx: visit_functioncall and elsewhere to see all the
- // possible context indications that a probe exited prematurely
- o->newline() << "if (c->errorcount || c->actioncount > MAXACTION"
- << " || c->nesting+2 >= MAXNESTING) {";
- o->newline(1) << "printk (KERN_ERR \"probe execution failure (e%d,n%d,a%d)\",";
- o->newline(1) << "c->errorcount, c->nesting, c->actioncount);";
- o->newline(-1) << "atomic_set (& session_state, STAP_SESSION_ERROR);";
+ o->newline() << "if (c->last_error) {";
+ o->newline(1) << "if (c->last_error[0]) _stp_error (\"%s near %s\", c->last_error, c->last_stmt);";
+ o->newline() << "atomic_set (& session_state, STAP_SESSION_ERROR);";
o->newline(-1) << "}";
o->newline() << "c->busy --;";
@@ -1876,26 +1870,21 @@ timer_derived_probe::emit_probe_entries (translator_output* o, unsigned j)
o->newline() << "c->busy ++;";
o->newline() << "mb ();"; // for smp
- o->newline() << "c->errorcount = 0;";
- o->newline() << "c->actioncount = 0;";
+ o->newline() << "c->last_error = 0;";
o->newline() << "c->nesting = 0;";
-
o->newline() << "if (! in_interrupt())";
o->newline(1) << "c->regs = 0;";
o->newline(-1) << "else";
o->newline(1) << "c->regs = task_pt_regs (current);";
o->indent(-1);
+ o->newline() << "c->actioncount = 0;";
// NB: locals are initialized by probe function itself
o->newline() << "probe_" << j << " (c);";
- // see translate.cxx: visit_functioncall and elsewhere to see all the
- // possible context indications that a probe exited prematurely
- o->newline() << "if (c->errorcount || c->actioncount > MAXACTION"
- << " || c->nesting+2 >= MAXNESTING) {";
- o->newline(1) << "printk (KERN_ERR \"probe execution failure (e%d,n%d,a%d)\",";
- o->newline(1) << "c->errorcount, c->nesting, c->actioncount);";
- o->newline(-1) << "atomic_set (& session_state, STAP_SESSION_ERROR);";
+ o->newline() << "if (c->last_error) {";
+ o->newline(1) << "if (c->last_error[0]) _stp_error (\"%s near %s\", c->last_error, c->last_stmt);";
+ o->newline() << "atomic_set (& session_state, STAP_SESSION_ERROR);";
o->newline(-1) << "}";
o->newline() << "c->busy --;";