EXCEPTION(3C) EXCEPTION(3C)
exc_resume, exc_setjmp, find_fde, find_fde_name, exc_unwind,
exc_unwind_name - exception handling facility
#include <exception.h>
#if (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS))
Dwarf_Fde
find_fde(long pc);
Dwarf_Fde [Toc] [Back]
find_fde_name(long pc, char **name);
void exc_unwind(struct sigcontext *scp, Dwarf_Fde fde);
void exc_unwind_name(struct sigcontext *scp, Dwarf_Fde fde, char **name);
int exc_resume(struct sigcontext *scp);
void exc_setjmp(struct sigcontext *scp);
NOTE: this version (4.0) of exception handling facility is totally
different from the (3.xx) versions. This version extracts information
from the .debug_frame section instead of the runtime procedure table as
in the prior releases. All the old functions -- exception_dispatcher,
find_rpd, set_unhandled_exception and unwind -- are no longer supported.
To handle exceptions from UNIX signals and to minimize the cost at
runtime until an exception is encountered, the loader collects perprocedure
exception information and frame information so that the stack
unwinds easily at the point of exception.
The data structure Dwarf_Fde is specified in the (.debug_frame) section.
Please refer to the DWARF Debugging Information Format for more details.
At runtime the following procedures will be provided in libexc.so:
find_fde will return the Frame Description Entry(FDE) specified by the pc
argument, if there is one, otherwise it will return NULL.
find_fde_name does the same thing as find_fde but in addition returns the
name of the procedure through the parameter name.
exc_unwind will take the sigcontext scp argument and virtually unwind by
changing the fields to reflect the next frame on the stack. A sigreturn
call can be called with this scp upon return and will return to the frame
unwind set up. The fde argument is used as the Frame Description Entry
argument. If it is NULL, exc_unwind will call find_fde on scp->sc_pc to
get it. If exc_unwind is unable to unwind the stack, it will set the
sc_pc field of the scp parameter to 1, indicating invalid address.
Page 1
EXCEPTION(3C) EXCEPTION(3C)
exc_unwind_name does the same thing as exc_unwind but in addition returns
the name of the procedure of the current sigcontext through the parameter
name.
exc_setjmp is like setjmp, except that it saves V0 and also sets a
special magic number so that exc_resume can tell which degree of
restoration is required.
exc_resume is like longjmp, except that it restores the v0 that
exc_setjmp saved and performs one of the three different degress of
restoration, according to the magic number in the sigcontext.
cc main.o -lexc -ldwarf -lelf
PPPPaaaaggggeeee 2222 [ Back ]
|