#include "Caldron.h" #include /* ********************************************************************* * CExceptionMgr * ÆÄÀÏ : CException Mgr.h * ±â´É : Caldron Engine³» Dbghelp¿Í LogMgrÀ» ÀÌ¿ëÇÑ exception Ãâ·Â ·çƾ. * ÀÛ¼ºÀÏ : 2004.02.11 * ÀÛ¼ºÀÚ : wizardbug ( 2004.02.11) * ¼öÁ¤ÀÚ : * °³¿ä : Exception Çڵ鸵 ·çƾÀº microsoft ±â¼ú Ä®·³ ' under the hood' ÀÇ ¿¹Á¦ÀÇ ·çƾ º¯ÇüÇÑ °ÍÀÓ. ********************************************************************** */ #pragma once namespace Caldron { namespace Base { // Stolen from Dbg Help Example enum BasicType { btNoType = 0, btVoid = 1, btChar = 2, btWChar = 3, btInt = 6, btUInt = 7, btFloat = 8, btBCD = 9, btBool = 10, btLong = 13, btULong = 14, btCurrency = 25, btDate = 26, btVariant = 27, btComplex = 28, btBit = 29, btBSTR = 30, btHresult = 31 }; class CExceptionMgr { public: CExceptionMgr(void); ~CExceptionMgr(void); // entry point where control comes on an unhandled exception static LONG WINAPI ExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo ); static void WriteExceptionReport(PEXCEPTION_POINTERS pExceptionInfo ); static LPSTR GetExceptionString(DWORD dwCode); static BOOL GetLogicalAddress(PVOID addr, PTSTR szModule, DWORD len,DWORD& section, DWORD& offset); static void WriteCallStack(PCONTEXT pContext,bool bWriteVariables ); static BOOL CALLBACK EnumerateSymbolsCallback(PSYMBOL_INFO,ULONG, PVOID); static bool FormatSymbolValue( PSYMBOL_INFO, STACKFRAME *, char * pszBuffer, unsigned cbBuffer ); static char * DumpTypeIndex( char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool & ); static char * FormatOutputValue( char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress ); static BasicType GetBasicType( DWORD typeIndex, DWORD64 modBase ); protected: static LPTOP_LEVEL_EXCEPTION_FILTER m_lpPrevFilter; static HANDLE m_hProcess; }; /* private: // where report info is extracted and generated static void GenerateExceptionReport( PEXCEPTION_POINTERS pExceptionInfo ); // Helper functions static void WriteStackDetails( PCONTEXT pContext, bool bWriteVariables ); static int __cdecl _tprintf(const TCHAR * format, ...); }; extern WheatyExceptionReport g_WheatyExceptionReport; // global instance of class */ }}