1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxDebugContext}}\label{wxdebugcontext}
|
|
|
|
|
|
|
|
A class for performing various debugging and memory tracing
|
|
|
|
operations. Full functionality (such as printing out objects
|
2004-05-04 04:27:20 -04:00
|
|
|
currently allocated) is only present in a debugging build of wxWidgets,
|
1999-11-08 11:38:17 -05:00
|
|
|
i.e. if the \_\_WXDEBUG\_\_ symbol is defined. wxDebugContext
|
1998-05-20 10:25:30 -04:00
|
|
|
and related functions and macros can be compiled out by setting
|
1999-02-28 18:39:59 -05:00
|
|
|
wxUSE\_DEBUG\_CONTEXT to 0 is setup.h
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
No parent class.
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/memory.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\overview{Overview}{wxdebugcontextoverview}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::Check}\label{wxdebugcontextcheck}
|
|
|
|
|
|
|
|
\func{int}{Check}{\void}
|
|
|
|
|
|
|
|
Checks the memory blocks for errors, starting from the currently set
|
|
|
|
checkpoint.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
Returns the number of errors,
|
|
|
|
so a value of zero represents success. Returns -1 if an error
|
|
|
|
was detected that prevents further checking.
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::Dump}\label{wxdebugcontextdump}
|
|
|
|
|
|
|
|
\func{bool}{Dump}{\void}
|
|
|
|
|
|
|
|
Performs a memory dump from the currently set checkpoint, writing to the
|
|
|
|
current debug stream. Calls the {\bf Dump} member function for each wxObject
|
|
|
|
derived instance.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
true if the function succeeded, false otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\membersection{wxDebugContext::GetCheckPrevious}\label{wxdebugcontextgetcheckprevious}
|
|
|
|
|
|
|
|
\func{bool}{GetCheckPrevious}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if the memory allocator checks all previous memory blocks for errors.
|
|
|
|
By default, this is false since it slows down execution considerably.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::SetCheckPrevious}{wxdebugcontextsetcheckprevious}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::GetDebugMode}\label{wxdebugcontextgetdebugmode}
|
|
|
|
|
|
|
|
\func{bool}{GetDebugMode}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if debug mode is on. If debug mode is on, the wxObject new and delete
|
1998-05-20 10:25:30 -04:00
|
|
|
operators store or use information about memory allocation. Otherwise,
|
|
|
|
a straight malloc and free will be performed by these operators.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::SetDebugMode}{wxdebugcontextsetdebugmode}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::GetLevel}\label{wxdebugcontextgetlevel}
|
|
|
|
|
|
|
|
\func{int}{GetLevel}{\void}
|
|
|
|
|
|
|
|
Gets the debug level (default 1). The debug level is used by the wxTraceLevel function and
|
|
|
|
the WXTRACELEVEL macro to specify how detailed the trace information is; setting
|
|
|
|
a different level will only have an effect if trace statements in the application
|
|
|
|
specify a value other than one.
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::SetLevel}{wxdebugcontextsetlevel}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::GetStream}\label{wxdebugcontextgetstream}
|
|
|
|
|
|
|
|
\func{ostream\&}{GetStream}{\void}
|
|
|
|
|
|
|
|
Returns the output stream associated with the debug context.
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::SetStream}{wxdebugcontextsetstream}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::GetStreamBuf}\label{wxdebugcontextgetstreambuf}
|
|
|
|
|
|
|
|
\func{streambuf*}{GetStreamBuf}{\void}
|
|
|
|
|
|
|
|
Returns a pointer to the output stream buffer associated with the debug context.
|
|
|
|
There may not necessarily be a stream buffer if the stream has been set
|
|
|
|
by the user.
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxDebugContext::HasStream}\label{wxdebugcontexthasstream}
|
|
|
|
|
|
|
|
\func{bool}{HasStream}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if there is a stream currently associated
|
1998-05-20 10:25:30 -04:00
|
|
|
with the debug context.
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::SetStream}{wxdebugcontextsetstream}, \helpref{wxDebugContext::GetStream}{wxdebugcontextgetstream}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::PrintClasses}\label{wxdebugcontextprintclasses}
|
|
|
|
|
|
|
|
\func{bool}{PrintClasses}{\void}
|
|
|
|
|
|
|
|
Prints a list of the classes declared in this application, giving derivation
|
|
|
|
and whether instances of this class can be dynamically created.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::PrintStatistics}\label{wxdebugcontextprintstatistics}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{bool}{PrintStatistics}{\param{bool}{ detailed = true}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Performs a statistics analysis from the currently set checkpoint, writing
|
|
|
|
to the current debug stream. The number of object and non-object
|
|
|
|
allocations is printed, together with the total size.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\docparam{detailed}{If true, the function will also print how many
|
1998-05-20 10:25:30 -04:00
|
|
|
objects of each class have been allocated, and the space taken by
|
|
|
|
these class instances.}
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::SetCheckpoint}\label{wxdebugcontextsetcheckpoint}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{void}{SetCheckpoint}{\param{bool}{ all = false}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Sets the current checkpoint: Dump and PrintStatistics operations will
|
|
|
|
be performed from this point on. This allows you to ignore allocations
|
|
|
|
that have been performed up to this point.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\docparam{all}{If true, the checkpoint is reset to include all
|
1998-05-20 10:25:30 -04:00
|
|
|
memory allocations since the program started.}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::SetCheckPrevious}\label{wxdebugcontextsetcheckprevious}
|
|
|
|
|
|
|
|
\func{void}{SetCheckPrevious}{\param{bool}{ check}}
|
|
|
|
|
|
|
|
Tells the memory allocator to check all previous memory blocks for errors.
|
2003-01-17 19:16:34 -05:00
|
|
|
By default, this is false since it slows down execution considerably.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::GetCheckPrevious}{wxdebugcontextgetcheckprevious}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::SetDebugMode}\label{wxdebugcontextsetdebugmode}
|
|
|
|
|
|
|
|
\func{void}{SetDebugMode}{\param{bool}{ debug}}
|
|
|
|
|
|
|
|
Sets the debug mode on or off. If debug mode is on, the wxObject new and delete
|
|
|
|
operators store or use information about memory allocation. Otherwise,
|
|
|
|
a straight malloc and free will be performed by these operators.
|
|
|
|
|
1999-11-08 11:38:17 -05:00
|
|
|
By default, debug mode is on if \_\_WXDEBUG\_\_ is defined. If the application
|
1998-05-20 10:25:30 -04:00
|
|
|
uses this function, it should make sure that all object memory allocated
|
|
|
|
is deallocated with the same value of debug mode. Otherwise, the
|
|
|
|
delete operator might try to look for memory information that does not
|
|
|
|
exist.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::GetDebugMode}{wxdebugcontextgetdebugmode}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::SetFile}\label{wxdebugcontextsetfile}
|
|
|
|
|
|
|
|
\func{bool}{SetFile}{\param{const wxString\& }{filename}}
|
|
|
|
|
|
|
|
Sets the current debug file and creates a stream. This will delete any existing
|
|
|
|
stream and stream buffer. By default, the debug context stream
|
|
|
|
outputs to the debugger (Windows) or standard error (other platforms).
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::SetLevel}\label{wxdebugcontextsetlevel}
|
|
|
|
|
|
|
|
\func{void}{SetLevel}{\param{int}{ level}}
|
|
|
|
|
|
|
|
Sets the debug level (default 1). The debug level is used by the wxTraceLevel function and
|
|
|
|
the WXTRACELEVEL macro to specify how detailed the trace information is; setting
|
|
|
|
a different level will only have an effect if trace statements in the application
|
|
|
|
specify a value other than one.
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::GetLevel}{wxdebugcontextgetlevel}
|
|
|
|
|
|
|
|
\membersection{wxDebugContext::SetStandardError}\label{wxdebugcontextsetstandarderror}
|
|
|
|
|
|
|
|
\func{bool}{SetStandardError}{\void}
|
|
|
|
|
|
|
|
Sets the debugging stream to be the debugger (Windows) or standard error (other platforms).
|
|
|
|
This is the default setting. The existing stream will be flushed and deleted.
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxDebugContext::SetStream}\label{wxdebugcontextsetstream}
|
|
|
|
|
|
|
|
\func{void}{SetStream}{\param{ostream* }{stream}, \param{streambuf* }{streamBuf = NULL}}
|
|
|
|
|
|
|
|
Sets the stream and optionally, stream buffer associated with the debug context.
|
|
|
|
This operation flushes and deletes the existing stream (and stream buffer if any).
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{stream}{Stream to associate with the debug context. Do not set this to NULL.}
|
|
|
|
|
|
|
|
\docparam{streamBuf}{Stream buffer to associate with the debug context.}
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDebugContext::GetStream}{wxdebugcontextgetstream}, \helpref{wxDebugContext::HasStream}{wxdebugcontexthasstream}
|
|
|
|
|
|
|
|
\section{\class{wxDebugStreamBuf}}\label{wxdebugstreambuf}
|
|
|
|
|
|
|
|
This class allows you to treat debugging output in a similar
|
|
|
|
(stream-based) fashion on different platforms. Under
|
|
|
|
Windows, an ostream constructed with this buffer outputs
|
|
|
|
to the debugger, or other program that intercepts debugging
|
|
|
|
output. On other platforms, the output goes to standard error (cerr).
|
|
|
|
|
1998-11-17 17:44:47 -05:00
|
|
|
This is soon to be obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
streambuf
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/memory.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Example}
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
wxDebugStreamBuf streamBuf;
|
|
|
|
ostream stream(&streamBuf);
|
|
|
|
|
|
|
|
stream << "Hello world!" << endl;
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\overview{Overview}{wxdebugcontextoverview}
|
|
|
|
|
|
|
|
|