jdk/src/share/native/sun/awt/debug/debug_trace.h
author ohair
Tue, 11 Sep 2012 13:40:59 -0700
changeset 13678 5c8001201f98
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__ 7180608: Sort the order of object files when building shared libraries Reviewed-by: ohrstrom, erikj, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#if !defined(_DEBUG_TRACE_H)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define _DEBUG_TRACE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#if defined(__cplusplus)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#if defined(DEBUG)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "debug_util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
13678
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    37
/* Use THIS_FILE when it is available. */
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    38
#ifndef THIS_FILE
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    39
    #define THIS_FILE __FILE__
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    40
#endif
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    41
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
typedef int     dtrace_id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    UNDEFINED_TRACE_ID = -1 /* indicates trace point has not been registered yet */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
/* prototype for client provided output callback function */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
typedef void (*DTRACE_OUTPUT_CALLBACK)(const char * msg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
/* prototype for client provided print callback function */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
typedef void (*DTRACE_PRINT_CALLBACK)(const char * file, int line, int argc, const char * fmt, va_list arglist);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
extern void DTrace_EnableAll(dbool_t enabled);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
extern void DTrace_EnableFile(const char * file, dbool_t enabled);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
extern void DTrace_EnableLine(const char * file, int linenum, dbool_t enabled);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
extern void DTrace_SetOutputCallback(DTRACE_OUTPUT_CALLBACK pfn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
extern void DTrace_Initialize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
extern void DTrace_Shutdown();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
void DTrace_DisableMutex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
extern void DTrace_VPrintImpl(const char * fmt, va_list arglist);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
extern void DTrace_PrintImpl(const char * fmt, ...);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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, ...);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
/* these functions are exported only for use in macros-- do not call them directly!!! */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
extern void DTrace_VPrint(const char * file, int line, int argc, const char * fmt, va_list arglist);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
extern void DTrace_VPrintln(const char * file, int line, int argc, const char * fmt, va_list arglist);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
/* each file includes this flag indicating module trace status */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
static dtrace_id        _Dt_FileTraceId = UNDEFINED_TRACE_ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
/* not meant to be called from client code--
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * it's just a template for the other macros
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define _DTrace_Template(_func, _ac, _f, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; \
13678
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    77
    DTrace_PrintFunction((_func), &_Dt_FileTraceId, &_dt_lineid_, THIS_FILE, __LINE__, (_ac), (_f), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6), (_a7), (_a8) ); \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
/* printf style trace macros */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#define DTRACE_PRINT(_fmt) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        _DTrace_Template(DTrace_VPrint, 0, (_fmt), 0, 0, 0, 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
#define DTRACE_PRINT1(_fmt, _arg1) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        _DTrace_Template(DTrace_VPrint, 1, (_fmt), (_arg1), 0, 0, 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#define DTRACE_PRINT2(_fmt, _arg1, _arg2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        _DTrace_Template(DTrace_VPrint, 2, (_fmt), (_arg1), (_arg2), 0, 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
#define DTRACE_PRINT3(_fmt, _arg1, _arg2, _arg3) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        _DTrace_Template(DTrace_VPrint, 3, (_fmt), (_arg1), (_arg2), (_arg3), 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
#define DTRACE_PRINT4(_fmt, _arg1, _arg2, _arg3, _arg4) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        _DTrace_Template(DTrace_VPrint, 4, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#define DTRACE_PRINT5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        _DTrace_Template(DTrace_VPrint, 5, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
#define DTRACE_PRINT6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        _DTrace_Template(DTrace_VPrint, 6, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
#define DTRACE_PRINT7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        _DTrace_Template(DTrace_VPrint, 7, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
#define DTRACE_PRINT8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        _DTrace_Template(DTrace_VPrint, 8, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), (_arg8))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
/* printf style trace macros that automatically output a newline */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
#define DTRACE_PRINTLN(_fmt) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        _DTrace_Template(DTrace_VPrintln, 0, (_fmt), 0, 0, 0, 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
#define DTRACE_PRINTLN1(_fmt, _arg1) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        _DTrace_Template(DTrace_VPrintln, 1, (_fmt), (_arg1), 0, 0, 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
#define DTRACE_PRINTLN2(_fmt, _arg1, _arg2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        _DTrace_Template(DTrace_VPrintln, 2, (_fmt), (_arg1), (_arg2), 0, 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
#define DTRACE_PRINTLN3(_fmt, _arg1, _arg2, _arg3) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        _DTrace_Template(DTrace_VPrintln, 3, (_fmt), (_arg1), (_arg2), (_arg3), 0, 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
#define DTRACE_PRINTLN4(_fmt, _arg1, _arg2, _arg3, _arg4) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        _DTrace_Template(DTrace_VPrintln, 4, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), 0, 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
#define DTRACE_PRINTLN5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        _DTrace_Template(DTrace_VPrintln, 5, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), 0, 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
#define DTRACE_PRINTLN6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        _DTrace_Template(DTrace_VPrintln, 6, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), 0, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
#define DTRACE_PRINTLN7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        _DTrace_Template(DTrace_VPrintln, 7, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
#define DTRACE_PRINTLN8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        _DTrace_Template(DTrace_VPrintln, 8, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), (_arg8))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#else /* else DEBUG not defined */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
/* printf style trace macros */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
#define DTRACE_PRINT(_fmt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
#define DTRACE_PRINT1(_fmt, _arg1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
#define DTRACE_PRINT2(_fmt, _arg1, _arg2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
#define DTRACE_PRINT3(_fmt, _arg1, _arg2, _arg3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
#define DTRACE_PRINT4(_fmt, _arg1, _arg2, _arg3, _arg4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
#define DTRACE_PRINT5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
#define DTRACE_PRINT6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
#define DTRACE_PRINT7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
#define DTRACE_PRINT8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
/* printf style trace macros that automatically output a newline */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
#define DTRACE_PRINTLN(_fmt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
#define DTRACE_PRINTLN1(_fmt, _arg1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
#define DTRACE_PRINTLN2(_fmt, _arg1, _arg2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
#define DTRACE_PRINTLN3(_fmt, _arg1, _arg2, _arg3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#define DTRACE_PRINTLN4(_fmt, _arg1, _arg2, _arg3, _arg4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
#define DTRACE_PRINTLN5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
#define DTRACE_PRINTLN6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
#define DTRACE_PRINTLN7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
#define DTRACE_PRINTLN8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
#endif /* endif DEBUG defined */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
#if defined(__cplusplus)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
} /* extern "C" */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
#endif /* _DEBUG_TRACE_H */