class ExceptionDispatcher
Defined at line 65 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_texception_type,const zx_exception_report_t *report,const arch_exception_context_t *arch_context)
Returns nullptr on memory allocation failure.
Defined at line 43 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 34 of file ../../zircon/kernel/object/exception_dispatcher.cc
void ~ExceptionDispatcher ()
Defined at line 60 of file ../../zircon/kernel/object/exception_dispatcher.cc
zx_rights_t default_rights ()
Defined at line 67 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
zx_obj_type_t get_type ()
Defined at line 82 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
zx_koid_t get_related_koid ()
Defined at line 83 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
bool is_waitable ()
Defined at line 84 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
zx_status_t user_signal_self (uint32_t clear_mask, uint32_t set_mask)
Defined at line 88 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
zx_status_t user_signal_peer (uint32_t clear_mask, uint32_t set_mask)
Defined at line 91 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
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 100 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
const fbl::RefPtr<ThreadDispatcher> & thread ()
Defined at line 102 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
zx_excp_type_t exception_type ()
Defined at line 105 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
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 115 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
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 128 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
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 134 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
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 146 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
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 153 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
void Clear ()
Wipe out exception state, which indicates the thread has died.
Defined at line 156 of file ../../zircon/kernel/object/include/object/exception_dispatcher.h
Protected Methods
Lock<CriticalMutex> * get_lock ()
Defined at line 60 of file ../../zircon/kernel/object/exception_dispatcher.cc
Friends
ExceptionDispatcher * ExceptionDispatcher (ThreadDispatcher * threadzx_excp_type_t exception_typeconst zx_exception_report_t * reportconst arch_exception_context_t * arch_context)