class ExceptionDispatcher
Defined at line 30 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
Zircon channel-based exception handling uses two primary classes,
ExceptionDispatcher (this file) and Exceptionate (exceptionate.h).
An ExceptionDispatcher represents a single currently-active exception. This
will be transmitted to registered exception handlers in userspace and
provides them with exception state and control functionality.
An Exceptionate wraps a channel endpoint to help with sending exceptions to
userspace. It is a kernel-internal helper class and not exposed to userspace.
Public Methods
fbl::RefPtr<ExceptionDispatcher> Create (fbl::RefPtr<ThreadDispatcher> thread, zx_excp_type_t exception_type, const zx_exception_report_t * report, const arch_exception_context_t * arch_context)
Returns nullptr on memory allocation failure.
Defined at line 30 of file ../../zircon/kernel/object/exception_dispatcher.cc
zx_exception_report_t BuildArchReport (uint32_t type, const arch_exception_context_t & arch_context)
Defined at line 21 of file ../../zircon/kernel/object/exception_dispatcher.cc
zx_obj_type_t get_type ()
Defined at line 44 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
fbl::RefPtr<ThreadDispatcher> thread ()
Defined at line 53 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
zx_excp_type_t exception_type ()
Defined at line 54 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
void ~ExceptionDispatcher ()
Defined at line 58 of file ../../zircon/kernel/object/exception_dispatcher.cc
void on_zero_handles ()
Marks the current exception handler as done.
Once a handle has been created around this object, either
WaitForHandleClose() or DiscardHandleClose() must be called to reset
our state for the next handler.
Defined at line 113 of file ../../zircon/kernel/object/exception_dispatcher.cc
bool FillReport (zx_exception_report_t * report)
Copies the exception report provided at ExceptionDispatcher creation.
The exception report is only available while the exception thread is
still alive.
Returns false and leaves |report| untouched if the thread has died.
Defined at line 60 of file ../../zircon/kernel/object/exception_dispatcher.cc
void SetTaskRights (zx_rights_t thread_rights, zx_rights_t process_rights)
Sets the task rights to use for subsequent handle creation.
rights == 0 indicates that the current exception handler is not allowed
to access the corresponding task handle, for example a thread-level
handler cannot access its parent process handle.
This must only be called by an Exceptionate before transmitting the
exception - we don't ever want to be changing task rights while the
exception is out in userspace.
Defined at line 71 of file ../../zircon/kernel/object/exception_dispatcher.cc
zx_status_t MakeThreadHandle (HandleOwner * handle)
Creates new thread or process handles.
Returns:
ZX_OK on success.
ZX_ERR_ACCESS_DENIED if the task rights have been set to 0.
ZX_ERR_NO_MEMORY if the Handle failed to allocate.
Defined at line 79 of file ../../zircon/kernel/object/exception_dispatcher.cc
zx_status_t MakeProcessHandle (HandleOwner * handle)
Defined at line 95 of file ../../zircon/kernel/object/exception_dispatcher.cc
uint32_t GetDisposition ()
Whether to resume the thread on exception close, pass it to the
next handler in line, or kill the thread. See ZX_EXCEPTION_STATE_*
Defined at line 119 of file ../../zircon/kernel/object/exception_dispatcher.cc
void SetDisposition (uint32_t disposition)
Defined at line 126 of file ../../zircon/kernel/object/exception_dispatcher.cc
bool IsSecondChance ()
Whether a debugger should have a second chance to handle the exception
after the process handler has tried and failed to do so.
Defined at line 133 of file ../../zircon/kernel/object/exception_dispatcher.cc
void SetWhetherSecondChance (bool second_chance)
Defined at line 140 of file ../../zircon/kernel/object/exception_dispatcher.cc
zx_status_t WaitForHandleClose ()
Blocks until the exception handler is done processing.
This must be called exactly once every time this exception is
successfully sent out to userspace, in order to wait for the response
and reset the internal state.
Returns:
ZX_OK if the exception was handled and the thread should resume.
ZX_ERR_NEXT if the exception should be passed to the next handler.
ZX_ERR_INTERNAL_INTR_KILLED if the thread was killed.
Defined at line 147 of file ../../zircon/kernel/object/exception_dispatcher.cc
void DiscardHandleClose ()
Resets the exception state for the next handler.
This must be called instead of WaitForHandleClose() if a handle is
created around this exception but fails to make it out to userspace,
in order to reset the internal state.
Defined at line 190 of file ../../zircon/kernel/object/exception_dispatcher.cc
void Clear ()
Wipe out exception state, which indicates the thread has died.
Defined at line 199 of file ../../zircon/kernel/object/exception_dispatcher.cc