Content-type: text/html
Exception Handling Library (libexc.a)
#include <excpt.h>
void exc_add_pc_range_table(
PRUNTIME_FUNCTION pbase,
pdsc_count count);
void exc_remove_pc_range_table(
PRUNTIME_FUNCTION pbase);
PRUNTIME_FUNCTION exc_lookup_function_table_address(
exc_address pc);
PRUNTIME_FUNCTION find_rpd(
exc_address pc);
PRUNTIME_FUNCTION exc_lookup_function_entry(
exc_address pc);
void exc_add_gp_range(
exc_address begin_address,
unsigned long length,
exc_address gp);
void exc_remove_gp_range(
exc_address begin_address);
exc_address exc_lookup_gp(
exc_address pc);
Pointer to the base of a code range descriptor table. Number of code range descriptors in the table pointed to by pbase. Address within a range of code for which the base of a code range descriptor table is to be returned. First address for which the gp argument applies. Number of bytes from begin_address for which the gp argument applies. Address of the global pointer used to refer to the Global Offset Table and small data sections (see the Calling Standard for Alpha Systems and the Assembly Language Programmer's Guide).
The exception system needs to access procedure specific information at runtime in order to perform unwinds and call handlers. You find this information by mapping a PC to a procedure and its structures.
The PRUNTIME_FUNCTION typedef points to a code range descriptor (pdsc(4)). A code range descriptor represents a range of addresses. In order to support very high levels of optimization, one procedure may be represented by many code range descriptors (but a code range descriptor belongs to only one procedure).
The code range descriptor provides the key to access all of the information the exception system requires about a procedure (although some of it may be available only indirectly through the code range descriptor).
The assembler automatically generates code range descriptors into the .pdata section of a relocatable object file which the linker merges into a single code range descriptor table for each executable and shared object. The linker also generates code in the .init and .fini sections so that each executable and shared object will register (by calling exc_add_pc_range) and deregister (by calling exc_remove_pc_range) their code range descriptor tables at runtime with the exception system (if present).
You may need to call these routines manually if you are using the exception system and generate or load code yourself without using standard Digital UNIX system libraries and services.
The exception system maintains the list of registered code range descriptor tables. exc_lookup_function_table_address returns a pointer the base of a code range descriptor table containing a range of code that contains the address supplied in the pc argument. This routine returns a NULL (zero-value) pointer if an entry for the pc argument is not found.
exc_lookup_function_entry and find_rpd return a PRUNTIME_FUNCTION for the address supplied by the pc argument. These routines will raise a EXC_FUNCTION_ENTRY_NOT_FOUND internal exception if an entry for the PC is not found.
find_rpd is an old ULTRIX libexc interface. It continues to work on Digital UNIX systems if its callers treat its return argument as an opaque pointer. If they explicitly access fields in the returned structure, they will encounter incompatibilities.
The unwind functions typically call some of these functions to obtain enough information to virtually unwind procedure contexts. One register, the global pointer (gp), cannot be restored from the information provided by these functions. The Calling Standard for Alpha Systems requires that the gp register be reconstructed on return from a call by adding the return register (RA) value and a constant typically built into the code. This calculation can be moved or deleted as an optimization so the runtime could not use it to reconstruct the gp.
The gp is not in the code range or procedure descriptors (pdsc(4)) because the same gp can be used for many routines and including the gp would waste space. Instead, the linker generates calls to exc_add_gp_range in the .init section of an executable or shared object and exc_remove_gp_range in the .fini section. Many executables have only one such call each in their .init and .fini sections.
exc_lookup_gp returns a NULL (zero value) pointer if an entry for the pc is not found.
/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_intro(3), exception_dispatcher(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).
Assembly Language Programmer's Guide.
Calling Standard for Alpha Systems. delim off