1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/crashrpt.h
3 // Purpose: helpers for the structured exception handling (SEH) under Win32
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_CRASHRPT_H_
13 #define _WX_MSW_CRASHRPT_H_
19 struct _EXCEPTION_POINTERS
;
21 // ----------------------------------------------------------------------------
22 // crash report generation flags
23 // ----------------------------------------------------------------------------
27 // we always report where the crash occured
28 wxCRASH_REPORT_LOCATION
= 0,
30 // if this flag is given, the call stack is dumped
32 // this results in dump/crash report as small as possible, this is the
34 wxCRASH_REPORT_STACK
= 1,
36 // if this flag is given, the values of the local variables are dumped
38 // note that with the current implementation it requires dumping the full
39 // process address space and so this will result in huge dump file and will
40 // take some time to generate
42 // it's probably not a good idea to use this by default, start with default
43 // mini dump and ask your users to set WX_CRASH_FLAGS environment variable
44 // to 2 or 4 if you need more information in the dump
45 wxCRASH_REPORT_LOCALS
= 2,
47 // if this flag is given, the values of all global variables are dumped
49 // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but
50 // still much smaller than wxCRASH_REPORT_LOCALS one
51 wxCRASH_REPORT_GLOBALS
= 4
54 // ----------------------------------------------------------------------------
55 // wxCrashContext: information about the crash context
56 // ----------------------------------------------------------------------------
58 struct WXDLLIMPEXP_BASE wxCrashContext
60 // initialize this object with the given information or from the current
61 // global exception info which is only valid inside wxApp::OnFatalException
62 wxCrashContext(_EXCEPTION_POINTERS
*ep
= NULL
);
64 // get the name for this exception code
65 wxString
GetExceptionString() const;
74 // machine-specific registers vaues
78 wxInt32 eax
, ebx
, ecx
, edx
, esi
, edi
,
80 cs
, ds
, es
, fs
, gs
, ss
,
86 // ----------------------------------------------------------------------------
87 // wxCrashReport: this class is used to create crash reports
88 // ----------------------------------------------------------------------------
90 struct WXDLLIMPEXP_BASE wxCrashReport
92 // set the name of the file to which the report is written, it is
93 // constructed from the .exe name by default
94 static void SetFileName(const wxChar
*filename
);
96 // return the current file name
97 static const wxChar
*GetFileName();
99 // write the exception report to the file, return true if it could be done
100 // or false otherwise
102 // if ep pointer is NULL, the global exception info which is valid only
103 // inside wxApp::OnFatalException() is used
104 static bool Generate(int flags
= wxCRASH_REPORT_LOCATION
|
105 wxCRASH_REPORT_STACK
,
106 _EXCEPTION_POINTERS
*ep
= NULL
);
110 #endif // wxUSE_CRASHREPORT
112 #endif // _WX_MSW_CRASHRPT_H_