1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/crashrpt.h
3 // Purpose: helpers for the structured exception handling (SEH) under Win32
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_CRASHRPT_H_
12 #define _WX_MSW_CRASHRPT_H_
18 struct _EXCEPTION_POINTERS
;
20 // ----------------------------------------------------------------------------
21 // crash report generation flags
22 // ----------------------------------------------------------------------------
26 // we always report where the crash occurred
27 wxCRASH_REPORT_LOCATION
= 0,
29 // if this flag is given, the call stack is dumped
31 // this results in dump/crash report as small as possible, this is the
33 wxCRASH_REPORT_STACK
= 1,
35 // if this flag is given, the values of the local variables are dumped
37 // note that with the current implementation it requires dumping the full
38 // process address space and so this will result in huge dump file and will
39 // take some time to generate
41 // it's probably not a good idea to use this by default, start with default
42 // mini dump and ask your users to set WX_CRASH_FLAGS environment variable
43 // to 2 or 4 if you need more information in the dump
44 wxCRASH_REPORT_LOCALS
= 2,
46 // if this flag is given, the values of all global variables are dumped
48 // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but
49 // still much smaller than wxCRASH_REPORT_LOCALS one
50 wxCRASH_REPORT_GLOBALS
= 4,
52 // default is to create the smallest possible crash report
53 wxCRASH_REPORT_DEFAULT
= wxCRASH_REPORT_LOCATION
| wxCRASH_REPORT_STACK
56 // ----------------------------------------------------------------------------
57 // wxCrashContext: information about the crash context
58 // ----------------------------------------------------------------------------
60 struct WXDLLIMPEXP_BASE wxCrashContext
62 // initialize this object with the given information or from the current
63 // global exception info which is only valid inside wxApp::OnFatalException
64 wxCrashContext(_EXCEPTION_POINTERS
*ep
= NULL
);
66 // get the name for this exception code
67 wxString
GetExceptionString() const;
76 // machine-specific registers vaues
80 wxInt32 eax
, ebx
, ecx
, edx
, esi
, edi
,
82 cs
, ds
, es
, fs
, gs
, ss
,
88 // ----------------------------------------------------------------------------
89 // wxCrashReport: this class is used to create crash reports
90 // ----------------------------------------------------------------------------
92 struct WXDLLIMPEXP_BASE wxCrashReport
94 // set the name of the file to which the report is written, it is
95 // constructed from the .exe name by default
96 static void SetFileName(const wxString
& filename
);
98 // return the current file name
99 static wxString
GetFileName();
101 // write the exception report to the file, return true if it could be done
102 // or false otherwise
104 // if ep pointer is NULL, the global exception info which is valid only
105 // inside wxApp::OnFatalException() is used
106 static bool Generate(int flags
= wxCRASH_REPORT_DEFAULT
,
107 _EXCEPTION_POINTERS
*ep
= NULL
);
110 // generate a crash report from outside of wxApp::OnFatalException(), this
111 // can be used to take "snapshots" of the program in wxApp::OnAssert() for
113 static bool GenerateNow(int flags
= wxCRASH_REPORT_DEFAULT
);
116 #endif // wxUSE_CRASHREPORT
118 #endif // _WX_MSW_CRASHRPT_H_