1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDebugReport documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) Vadim Zeitlin 2005
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxDebugReport
}}\label{wxdebugreport
}
14 wxDebugReport is used to generate a debug
report, containing information about
15 the program current state. It is usually used from
16 \helpref{wxApp::OnFatalException()
}{wxapponfatalexception
} as shown in the
17 \helpref{sample
}{sampledebugrpt
}.
19 A wxDebugReport object contains one or more files. A few of them can be created by the
20 class itself but more can be created from the outside and then added to the
21 report. Also note that several virtual functions may be overridden to further
22 customize the class behaviour.
24 Once a
report is fully assembled, it can simply be left in the temporary
25 directory so that the user can email it to the developers (in which case you
26 should still use
\helpref{wxDebugReportCompress
}{wxdebugreportcompress
} to
27 compress it in a single file) or uploaded to a Web server using
28 \helpref{wxDebugReportUpload
}{wxdebugreportupload
} (setting up the Web server
29 to accept uploads is your responsibility, of course). Other handlers, for example for
30 automatically emailing the
report, can be defined as well but are not currently
31 included in wxWidgets.
33 \wxheading{Example of use
}
37 wxDebugReportPreviewStd preview;
39 report.AddCurrentContext(); // could also use AddAll()
40 report.AddCurrentDump(); // to do both at once
42 if ( preview.Show(
report) )
46 \wxheading{Derived from
}
50 \wxheading{Include files
}
54 \wxheading{Data structures
}
56 This enum is used for functions that
report either the current state
57 or the state during the last (fatal) exception:
60 enum wxDebugReport::Context
67 \latexignore{\rtfignore{\wxheading{Members
}}}
70 \membersection{wxDebugReport::wxDebugReport
}\label{wxdebugreportwxdebugreport
}
72 \func{}{wxDebugReport
}{\void}
74 The constructor creates a temporary directory where the files that will
75 be included in the
report are created. Use
76 \helpref{IsOk()
}{wxdebugreportisok
} to check for errors.
79 \membersection{wxDebugReport::
\destruct{wxDebugReport
}}\label{wxdebugreportdtor
}
81 \func{}{\destruct{wxDebugReport
}}{\void}
83 The destructor normally destroys the temporary directory created in the constructor
84 with all the files it contains. Call
\helpref{Reset()
}{wxdebugreportreset
} to
85 prevent this from happening.
88 \membersection{wxDebugReport::AddAll
}\label{wxdebugreportaddall
}
90 \func{void
}{AddAll
}{\param{Context
}{context = Context
\_Exception}}
92 Adds all available information to the
report. Currently this includes a
93 text (XML) file describing the process context and, under Win32, a minidump
97 \membersection{wxDebugReport::AddContext
}\label{wxdebugreportaddcontext
}
99 \func{bool
}{AddContext
}{\param{Context
}{ctx
}}
101 Add an XML file containing the current or exception context and the
105 \membersection{wxDebugReport::AddCurrentContext
}\label{wxdebugreportaddcurrentcontext
}
107 \func{bool
}{AddCurrentContext
}{\void}
109 The same as
\helpref{AddContext(Context
\_Current)
}{wxdebugreportaddcontext
}.
112 \membersection{wxDebugReport::AddCurrentDump
}\label{wxdebugreportaddcurrentdump
}
114 \func{bool
}{AddCurrentDump
}{\void}
116 The same as
\helpref{AddDump(Context
\_Current)
}{wxdebugreportadddump
}.
119 \membersection{wxDebugReport::AddDump
}\label{wxdebugreportadddump
}
121 \func{bool
}{AddDump
}{\param{Context
}{ctx
}}
123 Adds the minidump file to the debug
report.
125 Minidumps are only available under recent Win32 versions (
\texttt{dbghlp32.dll
}
126 can be installed under older systems to make minidumps available).
129 \membersection{wxDebugReport::AddExceptionContext
}\label{wxdebugreportaddexceptioncontext
}
131 \func{bool
}{AddExceptionContext
}{\void}
133 The same as
\helpref{AddContext(Context
\_Exception)
}{wxdebugreportaddcontext
}.
136 \membersection{wxDebugReport::AddExceptionDump
}\label{wxdebugreportaddexceptiondump
}
138 \func{bool
}{AddExceptionDump
}{\void}
140 The same as
\helpref{AddDump(Context
\_Exception)
}{wxdebugreportadddump
}.
143 \membersection{wxDebugReport::AddFile
}\label{wxdebugreportaddfile
}
145 \func{void
}{AddFile
}{\param{const wxString\&
}{name
},
\param{const wxString\&
}{description
}}
147 Add another file to the
report: the file must already exist on disk. Its name
148 is relative to
\helpref{GetDirectory()
}{wxdebugreportgetdirectory
}.
150 \arg{description
} only exists to be shown to the user in the
report summary
151 shown by
\helpref{wxDebugReportPreview
}{wxdebugreportpreview
}.
154 \membersection{wxDebugReport::DoAddCustomContext
}\label{wxdebugreportdoaddcustomcontext
}
156 \func{void
}{DoAddCustomContext
}{\param{wxXmlNode *
}{nodeRoot
}}
158 This function may be overridden to add arbitrary custom context to the XML
159 context file created by
\helpref{AddContext
}{wxdebugreportaddcontext
}. By
160 default, it does nothing.
163 \membersection{wxDebugReport::DoAddExceptionInfo
}\label{wxdebugreportdoaddexceptioninfo
}
165 \func{bool
}{DoAddExceptionInfo
}{\param{wxXmlNode*
}{nodeContext
}}
167 This function may be overridden to modify the contents of the exception tag in
168 the XML context file.
171 \membersection{wxDebugReport::DoAddLoadedModules
}\label{wxdebugreportdoaddloadedmodules
}
173 \func{bool
}{DoAddLoadedModules
}{\param{wxXmlNode*
}{nodeModules
}}
175 This function may be overridden to modify the contents of the modules tag in
176 the XML context file.
179 \membersection{wxDebugReport::DoAddSystemInfo
}\label{wxdebugreportdoaddsysteminfo
}
181 \func{bool
}{DoAddSystemInfo
}{\param{wxXmlNode*
}{nodeSystemInfo
}}
183 This function may be overridden to modify the contents of the system tag in
184 the XML context file.
187 \membersection{wxDebugReport::GetDirectory
}\label{wxdebugreportgetdirectory
}
189 \constfunc{const wxString\&
}{GetDirectory
}{\void}
191 Returns the name of the temporary directory used for the files in this
report.
193 This method should be used to construct the full name of the files which you
194 wish to add to the
report using
\helpref{AddFile
}{wxdebugreportaddfile
}.
197 \membersection{wxDebugReport::GetFile
}\label{wxdebugreportgetfile
}
199 \constfunc{bool
}{GetFile
}{\param{size
\_t }{n
},
\param{wxString*
}{name
},
\param{wxString*
}{desc
}}
201 Retrieves the name (relative to
202 \helpref{GetDirectory()
}{wxdebugreportgetdirectory
}) and the description of the
203 file with the given index. If
\arg{n
} is greater than or equal to the number of
204 filse,
\false is returned.
207 \membersection{wxDebugReport::GetFilesCount
}\label{wxdebugreportgetfilescount
}
209 \constfunc{size
\_t}{GetFilesCount
}{\void}
211 Gets the current number files in this
report.
214 \membersection{wxDebugReport::GetReportName
}\label{wxdebugreportgetreportname
}
216 \constfunc{wxString
}{GetReportName
}{\void}
218 Gets the name used as a base name for various files, by default
219 \helpref{wxApp::GetAppName()
}{wxappgetappname
} is used.
222 \membersection{wxDebugReport::IsOk
}\label{wxdebugreportisok
}
224 \constfunc{bool
}{IsOk
}{\void}
226 Returns
\true if the object was successfully initialized. If this method returns
227 \false the
report can't be used.
230 \membersection{wxDebugReport::Process
}\label{wxdebugreportprocess
}
232 \func{bool
}{Process
}{\void}
234 Processes this
report: the base class simply notifies the user that the
235 report has been generated. This is usually not enough -- instead you
236 should override this method to do something more useful to you.
239 \membersection{wxDebugReport::RemoveFile
}\label{wxdebugreportremovefile
}
241 \func{void
}{RemoveFile
}{\param{const wxString\&
}{name
}}
243 Removes the file from
report: this is used by
244 \helpref{wxDebugReportPreview
}{wxdebugreportpreview
} to allow the user to
245 remove files potentially containing private information from the
report.
248 \membersection{wxDebugReport::Reset
}\label{wxdebugreportreset
}
250 \func{void
}{Reset
}{\void}
252 Resets the directory name we use. The object can't be used any more after
253 this as it becomes uninitialized and invalid.