This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] Add STAP_ERROR macro
- From: Aaron Tomlin <atomlin at redhat dot com>
- To: systemtap at sourceware dot org
- Cc: fche at redhat dot com
- Date: Thu, 21 Nov 2013 23:54:42 +0000
- Subject: [PATCH] Add STAP_ERROR macro
- Authentication-results: sourceware.org; auth=none
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