xref: /trunk/main/tools/inc/tools/debug.hxx (revision 74cbd1f1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _TOOLS_DEBUG_HXX
25 #define _TOOLS_DEBUG_HXX
26 
27 #include "tools/toolsdllapi.h"
28 
29 #ifndef _SAL_TYPES_H
30 #include <sal/types.h>
31 #endif
32 #include <tools/solar.h>
33 
34 // ------------
35 // - DBG_UITL -
36 // ------------
37 
38 #ifdef DBG_UTIL
39 
40 // --- Dbg-Daten ---
41 
42 typedef void (*DbgPrintLine)( const sal_Char* pLine );
43 typedef const sal_Char* (*DbgUsr)(const void* pThis );
44 typedef void (*DbgTestSolarMutexProc)();
45 
46 #define DBG_BUF_MAXLEN              16384
47 
48 #define DBG_TEST_XTOR               (0x00000FFF)
49 #define DBG_TEST_XTOR_THIS          (0x00000001)
50 #define DBG_TEST_XTOR_FUNC          (0x00000002)
51 #define DBG_TEST_XTOR_EXIT          (0x00000004)
52 #define DBG_TEST_XTOR_REPORT        (0x00000008)
53 #define DBG_TEST_XTOR_TRACE         (0x00000010)
54 
55 #define DBG_TEST_MEM                (0x00FFF000)
56 #define DBG_TEST_MEM_INIT           (0x00001000)
57 #define DBG_TEST_MEM_OVERWRITE      (0x00002000)
58 #define DBG_TEST_MEM_OVERWRITEFREE  (0x00004000)
59 #define DBG_TEST_MEM_POINTER        (0x00008000)
60 #define DBG_TEST_MEM_REPORT         (0x00010000)
61 #define DBG_TEST_MEM_TRACE          (0x00020000)
62 #define DBG_TEST_MEM_NEWDEL         (0x00040000)
63 #define DBG_TEST_MEM_XTOR           (0x00080000)
64 #define DBG_TEST_MEM_SYSALLOC       (0x00100000)
65 #define DBG_TEST_MEM_LEAKREPORT     (0x00200000)
66 
67 #define DBG_TEST_PROFILING          (0x01000000)
68 #define DBG_TEST_RESOURCE           (0x02000000)
69 #define DBG_TEST_DIALOG             (0x04000000)
70 #define DBG_TEST_BOLDAPPFONT        (0x08000000)
71 
72 #define DBG_OUT_NULL                0
73 #define DBG_OUT_FILE                1
74 #define DBG_OUT_WINDOW              2
75 #define DBG_OUT_SHELL               3
76 #define DBG_OUT_MSGBOX              4
77 #define DBG_OUT_TESTTOOL            5
78 #define DBG_OUT_DEBUGGER            6
79 #define DBG_OUT_ABORT				7
80 
81 #define DBG_OUT_COUNT               8
82 
83 // user (runtime) defined output channels
84 #define DBG_OUT_USER_CHANNEL_0    100
85 
86 #define DBGGUI_RESTORE              0
87 #define DBGGUI_MINIMIZE             1
88 #define DBGGUI_MAXIMIZE             2
89 
90 struct DbgData
91 {
92     sal_uIntPtr       nTestFlags;
93     sal_uIntPtr       bOverwrite;
94     sal_uIntPtr       nTraceOut;
95     sal_uIntPtr       nWarningOut;
96     sal_uIntPtr       nErrorOut;
97     sal_uIntPtr       bHookOSLAssert;
98     sal_uInt8        bMemInit;
99     sal_uInt8        bMemBound;
100     sal_uInt8        bMemFree;
101     sal_Char    aDebugName[260];
102     sal_Char    aInclFilter[512];
103     sal_Char    aExclFilter[512];
104     sal_Char    aInclClassFilter[512];
105     sal_Char    aExclClassFilter[512];
106     sal_Char    aDbgWinState[50];           // DbgGUIData for VCL
107 };
108 
109 struct DbgDataType
110 {
111     void*       pData;
112     sal_Char const *   pName;
113 };
114 
115 // --- Dbg-Prototypen ---
116 
117 #define DBG_FUNC_DEBUGSTART         1
118 #define DBG_FUNC_DEBUGEND           2
119 #define DBG_FUNC_GLOBALDEBUGEND     3
120 #define DBG_FUNC_GETDATA            4
121 #define DBG_FUNC_SAVEDATA           5
122 #define DBG_FUNC_SETPRINTMSGBOX     6
123 #define DBG_FUNC_SETPRINTWINDOW     7
124 #define DBG_FUNC_SETPRINTTESTTOOL   8
125 #define DBG_FUNC_MEMTEST            9
126 #define DBG_FUNC_XTORINFO           10
127 #define DBG_FUNC_MEMINFO            11
128 #define DBG_FUNC_COREDUMP           12
129 #define DBG_FUNC_ALLERROROUT        13
130 #define DBG_FUNC_SETTESTSOLARMUTEX  14
131 #define DBG_FUNC_TESTSOLARMUTEX     15
132 #define DBG_FUNC_PRINTFILE          16
133 #define DBG_FUNC_GETPRINTMSGBOX     17
134 #define DBG_FUNC_FILTERMESSAGE      18          // new for #i38967
135 #define DBG_FUNC_UPDATEOSLHOOK      19
136 #define DBG_FUNC_SET_ABORT          20
137 
138 TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL );
139 
DbgUpdateOslHook(DbgData * pData)140 inline void DbgUpdateOslHook( DbgData* pData )
141 {
142     DbgFunc( DBG_FUNC_UPDATEOSLHOOK, pData );
143 }
144 
DbgDebugStart()145 inline void DbgDebugStart()
146 {
147     DbgFunc( DBG_FUNC_DEBUGSTART );
148 }
149 
DbgDebugEnd()150 inline void DbgDebugEnd()
151 {
152     DbgFunc( DBG_FUNC_DEBUGEND );
153 }
154 
DbgGlobalDebugEnd()155 inline void DbgGlobalDebugEnd()
156 {
157     DbgFunc( DBG_FUNC_GLOBALDEBUGEND );
158 }
159 
DbgSetPrintMsgBox(DbgPrintLine pProc)160 inline void DbgSetPrintMsgBox( DbgPrintLine pProc )
161 {
162     DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(sal_IntPtr)pProc );
163 }
164 
DbgGetPrintMsgBox()165 inline DbgPrintLine DbgGetPrintMsgBox()
166 {
167     return (DbgPrintLine)(sal_IntPtr)DbgFunc( DBG_FUNC_GETPRINTMSGBOX );
168 }
169 
DbgSetPrintWindow(DbgPrintLine pProc)170 inline void DbgSetPrintWindow( DbgPrintLine pProc )
171 {
172     DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(sal_IntPtr)pProc );
173 }
174 
DbgSetPrintTestTool(DbgPrintLine pProc)175 inline void DbgSetPrintTestTool( DbgPrintLine pProc )
176 {
177     DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(sal_IntPtr)pProc );
178 }
179 
DbgSetAbort(DbgPrintLine pProc)180 inline void DbgSetAbort( DbgPrintLine pProc )
181 {
182     DbgFunc( DBG_FUNC_SET_ABORT, (void*)(sal_IntPtr)pProc );
183 }
184 
185 typedef sal_uInt16 DbgChannelId;
186 /** registers a user-defined channel for emitting the diagnostic messages
187 
188     Note that such a user-defined channel cannot be revoked during the lifetime
189     of the process. Thus, it's the caller's responsibility to ensure that the
190     procedure to which ->pProc points remains valid.
191 
192     @param pProc
193         the function for emitting the diagnostic messages
194     @return
195         a unique number for this channel, which can be used for ->DbgData::nErrorOut,
196         ->DbgData::nWarningOut and ->DbgData::nTraceOut
197     @see DBG_OUT_USER_CHANNEL_0
198 
199     (In theory, this function could replace the other hard-coded channels. Well, at least
200     the ones for MsgBox, Window, Shell, TestTool. Perhaps in the next life ...)
201 */
202 TOOLS_DLLPUBLIC DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc );
203 
DbgFilterMessage(const char * pMsg)204 inline sal_Bool DbgFilterMessage( const char* pMsg )
205 {
206     return (sal_Bool)(sal_IntPtr) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg );
207 }
208 
DbgIsAllErrorOut()209 inline int DbgIsAllErrorOut()
210 {
211     return (DbgFunc( DBG_FUNC_ALLERROROUT ) != 0);
212 }
213 
DbgGetData()214 inline DbgData* DbgGetData()
215 {
216     return (DbgData*)DbgFunc( DBG_FUNC_GETDATA );
217 }
218 
DbgSaveData(const DbgData & rData)219 inline void DbgSaveData( const DbgData& rData )
220 {
221     DbgFunc( DBG_FUNC_SAVEDATA, (void*)&rData );
222 }
223 
DbgIsTraceOut()224 inline sal_uIntPtr DbgIsTraceOut()
225 {
226     DbgData* pData = DbgGetData();
227     if ( pData )
228         return (pData->nTraceOut != DBG_OUT_NULL);
229     else
230         return sal_False;
231 }
232 
DbgIsWarningOut()233 inline sal_uIntPtr DbgIsWarningOut()
234 {
235     DbgData* pData = DbgGetData();
236     if ( pData )
237         return (pData->nWarningOut != DBG_OUT_NULL);
238     else
239         return sal_False;
240 }
241 
DbgIsErrorOut()242 inline sal_uIntPtr DbgIsErrorOut()
243 {
244     DbgData* pData = DbgGetData();
245     if ( pData )
246         return (pData->nErrorOut != DBG_OUT_NULL);
247     else
248         return sal_False;
249 }
250 
DbgGetErrorOut()251 inline sal_uIntPtr DbgGetErrorOut()   // Testtool: test whether to collect OSL_ASSERTions as well
252 {
253     DbgData* pData = DbgGetData();
254     if ( pData )
255         return pData->nErrorOut;
256     else
257         return DBG_OUT_NULL;
258 }
259 
DbgIsAssertWarning()260 inline sal_uIntPtr DbgIsAssertWarning()
261 {
262     return DbgIsWarningOut();
263 }
264 
DbgIsAssert()265 inline sal_uIntPtr DbgIsAssert()
266 {
267     return DbgIsErrorOut();
268 }
269 
DbgIsResource()270 inline sal_uIntPtr DbgIsResource()
271 {
272     DbgData* pData = DbgGetData();
273     if ( pData )
274         return pData->nTestFlags & DBG_TEST_RESOURCE;
275     else
276         return sal_False;
277 }
278 
DbgIsDialog()279 inline sal_uIntPtr DbgIsDialog()
280 {
281     DbgData* pData = DbgGetData();
282     if ( pData )
283         return pData->nTestFlags & DBG_TEST_DIALOG;
284     else
285         return sal_False;
286 }
287 
DbgIsBoldAppFont()288 inline sal_uIntPtr DbgIsBoldAppFont()
289 {
290     DbgData* pData = DbgGetData();
291     if ( pData )
292         return pData->nTestFlags & DBG_TEST_BOLDAPPFONT;
293     else
294         return sal_False;
295 }
296 
DbgXtorInfo(sal_Char * pBuf)297 inline void DbgXtorInfo( sal_Char* pBuf )
298 {
299     DbgFunc( DBG_FUNC_XTORINFO, (void*)pBuf );
300 }
301 
DbgMemInfo(sal_Char * pBuf)302 inline void DbgMemInfo( sal_Char* pBuf )
303 {
304     DbgFunc( DBG_FUNC_MEMINFO, (void*)pBuf );
305 }
306 
DbgCoreDump()307 inline void DbgCoreDump()
308 {
309     DbgFunc( DBG_FUNC_COREDUMP );
310 }
311 
DbgSetTestSolarMutex(DbgTestSolarMutexProc pProc)312 inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc )
313 {
314     DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, (void*)(sal_IntPtr)pProc );
315 }
316 
DbgTestSolarMutex()317 inline void DbgTestSolarMutex()
318 {
319     DbgFunc( DBG_FUNC_TESTSOLARMUTEX );
320 }
321 
DbgPrintFile(const sal_Char * pLine)322 inline void DbgPrintFile( const sal_Char* pLine )
323 {
324     DbgFunc( DBG_FUNC_PRINTFILE, (void*)(sal_Char*)pLine );
325 }
326 
327 // --- Dbg-StackTree-Functions ---
328 
329 TOOLS_DLLPUBLIC void DbgStartStackTree();
330 TOOLS_DLLPUBLIC void DbgEndStackTree();
331 void* DbgGetStackTree( sal_uIntPtr nAlloc = 0 );
332 void DbgFreeStackTree( void* p, sal_uIntPtr nAlloc = 0 );
333 void DbgPrintStackTree( void* p );
334 
335 // --- Dbg-Output ---
336 
337 #define DBG_OUT_TRACE               1
338 #define DBG_OUT_WARNING             2
339 #define DBG_OUT_ERROR               3
340 
341 TOOLS_DLLPUBLIC void DbgOut( const sal_Char* pMsg, sal_uInt16 nOutType = DBG_OUT_TRACE,
342              const sal_Char* pFile = NULL, sal_uInt16 nLine = 0 );
343 TOOLS_DLLPUBLIC void DbgPrintShell(char const * message);
344 TOOLS_DLLPUBLIC void DbgOutTypef( sal_uInt16 nOutType, const sal_Char* pFStr, ... );
345 TOOLS_DLLPUBLIC void DbgOutf( const sal_Char* pFStr, ... );
346 TOOLS_DLLPUBLIC void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... );
347 
348 #define DbgTrace( msg) do{ DbgOut( msg, DBG_OUT_TRACE, __FILE__, __LINE__ ); } while(0)
349 
350 #define DbgWarning( msg) do{ DbgOut( msg, DBG_OUT_WARNING, __FILE__, __LINE__ ); } while(0)
351 
352 #define DbgError( msg) do{ DbgOut( msg, DBG_OUT_ERROR, __FILE__, __LINE__ ); } while(0)
353 
354 // --- Dbg-Test-Functions ---
355 
DbgMemTest(void * p=NULL)356 inline void DbgMemTest( void* p = NULL )
357 {
358     DbgFunc( DBG_FUNC_MEMTEST, p );
359 }
360 
361 #define DBG_PROF_START              1
362 #define DBG_PROF_STOP               2
363 #define DBG_PROF_CONTINUE           3
364 #define DBG_PROF_PAUSE              4
365 
366 TOOLS_DLLPUBLIC void DbgProf( sal_uInt16 nAction, DbgDataType* );
367 
368 #define DBG_XTOR_CTOR               1
369 #define DBG_XTOR_DTOR               2
370 #define DBG_XTOR_CHKTHIS            3
371 #define DBG_XTOR_CHKOBJ             4
372 #define DBG_XTOR_DTOROBJ            0x8000
373 
374 TOOLS_DLLPUBLIC void DbgXtor( DbgDataType* pDbgData,
375               sal_uInt16 nAction, const void* pThis, DbgUsr fDbgUsr );
376 
377 class DbgXtorObj
378 {
379 private:
380     DbgDataType*    pDbgData;
381     const void*     pThis;
382     DbgUsr          fDbgUsr;
383     sal_uInt16          nAction;
384 
385 public:
DbgXtorObj(DbgDataType * pData,sal_uInt16 nAct,const void * pThs,DbgUsr fUsr)386                     DbgXtorObj( DbgDataType* pData,
387                                 sal_uInt16 nAct, const void* pThs, DbgUsr fUsr )
388                     {
389                         DbgXtor( pData, nAct, pThs, fUsr );
390                         pDbgData = pData;
391                         nAction  = nAct;
392                         pThis    = pThs;
393                         fDbgUsr  = fUsr;
394                     }
395 
~DbgXtorObj()396                     ~DbgXtorObj()
397                     {
398                         DbgXtor( pDbgData, nAction | DBG_XTOR_DTOROBJ,
399                                  pThis, fDbgUsr );
400                     }
401 };
402 
403 // --- Dbg-Defines (intern) ---
404 
405 #define DBG_FUNC( aName )                   DbgName_##aName()
406 #define DBG_NAME( aName )                   static DbgDataType aImpDbgData_##aName = { 0, #aName }; \
407                                             DbgDataType* DBG_FUNC( aName ) { return &aImpDbgData_##aName; }
408 #define DBG_NAMEEX_VISIBILITY( aName, vis ) vis DbgDataType* DBG_FUNC( aName );
409 #define DBG_NAMEEX( aName )                 DBG_NAMEEX_VISIBILITY( aName, )
410 
411 // --- Dbg-Defines (extern) ---
412 
413 #define DBG_DEBUGSTART()                    DbgDebugStart()
414 #define DBG_DEBUGEND()                      DbgDebugEnd()
415 #define DBG_GLOBALDEBUGEND()                DbgGlobalDebugEnd()
416 
417 #define DBG_STARTAPPEXECUTE()               DbgStartStackTree()
418 #define DBG_ENDAPPEXECUTE()                 DbgEndStackTree()
419 
420 #define DBG_MEMTEST()                       DbgMemTest()
421 #define DBG_MEMTEST_PTR( p )                DbgMemTest( (void*)p )
422 
423 #define DBG_PROFSTART( aName )                      \
424     DbgProf( DBG_PROF_START, DBG_FUNC( aName ) )
425 
426 #define DBG_PROFSTOP( aName )                       \
427     DbgProf( DBG_PROF_STOP, DBG_FUNC( aName ) )
428 
429 #define DBG_PROFCONTINUE( aName )                   \
430     DbgProf( DBG_PROF_CONTINUE, DBG_FUNC( aName ) )
431 
432 #define DBG_PROFPAUSE( aName )                      \
433     DbgProf( DBG_PROF_PAUSE, DBG_FUNC( aName ) )
434 
435 #define DBG_CTOR( aName, fTest )                    \
436     DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ),      \
437                             DBG_XTOR_CTOR,          \
438                             (const void*)this,      \
439                             fTest )
440 
441 #define DBG_DTOR( aName, fTest )                    \
442     DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ),      \
443                             DBG_XTOR_DTOR,          \
444                             (const void*)this,      \
445                             fTest )
446 
447 #define DBG_CHKTHIS( aName, fTest )                 \
448     DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ),      \
449                             DBG_XTOR_CHKTHIS,       \
450                             (const void*)this,      \
451                             fTest )
452 
453 #define DBG_CHKOBJ( pObj, aName, fTest )            \
454     DbgXtor( DBG_FUNC( aName ), DBG_XTOR_CHKOBJ,    \
455              (const void*)pObj, (DbgUsr)fTest )
456 
457 #define DBG_ASSERTWARNING( sCon, aWarning )         \
458 do                                                  \
459 {                                                   \
460     if ( DbgIsAssertWarning() )                     \
461     {                                               \
462         if ( !( sCon ) )                            \
463         {                                           \
464             DbgWarning( aWarning);                  \
465         }                                           \
466     }                                               \
467 } while(0)
468 
469 #define DBG_ASSERT( sCon, aError )                  \
470 do                                                  \
471 {                                                   \
472     if ( DbgIsAssert() )                            \
473     {                                               \
474         if ( !( sCon ) )                            \
475         {                                           \
476             DbgError( aError);                      \
477         }                                           \
478     }                                               \
479 } while(0)
480 
481 #ifdef DBG_BINFILTER
482 #define DBG_BF_ASSERT( sCon, aError )           \
483 do                                              \
484 {                                               \
485     if ( !( sCon ) )                            \
486     {                                           \
487         DbgError( aError);                      \
488     }                                           \
489 } while(0)
490 #else
491 #define DBG_BF_ASSERT( sCon, aError ) ((void)0)
492 #endif
493 
494 #define DBG_TRACE( aTrace )                         \
495 do                                                  \
496 {                                                   \
497     if ( DbgIsTraceOut() )                          \
498         DbgTrace( aTrace );                         \
499 } while(0)
500 #define DBG_TRACE1( aTrace, x1 )                    \
501 do                                                  \
502 {                                                   \
503     if ( DbgIsTraceOut() )                          \
504     {                                               \
505         DbgOutTypef( DBG_OUT_TRACE, aTrace,         \
506                      x1 );                          \
507     }                                               \
508 } while(0)
509 #define DBG_TRACE2( aTrace, x1, x2 )                \
510 do                                                  \
511 {                                                   \
512     if ( DbgIsTraceOut() )                          \
513     {                                               \
514         DbgOutTypef( DBG_OUT_TRACE, aTrace,         \
515                      x1, x2 );                      \
516     }                                               \
517 } while(0)
518 #define DBG_TRACE3( aTrace, x1, x2, x3 )            \
519 do                                                  \
520 {                                                   \
521     if ( DbgIsTraceOut() )                          \
522     {                                               \
523         DbgOutTypef( DBG_OUT_TRACE, aTrace,         \
524                      x1, x2, x3 );                  \
525     }                                               \
526 } while(0)
527 #define DBG_TRACE4( aTrace, x1, x2, x3, x4 )        \
528 do                                                  \
529 {                                                   \
530     if ( DbgIsTraceOut() )                          \
531     {                                               \
532         DbgOutTypef( DBG_OUT_TRACE, aTrace,         \
533                      x1, x2, x3, x4 );              \
534     }                                               \
535 } while(0)
536 #define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 )    \
537 do                                                  \
538 {                                                   \
539     if ( DbgIsTraceOut() )                          \
540     {                                               \
541         DbgOutTypef( DBG_OUT_TRACE, aTrace,         \
542                      x1, x2, x3, x4, x5 );          \
543     }                                               \
544 } while(0)
545 #define DBG_TRACEFILE( aTrace )                     \
546 do                                                  \
547 {                                                   \
548     if ( DbgIsTraceOut() )                          \
549         DbgTrace( aTrace );                         \
550 } while(0)
551 
552 #define DBG_WARNING( aWarning )                     \
553 do                                                  \
554 {                                                   \
555     if ( DbgIsWarningOut() )                        \
556         DbgWarning( aWarning );                     \
557 } while(0)
558 #define DBG_WARNING1( aWarning, x1 )                \
559 do                                                  \
560 {                                                   \
561     if ( DbgIsWarningOut() )                        \
562     {                                               \
563         DbgOutTypef( DBG_OUT_WARNING, aWarning,     \
564                      x1 );                          \
565     }                                               \
566 } while(0)
567 #define DBG_WARNING2( aWarning, x1, x2 )            \
568 do                                                  \
569 {                                                   \
570     if ( DbgIsWarningOut() )                        \
571     {                                               \
572         DbgOutTypef( DBG_OUT_WARNING, aWarning,     \
573                      x1, x2 );                      \
574     }                                               \
575 } while(0)
576 #define DBG_WARNING3( aWarning, x1, x2, x3 )        \
577 do                                                  \
578 {                                                   \
579     if ( DbgIsWarningOut() )                        \
580     {                                               \
581         DbgOutTypef( DBG_OUT_WARNING, aWarning,     \
582                      x1, x2, x3 );                  \
583     }                                               \
584 } while(0)
585 #define DBG_WARNING4( aWarning, x1, x2, x3, x4 )    \
586 do                                                  \
587 {                                                   \
588     if ( DbgIsWarningOut() )                        \
589     {                                               \
590         DbgOutTypef( DBG_OUT_WARNING, aWarning,     \
591                      x1, x2, x3, x4 );              \
592     }                                               \
593 } while(0)
594 #define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 )\
595 do                                                  \
596 {                                                   \
597     if ( DbgIsWarningOut() )                        \
598     {                                               \
599         DbgOutTypef( DBG_OUT_WARNING, aWarning,     \
600                      x1, x2, x3, x4, x5 );          \
601     }                                               \
602 } while(0)
603 #define DBG_WARNINGFILE( aWarning )                 \
604 do                                                  \
605 {                                                   \
606     if ( DbgIsWarningOut() )                        \
607         DbgWarning( aWarning );                     \
608 } while(0)
609 
610 #define DBG_ERROR( aError )                         \
611 do                                                  \
612 {                                                   \
613     if ( DbgIsErrorOut() )                          \
614         DbgError( aError );                         \
615 } while(0)
616 #define DBG_ERROR1( aError, x1 )                    \
617 do                                                  \
618 {                                                   \
619     if ( DbgIsErrorOut() )                          \
620     {                                               \
621         DbgOutTypef( DBG_OUT_ERROR, aError,         \
622                      x1 );                          \
623     }                                               \
624 } while(0)
625 #define DBG_ERROR2( aError, x1, x2 )                \
626 do                                                  \
627 {                                                   \
628     if ( DbgIsErrorOut() )                          \
629     {                                               \
630         DbgOutTypef( DBG_OUT_ERROR, aError,         \
631                      x1, x2 );                      \
632     }                                               \
633 } while(0)
634 #define DBG_ERROR3( aError, x1, x2, x3 )            \
635 do                                                  \
636 {                                                   \
637     if ( DbgIsErrorOut() )                          \
638     {                                               \
639         DbgOutTypef( DBG_OUT_ERROR, aError,         \
640                      x1, x2, x3 );                  \
641     }                                               \
642 } while(0)
643 #define DBG_ERROR4( aError, x1, x2, x3, x4 )        \
644 do                                                  \
645 {                                                   \
646     if ( DbgIsErrorOut() )                          \
647     {                                               \
648         DbgOutTypef( DBG_OUT_ERROR, aError,         \
649                      x1, x2, x3, x4 );              \
650     }                                               \
651 } while(0)
652 #define DBG_ERROR5( aError, x1, x2, x3, x4, x5 )    \
653 do                                                  \
654 {                                                   \
655     if ( DbgIsErrorOut() )                          \
656     {                                               \
657         DbgOutTypef( DBG_OUT_ERROR, aError,         \
658                      x1, x2, x3, x4, x5 );          \
659     }                                               \
660 } while(0)
661 #define DBG_ERRORFILE( aError )                     \
662 do                                                  \
663 {                                                   \
664     if ( DbgIsErrorOut() )                          \
665         DbgError( aError );                         \
666 } while(0)
667 
668 #define DBG_TESTSOLARMUTEX()                \
669 do                                          \
670 {                                           \
671     DbgTestSolarMutex();                    \
672 } while(0)
673 
674 // --- Dbg-Defines (An/Ausschlaten) ---
675 
676 #define DBG_INSTOUTTRACE( nOut )            \
677 do                                          \
678 {                                           \
679     DbgGetData()->nTraceOut = nOut;         \
680 } while(0)
681 
682 #define DBG_INSTOUTWARNING( nOut )          \
683 do                                          \
684 {                                           \
685     DbgGetData()->nWarningOut = nOut;       \
686 } while(0)
687 
688 #define DBG_INSTOUTERROR( nOut )            \
689 do                                          \
690 {                                           \
691     DbgGetData()->nErrorOut = nOut;         \
692 } while(0)
693 
694 #else
695 
696 // ---------------
697 // - NO DBG_UITL -
698 // ---------------
699 
700 struct DbgData;
701 struct DbgGUIData;
702 struct DbgDataType;
703 
704 typedef void (*DbgPrintLine)( const sal_Char* pLine );
705 typedef const sal_Char* (*DbgUsr)(const void* pThis );
706 
707 #define DBG_DEBUGSTART() ((void)0)
708 #define DBG_DEBUGEND() ((void)0)
709 #define DBG_GLOBALDEBUGEND() ((void)0)
710 
711 #define DBG_STARTAPPEXECUTE() ((void)0)
712 #define DBG_ENDAPPEXECUTE() ((void)0)
713 
714 #define DBG_MEMTEST() ((void)0)
715 #define DBG_MEMTEST_PTR( p ) ((void)0)
716 
717 #define DBG_NAME( aName )
718 #define DBG_NAMEEX( aName )
719 #define DBG_NAMEEX_VISIBILITY( aName, vis )
720 
721 #define DBG_PROFSTART( aName ) ((void)0)
722 #define DBG_PROFSTOP( aName ) ((void)0)
723 #define DBG_PROFCONTINUE( aName ) ((void)0)
724 #define DBG_PROFPAUSE( aName ) ((void)0)
725 
726 #define DBG_CTOR( aName, fTest ) ((void)0)
727 #define DBG_DTOR( aName, fTest ) ((void)0)
728 #define DBG_CHKTHIS( aName, fTest ) ((void)0)
729 #define DBG_CHKOBJ( pObj, aName, fTest ) ((void)0)
730 
731 #define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0)
732 #define DBG_ASSERT( sCon, aError ) ((void)0)
733 #define DBG_BF_ASSERT( sCon, aError ) ((void)0)
734 #define DBG_TRACE( aTrace ) ((void)0)
735 #define DBG_TRACE1( aTrace, x1 ) ((void)0)
736 #define DBG_TRACE2( aTrace, x1, x2 ) ((void)0)
737 #define DBG_TRACE3( aTrace, x1, x2, x3 ) ((void)0)
738 #define DBG_TRACE4( aTrace, x1, x2, x3, x4 ) ((void)0)
739 #define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 ) ((void)0)
740 #define DBG_TRACEFILE( aTrace ) ((void)0)
741 #define DBG_WARNING( aWarning ) ((void)0)
742 #define DBG_WARNING1( aWarning, x1 ) ((void)0)
743 #define DBG_WARNING2( aWarning, x1, x2 ) ((void)0)
744 #define DBG_WARNING3( aWarning, x1, x2, x3 ) ((void)0)
745 #define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) ((void)0)
746 #define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) ((void)0)
747 #define DBG_WARNINGFILE( aWarning ) ((void)0)
748 #define DBG_ERROR( aError ) ((void)0)
749 #define DBG_ERROR1( aError, x1 ) ((void)0)
750 #define DBG_ERROR2( aError, x1, x2 ) ((void)0)
751 #define DBG_ERROR3( aError, x1, x2, x3 ) ((void)0)
752 #define DBG_ERROR4( aError, x1, x2, x3, x4 ) ((void)0)
753 #define DBG_ERROR5( aError, x1, x2, x3, x4, x5 ) ((void)0)
754 #define DBG_ERRORFILE( aError ) ((void)0)
755 
756 #define DBG_TESTSOLARMUTEX() ((void)0)
757 
758 #define DBG_INSTOUTTRACE( nOut ) ((void)0)
759 #define DBG_INSTOUTWARNING( nOut ) ((void)0)
760 #define DBG_INSTOUTERROR( nOut ) ((void)0)
761 
762 #endif
763 
764 #endif  // _TOOLS_DEBUG_HXX
765