< prev index next >

src/java.desktop/share/native/common/awt/debug/debug_trace.h

Print this page
rev 52923 : 8226346: Build better binary builders
Reviewed-by: andrew


  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #if !defined(_DEBUG_TRACE_H)
  27 #define _DEBUG_TRACE_H
  28 
  29 #if defined(__cplusplus)
  30 extern "C" {
  31 #endif
  32 
  33 #if defined(DEBUG)
  34 
  35 #include "debug_util.h"
  36 
  37 /* Use THIS_FILE when it is available. */
  38 #ifndef THIS_FILE
  39     #define THIS_FILE __FILE__
  40 #endif
  41 
  42 typedef int     dtrace_id;
  43 enum {
  44     UNDEFINED_TRACE_ID = -1 /* indicates trace point has not been registered yet */
  45 };
  46 
  47 /* prototype for client provided output callback function */
  48 typedef void (*DTRACE_OUTPUT_CALLBACK)(const char * msg);
  49 
  50 /* prototype for client provided print callback function */
  51 typedef void (*DTRACE_PRINT_CALLBACK)(const char * file, int line, int argc, const char * fmt, va_list arglist);
  52 
  53 extern void DTrace_EnableAll(dbool_t enabled);
  54 extern void DTrace_EnableFile(const char * file, dbool_t enabled);
  55 extern void DTrace_EnableLine(const char * file, int linenum, dbool_t enabled);
  56 extern void DTrace_SetOutputCallback(DTRACE_OUTPUT_CALLBACK pfn);
  57 extern void DTrace_Initialize();
  58 extern void DTrace_Shutdown();
  59 void DTrace_DisableMutex();
  60 extern void DTrace_VPrintImpl(const char * fmt, va_list arglist);
  61 extern void DTrace_PrintImpl(const char * fmt, ...);
  62 extern void DTrace_PrintFunction(DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pTraceId, const char * file, int line, int argc, const char * fmt, ...);
  63 
  64 /* these functions are exported only for use in macros-- do not call them directly!!! */
  65 extern void DTrace_VPrint(const char * file, int line, int argc, const char * fmt, va_list arglist);
  66 extern void DTrace_VPrintln(const char * file, int line, int argc, const char * fmt, va_list arglist);
  67 
  68 /* each file includes this flag indicating module trace status */
  69 static dtrace_id        _Dt_FileTraceId = UNDEFINED_TRACE_ID;
  70 
  71 /* not meant to be called from client code--
  72  * it's just a template for the other macros
  73  */
  74 #define _DTrace_Template(_func, _ac, _f, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) \
  75 { \
  76     static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; \
  77     DTrace_PrintFunction((_func), &_Dt_FileTraceId, &_dt_lineid_, THIS_FILE, __LINE__, (_ac), (_f), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6), (_a7), (_a8) ); \
  78 }
  79 
  80 /* printf style trace macros */
  81 #define DTRACE_PRINT(_fmt) \
  82         _DTrace_Template(DTrace_VPrint, 0, (_fmt), 0, 0, 0, 0, 0, 0, 0, 0)
  83 #define DTRACE_PRINT1(_fmt, _arg1) \
  84         _DTrace_Template(DTrace_VPrint, 1, (_fmt), (_arg1), 0, 0, 0, 0, 0, 0, 0)
  85 #define DTRACE_PRINT2(_fmt, _arg1, _arg2) \
  86         _DTrace_Template(DTrace_VPrint, 2, (_fmt), (_arg1), (_arg2), 0, 0, 0, 0, 0, 0)
  87 #define DTRACE_PRINT3(_fmt, _arg1, _arg2, _arg3) \
  88         _DTrace_Template(DTrace_VPrint, 3, (_fmt), (_arg1), (_arg2), (_arg3), 0, 0, 0, 0, 0)
  89 #define DTRACE_PRINT4(_fmt, _arg1, _arg2, _arg3, _arg4) \
  90         _DTrace_Template(DTrace_VPrint, 4, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), 0, 0, 0, 0)
  91 #define DTRACE_PRINT5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5) \
  92         _DTrace_Template(DTrace_VPrint, 5, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), 0, 0, 0)
  93 #define DTRACE_PRINT6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) \
  94         _DTrace_Template(DTrace_VPrint, 6, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), 0, 0)
  95 #define DTRACE_PRINT7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) \
  96         _DTrace_Template(DTrace_VPrint, 7, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), 0)
  97 #define DTRACE_PRINT8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) \




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #if !defined(_DEBUG_TRACE_H)
  27 #define _DEBUG_TRACE_H
  28 
  29 #if defined(__cplusplus)
  30 extern "C" {
  31 #endif
  32 
  33 #if defined(DEBUG)
  34 
  35 #include "debug_util.h"
  36 





  37 typedef int     dtrace_id;
  38 enum {
  39     UNDEFINED_TRACE_ID = -1 /* indicates trace point has not been registered yet */
  40 };
  41 
  42 /* prototype for client provided output callback function */
  43 typedef void (*DTRACE_OUTPUT_CALLBACK)(const char * msg);
  44 
  45 /* prototype for client provided print callback function */
  46 typedef void (*DTRACE_PRINT_CALLBACK)(const char * file, int line, int argc, const char * fmt, va_list arglist);
  47 
  48 extern void DTrace_EnableAll(dbool_t enabled);
  49 extern void DTrace_EnableFile(const char * file, dbool_t enabled);
  50 extern void DTrace_EnableLine(const char * file, int linenum, dbool_t enabled);
  51 extern void DTrace_SetOutputCallback(DTRACE_OUTPUT_CALLBACK pfn);
  52 extern void DTrace_Initialize();
  53 extern void DTrace_Shutdown();
  54 void DTrace_DisableMutex();
  55 extern void DTrace_VPrintImpl(const char * fmt, va_list arglist);
  56 extern void DTrace_PrintImpl(const char * fmt, ...);
  57 extern void DTrace_PrintFunction(DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pTraceId, const char * file, int line, int argc, const char * fmt, ...);
  58 
  59 /* these functions are exported only for use in macros-- do not call them directly!!! */
  60 extern void DTrace_VPrint(const char * file, int line, int argc, const char * fmt, va_list arglist);
  61 extern void DTrace_VPrintln(const char * file, int line, int argc, const char * fmt, va_list arglist);
  62 
  63 /* each file includes this flag indicating module trace status */
  64 static dtrace_id        _Dt_FileTraceId = UNDEFINED_TRACE_ID;
  65 
  66 /* not meant to be called from client code--
  67  * it's just a template for the other macros
  68  */
  69 #define _DTrace_Template(_func, _ac, _f, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) \
  70 { \
  71     static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; \
  72     DTrace_PrintFunction((_func), &_Dt_FileTraceId, &_dt_lineid_, __FILE__, __LINE__, (_ac), (_f), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6), (_a7), (_a8) ); \
  73 }
  74 
  75 /* printf style trace macros */
  76 #define DTRACE_PRINT(_fmt) \
  77         _DTrace_Template(DTrace_VPrint, 0, (_fmt), 0, 0, 0, 0, 0, 0, 0, 0)
  78 #define DTRACE_PRINT1(_fmt, _arg1) \
  79         _DTrace_Template(DTrace_VPrint, 1, (_fmt), (_arg1), 0, 0, 0, 0, 0, 0, 0)
  80 #define DTRACE_PRINT2(_fmt, _arg1, _arg2) \
  81         _DTrace_Template(DTrace_VPrint, 2, (_fmt), (_arg1), (_arg2), 0, 0, 0, 0, 0, 0)
  82 #define DTRACE_PRINT3(_fmt, _arg1, _arg2, _arg3) \
  83         _DTrace_Template(DTrace_VPrint, 3, (_fmt), (_arg1), (_arg2), (_arg3), 0, 0, 0, 0, 0)
  84 #define DTRACE_PRINT4(_fmt, _arg1, _arg2, _arg3, _arg4) \
  85         _DTrace_Template(DTrace_VPrint, 4, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), 0, 0, 0, 0)
  86 #define DTRACE_PRINT5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5) \
  87         _DTrace_Template(DTrace_VPrint, 5, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), 0, 0, 0)
  88 #define DTRACE_PRINT6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) \
  89         _DTrace_Template(DTrace_VPrint, 6, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), 0, 0)
  90 #define DTRACE_PRINT7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) \
  91         _DTrace_Template(DTrace_VPrint, 7, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), 0)
  92 #define DTRACE_PRINT8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) \


< prev index next >