]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/crashrpt.h
disable an apparently harmless VC++ warning about /EHa being required with _set_se_tr...
[wxWidgets.git] / include / wx / msw / crashrpt.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/crashrpt.h
3 // Purpose: helpers for the structured exception handling (SEH) under Win32
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 13.07.2003
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_CRASHRPT_H_
13 #define _WX_MSW_CRASHRPT_H_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_CRASHREPORT
18
19 struct _EXCEPTION_POINTERS;
20
21 // ----------------------------------------------------------------------------
22 // crash report generation flags
23 // ----------------------------------------------------------------------------
24
25 enum
26 {
27 // we always report where the crash occured
28 wxCRASH_REPORT_LOCATION = 0,
29
30 // if this flag is given, the call stack is dumped
31 //
32 // this results in dump/crash report as small as possible, this is the
33 // default flag
34 wxCRASH_REPORT_STACK = 1,
35
36 // if this flag is given, the values of the local variables are dumped
37 //
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
41 //
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,
46
47 // if this flag is given, the values of all global variables are dumped
48 //
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
52 };
53
54 // ----------------------------------------------------------------------------
55 // wxCrashContext: information about the crash context
56 // ----------------------------------------------------------------------------
57
58 struct WXDLLIMPEXP_BASE wxCrashContext
59 {
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);
63
64 // get the name for this exception code
65 wxString GetExceptionString() const;
66
67
68 // exception code
69 size_t code;
70
71 // exception address
72 void *addr;
73
74 // machine-specific registers vaues
75 struct
76 {
77 #ifdef __INTEL__
78 wxInt32 eax, ebx, ecx, edx, esi, edi,
79 ebp, esp, eip,
80 cs, ds, es, fs, gs, ss,
81 flags;
82 #endif // __INTEL__
83 } regs;
84 };
85
86 // ----------------------------------------------------------------------------
87 // wxCrashReport: this class is used to create crash reports
88 // ----------------------------------------------------------------------------
89
90 struct WXDLLIMPEXP_BASE wxCrashReport
91 {
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);
95
96 // return the current file name
97 static const wxChar *GetFileName();
98
99 // write the exception report to the file, return true if it could be done
100 // or false otherwise
101 //
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);
107
108 };
109
110 #endif // wxUSE_CRASHREPORT
111
112 #endif // _WX_MSW_CRASHRPT_H_
113