#ifndef _PAL_CONFIG_H_INCLUDED
#define _PAL_CONFIG_H_INCLUDED 1
-#define _NO_DEBUG_MESSAGES_ 0
-
#cmakedefine01 HAVE_IEEEFP_H
#cmakedefine01 HAVE_ALLOCA_H
#cmakedefine01 HAVE_SYS_VMPARAM_H
/* reset ENTRY nesting level back to zero, qsort will invoke app-defined
callbacks and we want their entry traces... */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
{
int old_level;
old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
qsort(base,nmemb,size,compar);
/* ...and set nesting level back to what it was */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
DBG_change_entrylevel(old_level);
}
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
LOGEXIT("qsort returns\n");
PERF_EXIT(qsort);
/* reset ENTRY nesting level back to zero, bsearch will invoke app-defined
callbacks and we want their entry traces... */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
{
int old_level;
old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
retval = bsearch(key,base,nmemb,size,compar);
/* ...and set nesting level back to what it was */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
DBG_change_entrylevel(old_level);
}
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
LOGEXIT("bsearch returns %p\n",retval);
PERF_EXIT(bsearch);
BOOL handler_retval;
/* reset ENTRY nesting level back to zero while inside the callback... */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
{
int old_level;
old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
handler_retval = handler->handler(event);
/* ...and set nesting level back to what it was */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
DBG_change_entrylevel(old_level);
}
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
if(handler_retval)
{
TRACE("Entering FILEEscapeSquareBrackets: [%p (%s)][%p]\n",
pattern,pattern,escaped_pattern);
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
char *escaped_pattern_base = escaped_pattern;
-#endif // !_NO_DEBUG_MESSAGES
+#endif // _ENABLE_DEBUG_MESSAGES_
while(*pattern)
{
set to nonzero, channels will be open or closed based on PAL_DBG_CHANNELS
Notes :
- If _NO_DEBUG_MESSAGES_ was defined at build-time, no debug messages
+ If _ENABLE_DEBUG_MESSAGES_ was not defined at build-time, no debug messages
will be generated.
- If _NO_DEBUG_MESSAGES_ was NOT defined, all debug levels will be enabled,
+ If _ENABLE_DEBUG_MESSAGES_ was defined, all debug levels will be enabled,
but all channels will be closed by default
- To define NO_DEBUG_MESSAGES, run the configure script with the parameter
- --disable-dbgmsg
Another configure option is --enable-appendtraces
Normally, if the file specified by PAL_API_TRACING exists, its content will
extern Volatile<BOOL> dbg_master_switch ;
-/* output macros */
-
-#define SET_DEFAULT_DEBUG_CHANNEL(x) \
- static const DBG_CHANNEL_ID defdbgchan = DCI_##x
-
-/* Is debug output enabled for the given level and channel? */
-#define DBG_ENABLED(level, channel) (output_file && \
- dbg_master_switch && \
- (dbg_channel_flags[channel] & (1 << (level))))
-
/* conditionnal compilation for other debug messages */
-#if _NO_DEBUG_MESSAGES_
+#if !_ENABLE_DEBUG_MESSAGES_
/* compile out these trace levels; see the definition of NOTRACE */
#define TRACE NOTRACE
#define DBGOUT_(x) NOTRACE
#define ERROR NOTRACE
#define ERROR_(x) NOTRACE
+#define DBG_PRINTF(level, channel, bHeader) NOTRACE
#define CHECK_STACK_ALIGN
-#else /* _NO_DEBUG_MESSAGES_ */
+#define SET_DEFAULT_DEBUG_CHANNEL(x)
+#define DBG_ENABLED(level, channel)
+#else /* _ENABLE_DEBUG_MESSAGES_ */
+
+/* output macros */
+
+#define SET_DEFAULT_DEBUG_CHANNEL(x) \
+ static const DBG_CHANNEL_ID defdbgchan = DCI_##x
+
+/* Is debug output enabled for the given level and channel? */
+#define DBG_ENABLED(level, channel) (output_file && \
+ dbg_master_switch && \
+ (dbg_channel_flags[channel] & (1 << (level))))
#define TRACE \
DBG_PRINTF(DLI_TRACE,defdbgchan,TRUE)
#define ERROR_(x) \
DBG_PRINTF(DLI_ERROR,DCI_##x,TRUE)
-#endif /* _NO_DEBUG_MESSAGES_ */
-
-/* Use GNU C-specific features if available : __FUNCTION__ pseudo-macro,
- variable-argument macros */
-#ifdef __GNUC__
-
-/* define NOTRACE as nothing; this will absorb the variable-argument list used
- in tracing macros */
-#define NOTRACE(args...)
-
#define DBG_PRINTF(level, channel, bHeader) \
{\
if( DBG_ENABLED(level, channel) ) { \
BOOL __bHeader = bHeader;\
DBG_PRINTF2
+#ifdef __GNUC__
#define DBG_PRINTF2(args...)\
DBG_printf_gcc(__chanid,__levid,__bHeader,__FUNCTION__,__FILE__,\
__LINE__,args);\
}\
}
+#else /* __GNUC__ */
+#define DBG_PRINTF2(...)\
+ DBG_printf_c99(__chanid,__levid,__bHeader,__FILE__,__LINE__,__VA_ARGS__);\
+ }\
+}
+#endif /* __GNUC__ */
+
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
+
+/* Use GNU C-specific features if available : __FUNCTION__ pseudo-macro,
+ variable-argument macros */
+#ifdef __GNUC__
+
+/* define NOTRACE as nothing; this will absorb the variable-argument list used
+ in tracing macros */
+#define NOTRACE(args...)
#if defined(__cplusplus) && defined(FEATURE_PAL_SXS)
#define __ASSERT_ENTER() \
in tracing macros */
#define NOTRACE(...)
-#define DBG_PRINTF(level, channel, bHeader) \
-{\
- if( DBG_ENABLED(level, channel) ) { \
- DBG_CHANNEL_ID __chanid=channel;\
- DBG_LEVEL_ID __levid=level;\
- BOOL __bHeader = bHeader;\
- DBG_PRINTF2
-
-#define DBG_PRINTF2(...)\
- DBG_printf_c99(__chanid,__levid,__bHeader,__FILE__,__LINE__,__VA_ARGS__);\
- }\
-}
-
#if !defined(_DEBUG)
#define ASSERT(...)
compiling PAL implementation files. */
#include "config.h"
+#ifdef DEBUG
+#define _ENABLE_DEBUG_MESSAGES_ 1
+#else
+#define _ENABLE_DEBUG_MESSAGES_ 0
+#endif
+
#ifdef PAL_PERF
#include "pal_perf.h"
#endif
}
else if (!pThread->IsInPal())
{
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
DBG_PRINTF(DLI_ENTRY, defdbgchan, TRUE)("PAL_ReenterForEH()\n");
#endif
module->lib_name ? module->lib_name : W16_NULLSTRING);
/* reset ENTRY nesting level back to zero while inside the callback... */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
{
int old_level;
old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
{
// This module may be foreign to our PAL, so leave our PAL.
}
}
/* ...and set nesting level back to what it was */
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
DBG_change_entrylevel(old_level);
}
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
}
if (module->dl_handle && 0 != dlclose(module->dl_handle))
{
if (module->pDllMain)
{
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
/* reset ENTRY nesting level back to zero while inside the callback... */
int old_level;
old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
{
// This module may be foreign to our PAL, so leave our PAL.
module->pDllMain(module->hinstance, dwReason, lpReserved);
}
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
/* ...and set nesting level back to what it was */
DBG_change_entrylevel(old_level);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
}
}
BOOL dllMainRetVal;
{
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
/* reset ENTRY nesting level back to zero while inside the callback... */
int old_level;
old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
{
// This module may be foreign to our PAL, so leave our PAL.
dllMainRetVal = module->pDllMain(module->hinstance, DLL_PROCESS_ATTACH, fDynamic ? NULL : (LPVOID)-1);
}
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
/* ...and set nesting level back to what it was */
DBG_change_entrylevel(old_level);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
}
// If DlMain(DLL_PROCESS_ATTACH) returns FALSE, we must immediately unload the module
*/
static void LOAD_SEH_CallDllMain(MODSTRUCT *module, DWORD dwReason, LPVOID lpReserved)
{
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
/* reset ENTRY nesting level back to zero while inside the callback... */
int old_level = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
struct Param
{
}
PAL_ENDTRY
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
/* ...and set nesting level back to what it was */
DBG_change_entrylevel(old_level);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
}
/*++
ptainNode = ptainLocalHead;
ptainLocalHead = ptainNode->pNext;
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
// reset ENTRY nesting level back to zero while
// inside the callback ...
int iOldLevel = DBG_change_entrylevel(0);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
TRACE("Calling APC %p with parameter %#x\n",
ptainNode->pfnAPC, ptainNode->pfnAPC);
// Actual APC call
ptainNode->pfnAPC(ptainNode->pAPCData);
-#if !_NO_DEBUG_MESSAGES_
+#if _ENABLE_DEBUG_MESSAGES_
// ... and set nesting level back to what it was
DBG_change_entrylevel(iOldLevel);
-#endif /* !_NO_DEBUG_MESSAGES_ */
+#endif /* _ENABLE_DEBUG_MESSAGES_ */
iAPCsCalled++;
m_cacheThreadApcInfoNodes.Add(pthrCurrent, ptainNode);