]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/crashrpt.h
XRC: make wxSplitterWindow's sashpos and minpanesize dimensions.
[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 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_CRASHRPT_H_
12 #define _WX_MSW_CRASHRPT_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_CRASHREPORT
17
18 struct _EXCEPTION_POINTERS;
19
20 // ----------------------------------------------------------------------------
21 // crash report generation flags
22 // ----------------------------------------------------------------------------
23
24 enum
25 {
26 // we always report where the crash occurred
27 wxCRASH_REPORT_LOCATION = 0,
28
29 // if this flag is given, the call stack is dumped
30 //
31 // this results in dump/crash report as small as possible, this is the
32 // default flag
33 wxCRASH_REPORT_STACK = 1,
34
35 // if this flag is given, the values of the local variables are dumped
36 //
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
40 //
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,
45
46 // if this flag is given, the values of all global variables are dumped
47 //
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,
51
52 // default is to create the smallest possible crash report
53 wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK
54 };
55
56 // ----------------------------------------------------------------------------
57 // wxCrashContext: information about the crash context
58 // ----------------------------------------------------------------------------
59
60 struct WXDLLIMPEXP_BASE wxCrashContext
61 {
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);
65
66 // get the name for this exception code
67 wxString GetExceptionString() const;
68
69
70 // exception code
71 size_t code;
72
73 // exception address
74 void *addr;
75
76 // machine-specific registers vaues
77 struct
78 {
79 #ifdef __INTEL__
80 wxInt32 eax, ebx, ecx, edx, esi, edi,
81 ebp, esp, eip,
82 cs, ds, es, fs, gs, ss,
83 flags;
84 #endif // __INTEL__
85 } regs;
86 };
87
88 // ----------------------------------------------------------------------------
89 // wxCrashReport: this class is used to create crash reports
90 // ----------------------------------------------------------------------------
91
92 struct WXDLLIMPEXP_BASE wxCrashReport
93 {
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);
97
98 // return the current file name
99 static wxString GetFileName();
100
101 // write the exception report to the file, return true if it could be done
102 // or false otherwise
103 //
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);
108
109
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
112 // example
113 static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT);
114 };
115
116 #endif // wxUSE_CRASHREPORT
117
118 #endif // _WX_MSW_CRASHRPT_H_
119