@@ -14,11 +14,15 @@ * file. */ #import "OFObject.h" +#define OF_EXCEPTION_MAX_BACKTRACE_SIZE 32 + @class OFString; +@class OFArray; +@class OFMutableArray; /*! * @brief The base class for all exceptions in ObjFW * * The OFException class is the base class for all exceptions in ObjFW, except @@ -25,10 +29,13 @@ * the OFAllocFailedException. */ @interface OFException: OFObject { Class _inClass; + OFMutableArray *_backtrace; + void *_backtraceBuffer[OF_EXCEPTION_MAX_BACKTRACE_SIZE]; + int _backtraceSize; } #ifdef OF_HAVE_PROPERTIES @property (readonly) Class inClass; #endif @@ -60,6 +67,14 @@ * @brief Returns a description of the exception. * * @return A description of the exception */ - (OFString*)description; + +/*! + * @brief Returns a backtrace of when the exception was created or nil if no + * backtrace is available. + * + * @return A backtrace of when the exception was created + */ +- (OFArray*)backtrace; @end