nn::os::ARM::SetUserExceptionHandler Function

Syntax

void SetUserExceptionHandler(
     UserExceptionHandler pHandler,
     uptr stackBottom,
     ExceptionBuffer * pExceptionBuffer
);

template <typename T>
void SetUserExceptionHandler(
     UserExceptionHandler pHandler,
     T * pStack,
     ExceptionBuffer * pExceptionBuffer
);

void SetUserExceptionHandler(
     UserExceptionHandler pHandler,
     uptr stackBottom
);

template <typename T>
void SetUserExceptionHandler(
     UserExceptionHandler pHandler,
     T * pStack
);

List of Overloaded Member Functions

SetUserExceptionHandler ( UserExceptionHandler, uptr, ExceptionBuffer * ) Specifies the global exception handler.
SetUserExceptionHandler ( UserExceptionHandler, T *, ExceptionBuffer * ) Specifies the global exception handler.
SetUserExceptionHandler(UserExceptionHandler, uptr) Provided for compatibility with past SDKs.
SetUserExceptionHandler(UserExceptionHandler, T *) Provided for compatibility with past SDKs.

Description of SetUserExceptionHandler ( UserExceptionHandler, uptr, ExceptionBuffer * )

Arguments

If HANDLER_STACK_USE_THREAD_STACK is specified for stackBottom, the stack for the thread in which the exception occurred is used as-is as the exception handler stack.

The instances of ExceptionInfo and ExceptionContext, passed to the handler given by pHandler, are allocated from the buffer specified by pExceptionBuffer. If EXCEPTION_BUFFER_USE_HANDLER_STACK is specified in pExceptionBuffer, they are allocated from the exception handler stack. If EXCEPTION_BUFFER_USE_THREAD_STACK is specified in pExceptionBuffer, they are allocated from the stack for the thread in which the exception occurred.

Exception Handler Settings

Exception handler settings exist for each thread. If an exception occurs, an exception handler is called based on the settings for the thread in question. If an exception handler has not been set for the particular thread in question, an exception handler based on settings for the main thread is called.

The global exception handler refers to the exception handler for the main thread. This function sets the exception handler for the main thread.

When an exception handler is specified and an exception occurs, the function specified by the pHandler parameter is called in the context of the thread where the exception occurred. However, the stack gets replaced by the stack specified by stackBottom.

Note that special processing, such as disabling interrupts, is not used when calling the exception handler. If the same memory is set for more than one thread as a buffer for storing the exception handler stack and exception information, and if an exception occurs in one thread that shares this memory while the exception handler is executing for another of these threads, the exception handler stack and buffer for exception information will be destroyed.

Exception Handler Implementation

Exception handlers have the following restrictions.

Note that the exception handler cannot be called in the debug environment.

Thread Safety

This function is not thread-safe at the function level. It also requires mutual exclusion with the SetUserExceptionHandlerLocal function called in the main thread.

Description of SetUserExceptionHandler ( UserExceptionHandler, T *, ExceptionBuffer * )

This is a wrapper function for accepting the stack used by the exception handler via a stack-type member function.

For details, see SetUserExceptionHandler(UserExceptionHandler, uptr, ExceptionBuffer*).

Description of SetUserExceptionHandler(UserExceptionHandler, uptr)

Calls SetUserExceptionHandler(pHandler, stackBottom, EXCEPTION_BUFFER_USE_HANDLER_STACK).

For details, see SetUserExceptionHandler(UserExceptionHandler, uptr, ExceptionBuffer*).

Description of SetUserExceptionHandler(UserExceptionHandler, T *)

Calls SetUserExceptionHandler(pHandler, pStack, EXCEPTION_BUFFER_USE_HANDLER_STACK).

For details, see SetUserExceptionHandler(UserExceptionHandler, uptr, ExceptionBuffer*).


CONFIDENTIAL