[PATCH] Add STAP_ERROR macro
Aaron Tomlin
atomlin@redhat.com
Thu Nov 21 23:55:00 GMT 2013
Instead of CONTEXT->last_error = "foo"; goto out; in an embedded-C
function, a newly defined macro STAP_ERROR(str) should be used.
The script can catch the exception with try { } catch { }.
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
translate.cxx | 1 +
1 file changed, 1 insertion(+)
diff --git a/translate.cxx b/translate.cxx
index b52f4f1..6fc6877 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -2119,6 +2119,7 @@ c_unparser::emit_function (functiondecl* v)
o->newline() << retvalue.init();
}
+ o->newline() << "#define STAP_ERROR(str) do { CONTEXT->last_error=(str); goto out; } while (0)";
o->newline() << "#define return goto out"; // redirect embedded-C return
v->body->visit (this);
o->newline() << "#undef return";
--
1.8.1.4
More information about the Systemtap
mailing list