Content-type: text/html Man page of exception_intro


Section: C Library Functions (3)
Index Return to Main Contents



exception_intro, libexc - an overview of exception support supplied in libexc.a.  


The exception mechanism used on Tru64 UNIX requires no execution time in user code. The only costs before an exception occurs are one-time registering and deregistering of modules with the runtime exception handling mechanism from the init and fini sections. This one-time cost is a requirement to support shared objects.

After an exception, there are costs to find exception handling and unwind information for procedure activations on the stack. This model assumes that exceptions are exceptional occurrences and they should not cost anything until they occur. The exception system makes every effort when an exception occurs to be as efficient as possible by using mechanisms such as binary searches and software caches where applicable.

The routines in this section come from four sources, although these routines might not have the same names as the routines in the sources: ULTRIX libexc.a NT defined interfaces Calling Standard for Alpha Systems new routines required for this implementation

There may be multiple routines which do the same things but are supported for backward compatibility. The data structures are defined in excpt(4), pdsc(4) and the Calling Standard for Alpha Systems .

If you have used the runtime procedure descriptor from ULTRIX libexc as an opaque pointer, your code will port easily. If not, you must modify field names to match the new data structures.

The exception system supports three basic services: unwinding access to procedure specific information exception management

Unwinding support includes the ability to get a context, virtual and actual unwinding of levels of procedure activations from the stack and continuing execution in a handler or other user code. Some of the unwind routines also support invoking handlers as they unwind so that the language or user can clean up items at particular procedure activations.

The routines that provide access to procedure specific information can map an address anywhere in a routine to the routine's information. This information includes enough data to cause an unwind or determine if a routine handles an exception. Typically these routines take an address and then binary search a compiler system-created table for an entry covering the address. These routines also contain support for multiple tables so that shared objects and runtime generated code can participate in the exception system.

The exception management routines provide ways for languages or users to raise exceptions or cause signals to raise exceptions. The exception management routines also provide the mechanism to dispatch the exceptions to the appropriate handlers. Typically, languages provide handlers which determine if the user has specified a handler for a particular address and exception. In the case of structured exception handling in C, the language specific handler invokes a routine containing user supplied code to determine what action to take (see c_excpt(4) for information on C-style structured exception handling). Language specific handlers can either handle the exception or return for some other procedure activation to handle it.

The following routines are described in Section 3 reference pages:


exc_continue Like longjmp(3)
exc_dispatch_exception Deliver exceptions to language handlers
exc_longjmp Like longjmp(3) except calls handlers for cleanup
exc_lookup_function_entry Map address to procedure information
exc_lookup_function_table_address Map address to table containing procedure information
exc_lookup_gp Map address to GP value for a procedure
exc_raise_exception Raise exception given exception structure
exc_raise_status_exception Raise exception given exception code
exc_set_last_chance_handler Set user handler for unhandled exceptions
exc_unwind Actual unwind invoking cleanup handlers
__exc_last_chance Unhandled exception handler
exc_resume Like longjmp(3)
exception_dispatcher Take signal(2) arguments and raises exceptions
exc_find_frame_ptr Returns static link of current activation
find_rpd Maps address to procedure information
exc_add_gp_range Register range of address for a GP value
exc_add_pc_range_table Register procedure information table
exc_remove_gp_range Deregister range of addresses for a GP value
exc_remove_pc_range_table Deregister procedure information table
exc_raise_signal_exception Take signal(2) arguments and raises exceptions
set_unhandled_exception Set user handler for unhandled exceptions
unwind Virtual unwind updating activation context
exc_virtual_unwind Virtual unwind updating activation context

See the IEEE routines in the RELATED INFORMATION section for information on IEEE floating point exception support.  


/usr/ccs/lib/cmplrs/cc/libexc.a - exception handling library /usr/include/excpt.h - include file /usr/include/pdsc.h - include file /usr/include/signal.h - include file /usr/include/machine/fpu.h - include file



Functions: exception_dispatcher(3), exc_lookup_function_entry(3), signal(2), sigaction(2), setjmp(3), exc_unwind(3), __exc_last_chance(3), ieee(3).

Files: excpt(4), c_excpt(4), signal(4), pdsc(4).

Programmer's Guide.

Assembly Language Programmer's Guide.

Calling Standard for Alpha Systems. delim off




This document was created by man2html, using the manual pages.
Time: 02:41:11 GMT, October 02, 2010