Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

rt.dwarfeh

Exception handling support for Dwarf-style portable exceptions.
License:
Distributed under theBoost Software License 1.0. (See accompanying file LICENSE)
Authors:
Walter Bright

Sourcert/dwarfeh.d

structExceptionHeader;
Wrap the unwinder's data with our own compiler specific struct with our own data.
static @nogc ExceptionHeader*create(Throwableo);
Allocate and initialize an ExceptionHeader.
Parameters:
Throwableothrown object
Returns:
allocated and initalized ExceptionHeader
static voidfree(ExceptionHeader*eh);
Free ExceptionHeader that was created by create().
Parameters:
ExceptionHeader*ehExceptionHeader to free
voidpush();
Push this onto stack of chained exceptions.
static ExceptionHeader*pop();
Pop and return top of chained exception stack.
static ExceptionHeader*toExceptionHeader(_Unwind_Exception*eo);
Convert from pointer to exception_object to pointer to ExceptionHeader that it is embedded inside of.
Parameters:
_Unwind_Exception*eopointer to exception_object field
Returns:
pointer to ExceptionHeader that eo points into.
Throwable__dmd_begin_catch(_Unwind_Exception*exceptionObject);
The first thing a catch handler does is call this.
Parameters:
_Unwind_Exception*exceptionObjectvalue passed to catch handler by unwinder
Returns:
object that was caught
nothrow @nogc void*_d_eh_swapContextDwarf(void*newContext);
Called when fibers switch contexts.
Parameters:
void*newContextstack to switch to
Returns:
previous value of stack
void_d_throwdwarf(Throwableo);
Called by D code to throw an exception via
throwo;
Parameters:
ThrowableoObject to throw
Returns:
doesn't return
_Unwind_Reason_Code__dmd_personality_v0(intver, _Unwind_Actionactions, _Unwind_Exception_ClassexceptionClass, _Unwind_Exception*exceptionObject, _Unwind_Context*context);
"personality" function, specific to each language. This one, of course, is specific to DMD.
Parameters:
intverversion must be 1
_Unwind_Actionactionsbitwise OR of the 4 actions UA_xxx. UA_SEARCH_PHASE means return URC_HANDLER_FOUND if current frame has a handler, URC_CONTINUE_UNWIND if not. Cannot be used with UA_CLEANUP_PHASE. UA_CLEANUP_PHASE means perform cleanup for current frame by calling nested functions and returning URC_CONTINUE_UNWIND. Or, set up registers and IP for Landing Pad and return URC_INSTALL_CONTEXT. UA_HANDLER_FRAME means this frame was the one with the handler in Phase 1, and now it is Phase 2 and the handler must be run. UA_FORCE_UNWIND means unwinding the stack for longjmp or thread cancellation. Run finally clauses, not catch clauses, finallys must end with call to Uwind_Resume().
_Unwind_Exception_ClassexceptionClass8 byte value indicating type of thrown exception. If the low 4 bytes are "C++\0", it's a C++ exception.
_Unwind_Exception*exceptionObjectlanguage specific exception information
_Unwind_Context*contextopaque type of unwinder state information
Returns:
reason code
See Also:
ClassInfogetClassInfo(_Unwind_Exception*exceptionObject, const(ubyte)*currentLsd);
Look at the chain of inflight exceptions and pick the class type that'll be looked for in catch clauses.
Parameters:
_Unwind_Exception*exceptionObjectlanguage specific exception information
const(ubyte)*currentLsdpointer to LSDA table
Returns:
class type to look for
_uleb128_tuLEB128(const(ubyte)**p);
Decode Unsigned LEB128.
Parameters:
const(ubyte)**ppointer to data pointer, *p is updated to point past decoded value
Returns:
decoded value
See Also:
_sleb128_tsLEB128(const(ubyte)**p);
Decode Signed LEB128.
Parameters:
const(ubyte)**ppointer to data pointer, *p is updated to point past decoded value
Returns:
decoded value
See Also:
LsdaResultscanLSDA(const(ubyte)*lsda, _Unwind_Ptrip, _Unwind_Exception_ClassexceptionClass, boolcleanupsOnly, boolpreferHandler, _Unwind_Exception*exceptionObject, out _Unwind_PtrlandingPad, out inthandler);
Read and extract information from the LSDA (aka gcc_except_table section). The dmd Call Site Table is structurally different from other implementations. It is organized as nested ranges, and one ip can map to multiple ranges. The most nested candidate is selected when searched. Other implementations have one candidate per ip.
Parameters:
const(ubyte)*lsdapointer to LSDA table
_Unwind_Ptripoffset from start of function at which exception happened
_Unwind_Exception_ClassexceptionClasswhich language threw the exception
boolcleanupsOnlyonly look for cleanups
boolpreferHandlerif a handler encloses a cleanup, prefer the handler
_Unwind_Exception*exceptionObjectlanguage specific exception information
_Unwind_PtrlandingPadset to landing pad
inthandlerset to index of which catch clause was matched
Returns:
LsdaResult
See Also:
intactionTableLookup(_Unwind_Exception*exceptionObject, uintactionRecordPtr, const(ubyte)*pActionTable, const(ubyte)*tt, ubyteTType, _Unwind_Exception_ClassexceptionClass, const(ubyte)*lsda);
Look up classType in Action Table.
Parameters:
_Unwind_Exception*exceptionObjectlanguage specific exception information
uintactionRecordPtrstarting index in Action Table + 1
const(ubyte)*pActionTablepointer to start of Action Table
const(ubyte)*ttpointer past end of Type Table
ubyteTTypeencoding of entries in Type Table
_Unwind_Exception_ClassexceptionClasswhich language threw the exception
const(ubyte)*lsdapointer to LSDA table
Returns:
  • >=1 means the handler index of the classType
  • 0 means classType is not in the Action Table
  • <0 means corrupt
enum _Unwind_Exception_ClasscppExceptionClass;
C++ Support
void*getCppPtrToThrownObject(_Unwind_Exception*exceptionObject, CppTypeInfosti);
Get Pointer to Thrown Object if type of thrown object is implicitly convertible to the catch type.
Parameters:
_Unwind_Exception*exceptionObjectlanguage specific exception information
CppTypeInfostitype of catch clause
Returns:
null if not caught, pointer to thrown object if caught
interfaceCppTypeInfo;
Access C++ std::type_info's virtual functions from D, being careful to not require linking with libstd++ or interfere with core.stdcpp.typeinfo. So, give it a different name.
structCppExceptionHeader;
The C++ version of D's ExceptionHeader wrapper
static CppExceptionHeader*toExceptionHeader(_Unwind_Exception*eo);
Convert from pointer to exception_object field to pointer to CppExceptionHeader that it is embedded inside of.
Parameters:
_Unwind_Exception*eopointer to exception_object field
Returns:
pointer to CppExceptionHeader that eo points into.
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Sat Feb 21 00:06:46 2026

[8]ページ先頭

©2009-2026 Movatter.jp