]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/debugcxt.tex
Patches-1851591 ] dataview sample is crashing (under MSW)
[wxWidgets.git] / docs / latex / wx / debugcxt.tex
CommitLineData
a660d684
KB
1\section{\class{wxDebugContext}}\label{wxdebugcontext}
2
3A class for performing various debugging and memory tracing
4operations. Full functionality (such as printing out objects
fc2171bd 5currently allocated) is only present in a debugging build of wxWidgets,
fe26d444 6i.e. if the \_\_WXDEBUG\_\_ symbol is defined. wxDebugContext
a660d684 7and related functions and macros can be compiled out by setting
9a05fd8d 8wxUSE\_DEBUG\_CONTEXT to 0 is setup.h
a660d684
KB
9
10\wxheading{Derived from}
11
12No parent class.
13
954b8ae6
JS
14\wxheading{Include files}
15
16<wx/memory.h>
17
a7af285d
VZ
18\wxheading{Library}
19
20\helpref{wxBase}{librarieslist}
21
a660d684
KB
22\wxheading{See also}
23
24\overview{Overview}{wxdebugcontextoverview}
25
26\latexignore{\rtfignore{\wxheading{Members}}}
27
28\membersection{wxDebugContext::Check}\label{wxdebugcontextcheck}
29
30\func{int}{Check}{\void}
31
32Checks the memory blocks for errors, starting from the currently set
33checkpoint.
34
35\wxheading{Return value}
36
37Returns the number of errors,
38so a value of zero represents success. Returns -1 if an error
39was detected that prevents further checking.
40
41\membersection{wxDebugContext::Dump}\label{wxdebugcontextdump}
42
43\func{bool}{Dump}{\void}
44
45Performs a memory dump from the currently set checkpoint, writing to the
46current debug stream. Calls the {\bf Dump} member function for each wxObject
47derived instance.
48
49\wxheading{Return value}
50
cc81d32f 51true if the function succeeded, false otherwise.
a660d684
KB
52
53\membersection{wxDebugContext::GetCheckPrevious}\label{wxdebugcontextgetcheckprevious}
54
55\func{bool}{GetCheckPrevious}{\void}
56
cc81d32f
VS
57Returns true if the memory allocator checks all previous memory blocks for errors.
58By default, this is false since it slows down execution considerably.
a660d684
KB
59
60\wxheading{See also}
61
62\helpref{wxDebugContext::SetCheckPrevious}{wxdebugcontextsetcheckprevious}
63
64\membersection{wxDebugContext::GetDebugMode}\label{wxdebugcontextgetdebugmode}
65
66\func{bool}{GetDebugMode}{\void}
67
cc81d32f 68Returns true if debug mode is on. If debug mode is on, the wxObject new and delete
a660d684
KB
69operators store or use information about memory allocation. Otherwise,
70a straight malloc and free will be performed by these operators.
71
72\wxheading{See also}
73
74\helpref{wxDebugContext::SetDebugMode}{wxdebugcontextsetdebugmode}
75
76\membersection{wxDebugContext::GetLevel}\label{wxdebugcontextgetlevel}
77
78\func{int}{GetLevel}{\void}
79
80Gets the debug level (default 1). The debug level is used by the wxTraceLevel function and
81the WXTRACELEVEL macro to specify how detailed the trace information is; setting
82a different level will only have an effect if trace statements in the application
83specify a value other than one.
84
6fb26ea3
JS
85This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
86
a660d684
KB
87\wxheading{See also}
88
89\helpref{wxDebugContext::SetLevel}{wxdebugcontextsetlevel}
90
91\membersection{wxDebugContext::GetStream}\label{wxdebugcontextgetstream}
92
93\func{ostream\&}{GetStream}{\void}
94
95Returns the output stream associated with the debug context.
96
6fb26ea3
JS
97This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
98
a660d684
KB
99\wxheading{See also}
100
101\helpref{wxDebugContext::SetStream}{wxdebugcontextsetstream}
102
103\membersection{wxDebugContext::GetStreamBuf}\label{wxdebugcontextgetstreambuf}
104
105\func{streambuf*}{GetStreamBuf}{\void}
106
107Returns a pointer to the output stream buffer associated with the debug context.
108There may not necessarily be a stream buffer if the stream has been set
109by the user.
110
6fb26ea3
JS
111This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
112
a660d684
KB
113\membersection{wxDebugContext::HasStream}\label{wxdebugcontexthasstream}
114
115\func{bool}{HasStream}{\void}
116
cc81d32f 117Returns true if there is a stream currently associated
a660d684
KB
118with the debug context.
119
6fb26ea3
JS
120This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
121
a660d684
KB
122\wxheading{See also}
123
124\helpref{wxDebugContext::SetStream}{wxdebugcontextsetstream}, \helpref{wxDebugContext::GetStream}{wxdebugcontextgetstream}
125
126\membersection{wxDebugContext::PrintClasses}\label{wxdebugcontextprintclasses}
127
128\func{bool}{PrintClasses}{\void}
129
130Prints a list of the classes declared in this application, giving derivation
131and whether instances of this class can be dynamically created.
132
133\wxheading{See also}
134
135\helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics}
136
137\membersection{wxDebugContext::PrintStatistics}\label{wxdebugcontextprintstatistics}
138
cc81d32f 139\func{bool}{PrintStatistics}{\param{bool}{ detailed = true}}
a660d684
KB
140
141Performs a statistics analysis from the currently set checkpoint, writing
142to the current debug stream. The number of object and non-object
143allocations is printed, together with the total size.
144
145\wxheading{Parameters}
146
cc81d32f 147\docparam{detailed}{If true, the function will also print how many
a660d684
KB
148objects of each class have been allocated, and the space taken by
149these class instances.}
150
151\wxheading{See also}
152
153\helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics}
154
155\membersection{wxDebugContext::SetCheckpoint}\label{wxdebugcontextsetcheckpoint}
156
cc81d32f 157\func{void}{SetCheckpoint}{\param{bool}{ all = false}}
a660d684
KB
158
159Sets the current checkpoint: Dump and PrintStatistics operations will
160be performed from this point on. This allows you to ignore allocations
161that have been performed up to this point.
162
163\wxheading{Parameters}
164
cc81d32f 165\docparam{all}{If true, the checkpoint is reset to include all
a660d684
KB
166memory allocations since the program started.}
167
168\membersection{wxDebugContext::SetCheckPrevious}\label{wxdebugcontextsetcheckprevious}
169
170\func{void}{SetCheckPrevious}{\param{bool}{ check}}
171
172Tells the memory allocator to check all previous memory blocks for errors.
cc81d32f 173By default, this is false since it slows down execution considerably.
a660d684
KB
174
175\wxheading{See also}
176
177\helpref{wxDebugContext::GetCheckPrevious}{wxdebugcontextgetcheckprevious}
178
179\membersection{wxDebugContext::SetDebugMode}\label{wxdebugcontextsetdebugmode}
180
181\func{void}{SetDebugMode}{\param{bool}{ debug}}
182
183Sets the debug mode on or off. If debug mode is on, the wxObject new and delete
184operators store or use information about memory allocation. Otherwise,
185a straight malloc and free will be performed by these operators.
186
fe26d444 187By default, debug mode is on if \_\_WXDEBUG\_\_ is defined. If the application
a660d684
KB
188uses this function, it should make sure that all object memory allocated
189is deallocated with the same value of debug mode. Otherwise, the
190delete operator might try to look for memory information that does not
191exist.
192
193\wxheading{See also}
194
195\helpref{wxDebugContext::GetDebugMode}{wxdebugcontextgetdebugmode}
196
197\membersection{wxDebugContext::SetFile}\label{wxdebugcontextsetfile}
198
199\func{bool}{SetFile}{\param{const wxString\& }{filename}}
200
201Sets the current debug file and creates a stream. This will delete any existing
202stream and stream buffer. By default, the debug context stream
203outputs to the debugger (Windows) or standard error (other platforms).
204
205\membersection{wxDebugContext::SetLevel}\label{wxdebugcontextsetlevel}
206
207\func{void}{SetLevel}{\param{int}{ level}}
208
209Sets the debug level (default 1). The debug level is used by the wxTraceLevel function and
210the WXTRACELEVEL macro to specify how detailed the trace information is; setting
211a different level will only have an effect if trace statements in the application
212specify a value other than one.
213
6fb26ea3
JS
214This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
215
a660d684
KB
216\wxheading{See also}
217
218\helpref{wxDebugContext::GetLevel}{wxdebugcontextgetlevel}
219
220\membersection{wxDebugContext::SetStandardError}\label{wxdebugcontextsetstandarderror}
221
222\func{bool}{SetStandardError}{\void}
223
224Sets the debugging stream to be the debugger (Windows) or standard error (other platforms).
225This is the default setting. The existing stream will be flushed and deleted.
226
6fb26ea3
JS
227This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
228
a660d684
KB
229\membersection{wxDebugContext::SetStream}\label{wxdebugcontextsetstream}
230
231\func{void}{SetStream}{\param{ostream* }{stream}, \param{streambuf* }{streamBuf = NULL}}
232
233Sets the stream and optionally, stream buffer associated with the debug context.
234This operation flushes and deletes the existing stream (and stream buffer if any).
235
6fb26ea3
JS
236This is obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
237
a660d684
KB
238\wxheading{Parameters}
239
240\docparam{stream}{Stream to associate with the debug context. Do not set this to NULL.}
241
242\docparam{streamBuf}{Stream buffer to associate with the debug context.}
243
244\wxheading{See also}
245
246\helpref{wxDebugContext::GetStream}{wxdebugcontextgetstream}, \helpref{wxDebugContext::HasStream}{wxdebugcontexthasstream}
247
248\section{\class{wxDebugStreamBuf}}\label{wxdebugstreambuf}
249
250This class allows you to treat debugging output in a similar
251(stream-based) fashion on different platforms. Under
252Windows, an ostream constructed with this buffer outputs
253to the debugger, or other program that intercepts debugging
254output. On other platforms, the output goes to standard error (cerr).
255
6fb26ea3
JS
256This is soon to be obsolete, replaced by \helpref{wxLog}{wxlog} functionality.
257
a660d684
KB
258\wxheading{Derived from}
259
260streambuf
261
954b8ae6
JS
262\wxheading{Include files}
263
264<wx/memory.h>
265
a660d684
KB
266\wxheading{Example}
267
268\begin{verbatim}
269 wxDebugStreamBuf streamBuf;
270 ostream stream(&streamBuf);
271
272 stream << "Hello world!" << endl;
273\end{verbatim}
274
275\wxheading{See also}
276
277\overview{Overview}{wxdebugcontextoverview}
278
279