2005-03-21 13:28:27 -05:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: debugrpt.tex
|
|
|
|
%% Purpose: wxDebugReport documentation
|
|
|
|
%% Author: Vadim Zeitlin
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 2005-03-21
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) Vadim Zeitlin 2005
|
|
|
|
%% License: wxWindows license
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxDebugReport}}\label{wxdebugreport}
|
|
|
|
|
|
|
|
wxDebugReport is used to generate a debug report, containing information about
|
|
|
|
the program current state. It is usually used from
|
|
|
|
\helpref{wxApp::OnFatalException()}{wxapponfatalexception} as shown in the
|
|
|
|
\helpref{sample}{sampledebugrpt}.
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
A wxDebugReport object contains one or more files. A few of them can be created by the
|
2005-03-21 13:28:27 -05:00
|
|
|
class itself but more can be created from the outside and then added to the
|
|
|
|
report. Also note that several virtual functions may be overridden to further
|
|
|
|
customize the class behaviour.
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Once a report is fully assembled, it can simply be left in the temporary
|
2005-03-21 13:28:27 -05:00
|
|
|
directory so that the user can email it to the developers (in which case you
|
|
|
|
should still use \helpref{wxDebugReportCompress}{wxdebugreportcompress} to
|
|
|
|
compress it in a single file) or uploaded to a Web server using
|
|
|
|
\helpref{wxDebugReportUpload}{wxdebugreportupload} (setting up the Web server
|
2005-03-30 10:20:02 -05:00
|
|
|
to accept uploads is your responsibility, of course). Other handlers, for example for
|
2005-03-21 13:28:27 -05:00
|
|
|
automatically emailing the report, can be defined as well but are not currently
|
|
|
|
included in wxWidgets.
|
|
|
|
|
|
|
|
\wxheading{Example of use}
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
wxDebugReport report;
|
|
|
|
wxDebugReportPreviewStd preview;
|
|
|
|
|
|
|
|
report.AddCurrentContext(); // could also use AddAll()
|
2005-03-30 10:20:02 -05:00
|
|
|
report.AddCurrentDump(); // to do both at once
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
if ( preview.Show(report) )
|
|
|
|
report.Process();
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
No base class
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/debugrpt.h>
|
|
|
|
|
|
|
|
\wxheading{Data structures}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
This enum is used for functions that report either the current state
|
2005-03-21 13:28:27 -05:00
|
|
|
or the state during the last (fatal) exception:
|
2005-03-30 10:20:02 -05:00
|
|
|
|
2005-03-21 13:28:27 -05:00
|
|
|
\begin{verbatim}
|
|
|
|
enum wxDebugReport::Context
|
|
|
|
{
|
2005-03-22 15:17:53 -05:00
|
|
|
Context_Current,
|
2005-03-21 13:28:27 -05:00
|
|
|
Context_Exception
|
|
|
|
};
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::wxDebugReport}\label{wxdebugreportwxdebugreport}
|
|
|
|
|
|
|
|
\func{}{wxDebugReport}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
The constructor creates a temporary directory where the files that will
|
2005-03-21 13:28:27 -05:00
|
|
|
be included in the report are created. Use
|
|
|
|
\helpref{IsOk()}{wxdebugreportisok} to check for errors.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::\destruct{wxDebugReport}}\label{wxdebugreportdtor}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxDebugReport}}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
The destructor normally destroys the temporary directory created in the constructor
|
|
|
|
with all the files it contains. Call \helpref{Reset()}{wxdebugreportreset} to
|
2005-03-21 13:28:27 -05:00
|
|
|
prevent this from happening.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddAll}\label{wxdebugreportaddall}
|
|
|
|
|
|
|
|
\func{void}{AddAll}{\param{Context }{context = Context\_Exception}}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Adds all available information to the report. Currently this includes a
|
2005-03-21 13:28:27 -05:00
|
|
|
text (XML) file describing the process context and, under Win32, a minidump
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddContext}\label{wxdebugreportaddcontext}
|
|
|
|
|
|
|
|
\func{bool}{AddContext}{\param{Context }{ctx}}
|
|
|
|
|
|
|
|
Add an XML file containing the current or exception context and the
|
|
|
|
stack trace.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddCurrentContext}\label{wxdebugreportaddcurrentcontext}
|
|
|
|
|
|
|
|
\func{bool}{AddCurrentContext}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
The same as \helpref{AddContext(Context\_Current)}{wxdebugreportaddcontext}.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddCurrentDump}\label{wxdebugreportaddcurrentdump}
|
|
|
|
|
|
|
|
\func{bool}{AddCurrentDump}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
The same as \helpref{AddDump(Context\_Current)}{wxdebugreportadddump}.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddDump}\label{wxdebugreportadddump}
|
|
|
|
|
|
|
|
\func{bool}{AddDump}{\param{Context }{ctx}}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Adds the minidump file to the debug report.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Minidumps are only available under recent Win32 versions (\texttt{dbghlp32.dll}
|
2005-03-21 13:28:27 -05:00
|
|
|
can be installed under older systems to make minidumps available).
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddExceptionContext}\label{wxdebugreportaddexceptioncontext}
|
|
|
|
|
|
|
|
\func{bool}{AddExceptionContext}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
The same as \helpref{AddContext(Context\_Exception)}{wxdebugreportaddcontext}.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddExceptionDump}\label{wxdebugreportaddexceptiondump}
|
|
|
|
|
|
|
|
\func{bool}{AddExceptionDump}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
The same as \helpref{AddDump(Context\_Exception)}{wxdebugreportadddump}.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::AddFile}\label{wxdebugreportaddfile}
|
|
|
|
|
2005-04-17 12:35:04 -04:00
|
|
|
\func{void}{AddFile}{\param{const wxString\& }{filename}, \param{const wxString\& }{description}}
|
2005-03-21 13:28:27 -05:00
|
|
|
|
2005-04-17 12:35:04 -04:00
|
|
|
Add another file to the report. If \arg{filename} is an absolute path, it is
|
|
|
|
copied to a file in the debug report directory with the same name. Otherwise
|
|
|
|
the file should already exist in this directory
|
2005-03-21 13:28:27 -05:00
|
|
|
|
2005-04-17 12:35:04 -04:00
|
|
|
\arg{description} only exists to be displayed to the user in the report summary
|
2005-03-21 13:28:27 -05:00
|
|
|
shown by \helpref{wxDebugReportPreview}{wxdebugreportpreview}.
|
|
|
|
|
2005-04-17 12:35:04 -04:00
|
|
|
\wxheading{See also }
|
|
|
|
|
|
|
|
\helpref{GetDirectory()}{wxdebugreportgetdirectory},\\
|
|
|
|
\helpref{AddText()}{wxdebugreportaddtext}
|
|
|
|
|
2005-03-21 13:28:27 -05:00
|
|
|
|
2005-04-10 18:11:28 -04:00
|
|
|
\membersection{wxDebugReport::AddText}\label{wxdebugreportaddtext}
|
|
|
|
|
2005-04-17 12:35:04 -04:00
|
|
|
\func{bool}{AddText}{\param{const wxString\& }{filename}, \param{const wxString\& }{text}, \param{const wxString\& }{description}}
|
2005-04-10 18:11:28 -04:00
|
|
|
|
|
|
|
This is a convenient wrapper around \helpref{AddFile}{wxdebugreportaddfile}. It
|
|
|
|
creates the file with the given \arg{name} and writes \arg{text} to it, then
|
2005-04-17 12:35:04 -04:00
|
|
|
adds the file to the report. The \arg{filename} shouldn't contain the path.
|
2005-04-10 18:11:28 -04:00
|
|
|
|
|
|
|
Returns \true if file could be added successfully, \false if an IO error
|
2005-05-31 05:20:43 -04:00
|
|
|
occurred.
|
2005-04-10 18:11:28 -04:00
|
|
|
|
|
|
|
|
2005-03-21 13:28:27 -05:00
|
|
|
\membersection{wxDebugReport::DoAddCustomContext}\label{wxdebugreportdoaddcustomcontext}
|
|
|
|
|
|
|
|
\func{void}{DoAddCustomContext}{\param{wxXmlNode * }{nodeRoot}}
|
|
|
|
|
|
|
|
This function may be overridden to add arbitrary custom context to the XML
|
|
|
|
context file created by \helpref{AddContext}{wxdebugreportaddcontext}. By
|
|
|
|
default, it does nothing.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::DoAddExceptionInfo}\label{wxdebugreportdoaddexceptioninfo}
|
|
|
|
|
|
|
|
\func{bool}{DoAddExceptionInfo}{\param{wxXmlNode* }{nodeContext}}
|
|
|
|
|
|
|
|
This function may be overridden to modify the contents of the exception tag in
|
|
|
|
the XML context file.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::DoAddLoadedModules}\label{wxdebugreportdoaddloadedmodules}
|
|
|
|
|
|
|
|
\func{bool}{DoAddLoadedModules}{\param{wxXmlNode* }{nodeModules}}
|
|
|
|
|
|
|
|
This function may be overridden to modify the contents of the modules tag in
|
|
|
|
the XML context file.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::DoAddSystemInfo}\label{wxdebugreportdoaddsysteminfo}
|
|
|
|
|
|
|
|
\func{bool}{DoAddSystemInfo}{\param{wxXmlNode* }{nodeSystemInfo}}
|
|
|
|
|
|
|
|
This function may be overridden to modify the contents of the system tag in
|
|
|
|
the XML context file.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::GetDirectory}\label{wxdebugreportgetdirectory}
|
|
|
|
|
|
|
|
\constfunc{const wxString\&}{GetDirectory}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Returns the name of the temporary directory used for the files in this report.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
This method should be used to construct the full name of the files which you
|
|
|
|
wish to add to the report using \helpref{AddFile}{wxdebugreportaddfile}.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::GetFile}\label{wxdebugreportgetfile}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetFile}{\param{size\_t }{n}, \param{wxString* }{name}, \param{wxString* }{desc}}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Retrieves the name (relative to
|
2005-03-21 13:28:27 -05:00
|
|
|
\helpref{GetDirectory()}{wxdebugreportgetdirectory}) and the description of the
|
|
|
|
file with the given index. If \arg{n} is greater than or equal to the number of
|
|
|
|
filse, \false is returned.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::GetFilesCount}\label{wxdebugreportgetfilescount}
|
|
|
|
|
|
|
|
\constfunc{size\_t}{GetFilesCount}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Gets the current number files in this report.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::GetReportName}\label{wxdebugreportgetreportname}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetReportName}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Gets the name used as a base name for various files, by default
|
2005-03-22 15:17:53 -05:00
|
|
|
\helpref{wxApp::GetAppName()}{wxappgetappname} is used.
|
2005-03-21 13:28:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::IsOk}\label{wxdebugreportisok}
|
|
|
|
|
|
|
|
\constfunc{bool}{IsOk}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Returns \true if the object was successfully initialized. If this method returns
|
2005-03-21 13:28:27 -05:00
|
|
|
\false the report can't be used.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::Process}\label{wxdebugreportprocess}
|
|
|
|
|
|
|
|
\func{bool}{Process}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Processes this report: the base class simply notifies the user that the
|
|
|
|
report has been generated. This is usually not enough -- instead you
|
2005-03-21 13:28:27 -05:00
|
|
|
should override this method to do something more useful to you.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::RemoveFile}\label{wxdebugreportremovefile}
|
|
|
|
|
|
|
|
\func{void}{RemoveFile}{\param{const wxString\& }{name}}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Removes the file from report: this is used by
|
2005-03-21 13:28:27 -05:00
|
|
|
\helpref{wxDebugReportPreview}{wxdebugreportpreview} to allow the user to
|
|
|
|
remove files potentially containing private information from the report.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxDebugReport::Reset}\label{wxdebugreportreset}
|
|
|
|
|
|
|
|
\func{void}{Reset}{\void}
|
|
|
|
|
2005-03-30 10:20:02 -05:00
|
|
|
Resets the directory name we use. The object can't be used any more after
|
|
|
|
this as it becomes uninitialized and invalid.
|
2005-03-21 13:28:27 -05:00
|
|
|
|