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,
53 // default is to create the smallest possible crash report
54 wxCRASH_REPORT_DEFAULT
= wxCRASH_REPORT_LOCATION
| wxCRASH_REPORT_STACK
57 // ----------------------------------------------------------------------------
58 // wxCrashContext: information about the crash context
59 // ----------------------------------------------------------------------------
61 struct WXDLLIMPEXP_BASE wxCrashContext
63 // initialize this object with the given information or from the current
64 // global exception info which is only valid inside wxApp::OnFatalException
65 wxCrashContext(_EXCEPTION_POINTERS
*ep
= NULL
);
67 // get the name for this exception code
68 wxString
GetExceptionString() const;
77 // machine-specific registers vaues
81 wxInt32 eax
, ebx
, ecx
, edx
, esi
, edi
,
83 cs
, ds
, es
, fs
, gs
, ss
,
89 // ----------------------------------------------------------------------------
90 // wxCrashReport: this class is used to create crash reports
91 // ----------------------------------------------------------------------------
93 struct WXDLLIMPEXP_BASE wxCrashReport
95 // set the name of the file to which the report is written, it is
96 // constructed from the .exe name by default
97 static void SetFileName(const wxChar
*filename
);
99 // return the current file name
100 static const wxChar
*GetFileName();
102 // write the exception report to the file, return true if it could be done
103 // or false otherwise
105 // if ep pointer is NULL, the global exception info which is valid only
106 // inside wxApp::OnFatalException() is used
107 static bool Generate(int flags
= wxCRASH_REPORT_DEFAULT
,
108 _EXCEPTION_POINTERS
*ep
= NULL
);
111 // generate a crash report from outside of wxApp::OnFatalException(), this
112 // can be used to take "snapshots" of the program in wxApp::OnAssert() for
114 static bool GenerateNow(int flags
= wxCRASH_REPORT_DEFAULT
);
117 #endif // wxUSE_CRASHREPORT
119 #endif // _WX_MSW_CRASHRPT_H_