Put crashlog into ScEd.

This was SVN commit r1590.
This commit is contained in:
Ykkrosh 2004-12-28 20:53:54 +00:00
parent 58909b727a
commit ed55ad4d82
3 changed files with 51 additions and 25 deletions

View File

@ -874,7 +874,7 @@ int debug_main_exception_filter(unsigned int UNUSEDPARAM(code), PEXCEPTION_POINT
// leak like a bucket with a missing bottom when it crashes.
#ifdef HAVE_DEBUGALLOC
uint flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
_CrtSetDbgFlag(flags & ~_CRTDBG_LEAK_CHECK_DF);
_CrtSetDbgFlag(flags & ~_CRTDBG_LEAK_CHECK_DF);
#endif
exit(EXIT_FAILURE);

View File

@ -43,10 +43,38 @@ CScEdApp::CScEdApp()
CScEdApp theApp;
// Choose when to override the standard exception handling behaviour
// (opening the debugger when available, or crashing when not) with
// code that generates a crash log/dump.
#if defined(_WIN32) && ( defined(NDEBUG) || defined(TESTING) )
# define CUSTOM_EXCEPTION_HANDLER
#endif
#ifdef CUSTOM_EXCEPTION_HANDLER
#include <excpt.h>
#endif
/////////////////////////////////////////////////////////////////////////////
// CScEdApp initialization
// Exception-handling wrapper
BOOL CScEdApp::InitInstance()
{
#ifdef CUSTOM_EXCEPTION_HANDLER
__try
{
#endif
return InitInstance_();
#ifdef CUSTOM_EXCEPTION_HANDLER
}
__except(debug_main_exception_filter(GetExceptionCode(), GetExceptionInformation()))
{
}
return FALSE;
#endif
}
BOOL CScEdApp::InitInstance_()
{
extern void sced_init();
sced_init();
@ -173,7 +201,23 @@ BOOL CAboutDlg::OnInitDialog()
// EXCEPTION: OCX Property Pages should return FALSE
}
int CScEdApp::Run()
int CScEdApp::Run()
{
#ifdef CUSTOM_EXCEPTION_HANDLER
__try
{
#endif
return Run_();
#ifdef CUSTOM_EXCEPTION_HANDLER
}
__except(debug_main_exception_filter(GetExceptionCode(), GetExceptionInformation()))
{
}
return -1;
#endif
}
int CScEdApp::Run_()
{
MSG msg;
// acquire and dispatch messages until a WM_QUIT message is received
@ -197,26 +241,3 @@ int CScEdApp::Run()
// shouldn't get here
return 0;
}
#if 0
int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow);
extern void pre_main_init();
int main(int argc, char *argv[])
{
pre_main_init();
lib_init();
// set 24 bit (float) FPU precision for faster divides / sqrts
#ifdef _M_IX86
_control87(_PC_24, _MCW_PC);
#endif
detect();
AfxInitialize();
return AfxWinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0);
}
#endif

View File

@ -24,6 +24,11 @@ class CScEdApp : public CWinApp
public:
CScEdApp();
// Separate the useful code from the functions that are called by MFC,
// so they can be wrapped in SEH code to catch exceptions
virtual BOOL InitInstance_();
virtual int Run_();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CScEdApp)