Is there a
way to catch and suppress exceptions?
You can catch exceptions in the on_exit
section of your probes. To catch exceptions, all you have to do is to
distinguish between a normal exit from your subprogram and an exception
exit from it, as both would trigger your probe's on_exit actions.
For example, if subprogram "fred()"
may leave via exception, you could test for this as follows:
log("Exception exit from fred()\n");
If you need to, you can find other action
reasons defined in aprobe.h. The example above works well when you know
where the exception may be raised. But when you don't know, you can
log all exceptions raised in your program. To do so, use the following
There are also other macros for this: ap_PrintExceptionsInThread,
ap_PrintAndLogExceptionsInThread. These are all defined in aprobe.h.