This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add STAP_ERROR macro


	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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]