Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/awt/debug/debug_trace.h
38918 views
/*1* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#if !defined(_DEBUG_TRACE_H)26#define _DEBUG_TRACE_H2728#if defined(__cplusplus)29extern "C" {30#endif3132#if defined(DEBUG)3334#include "debug_util.h"3536/* Use THIS_FILE when it is available. */37#ifndef THIS_FILE38#define THIS_FILE __FILE__39#endif4041typedef int dtrace_id;42enum {43UNDEFINED_TRACE_ID = -1 /* indicates trace point has not been registered yet */44};4546/* prototype for client provided output callback function */47typedef void (*DTRACE_OUTPUT_CALLBACK)(const char * msg);4849/* prototype for client provided print callback function */50typedef void (*DTRACE_PRINT_CALLBACK)(const char * file, int line, int argc, const char * fmt, va_list arglist);5152extern void DTrace_EnableAll(dbool_t enabled);53extern void DTrace_EnableFile(const char * file, dbool_t enabled);54extern void DTrace_EnableLine(const char * file, int linenum, dbool_t enabled);55extern void DTrace_SetOutputCallback(DTRACE_OUTPUT_CALLBACK pfn);56extern void DTrace_Initialize();57extern void DTrace_Shutdown();58void DTrace_DisableMutex();59extern void DTrace_VPrintImpl(const char * fmt, va_list arglist);60extern void DTrace_PrintImpl(const char * fmt, ...);61extern void DTrace_PrintFunction(DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pTraceId, const char * file, int line, int argc, const char * fmt, ...);6263/* these functions are exported only for use in macros-- do not call them directly!!! */64extern void DTrace_VPrint(const char * file, int line, int argc, const char * fmt, va_list arglist);65extern void DTrace_VPrintln(const char * file, int line, int argc, const char * fmt, va_list arglist);6667/* each file includes this flag indicating module trace status */68static dtrace_id _Dt_FileTraceId = UNDEFINED_TRACE_ID;6970/* not meant to be called from client code--71* it's just a template for the other macros72*/73#define _DTrace_Template(_func, _ac, _f, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) \74{ \75static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; \76DTrace_PrintFunction((_func), &_Dt_FileTraceId, &_dt_lineid_, THIS_FILE, __LINE__, (_ac), (_f), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6), (_a7), (_a8) ); \77}7879/* printf style trace macros */80#define DTRACE_PRINT(_fmt) \81_DTrace_Template(DTrace_VPrint, 0, (_fmt), 0, 0, 0, 0, 0, 0, 0, 0)82#define DTRACE_PRINT1(_fmt, _arg1) \83_DTrace_Template(DTrace_VPrint, 1, (_fmt), (_arg1), 0, 0, 0, 0, 0, 0, 0)84#define DTRACE_PRINT2(_fmt, _arg1, _arg2) \85_DTrace_Template(DTrace_VPrint, 2, (_fmt), (_arg1), (_arg2), 0, 0, 0, 0, 0, 0)86#define DTRACE_PRINT3(_fmt, _arg1, _arg2, _arg3) \87_DTrace_Template(DTrace_VPrint, 3, (_fmt), (_arg1), (_arg2), (_arg3), 0, 0, 0, 0, 0)88#define DTRACE_PRINT4(_fmt, _arg1, _arg2, _arg3, _arg4) \89_DTrace_Template(DTrace_VPrint, 4, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), 0, 0, 0, 0)90#define DTRACE_PRINT5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5) \91_DTrace_Template(DTrace_VPrint, 5, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), 0, 0, 0)92#define DTRACE_PRINT6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) \93_DTrace_Template(DTrace_VPrint, 6, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), 0, 0)94#define DTRACE_PRINT7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) \95_DTrace_Template(DTrace_VPrint, 7, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), 0)96#define DTRACE_PRINT8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) \97_DTrace_Template(DTrace_VPrint, 8, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), (_arg8))9899/* printf style trace macros that automatically output a newline */100#define DTRACE_PRINTLN(_fmt) \101_DTrace_Template(DTrace_VPrintln, 0, (_fmt), 0, 0, 0, 0, 0, 0, 0, 0)102#define DTRACE_PRINTLN1(_fmt, _arg1) \103_DTrace_Template(DTrace_VPrintln, 1, (_fmt), (_arg1), 0, 0, 0, 0, 0, 0, 0)104#define DTRACE_PRINTLN2(_fmt, _arg1, _arg2) \105_DTrace_Template(DTrace_VPrintln, 2, (_fmt), (_arg1), (_arg2), 0, 0, 0, 0, 0, 0)106#define DTRACE_PRINTLN3(_fmt, _arg1, _arg2, _arg3) \107_DTrace_Template(DTrace_VPrintln, 3, (_fmt), (_arg1), (_arg2), (_arg3), 0, 0, 0, 0, 0)108#define DTRACE_PRINTLN4(_fmt, _arg1, _arg2, _arg3, _arg4) \109_DTrace_Template(DTrace_VPrintln, 4, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), 0, 0, 0, 0)110#define DTRACE_PRINTLN5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5) \111_DTrace_Template(DTrace_VPrintln, 5, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), 0, 0, 0)112#define DTRACE_PRINTLN6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) \113_DTrace_Template(DTrace_VPrintln, 6, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), 0, 0)114#define DTRACE_PRINTLN7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) \115_DTrace_Template(DTrace_VPrintln, 7, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), 0)116#define DTRACE_PRINTLN8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) \117_DTrace_Template(DTrace_VPrintln, 8, (_fmt), (_arg1), (_arg2), (_arg3), (_arg4), (_arg5), (_arg6), (_arg7), (_arg8))118119#else /* else DEBUG not defined */120121/* printf style trace macros */122#define DTRACE_PRINT(_fmt)123#define DTRACE_PRINT1(_fmt, _arg1)124#define DTRACE_PRINT2(_fmt, _arg1, _arg2)125#define DTRACE_PRINT3(_fmt, _arg1, _arg2, _arg3)126#define DTRACE_PRINT4(_fmt, _arg1, _arg2, _arg3, _arg4)127#define DTRACE_PRINT5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5)128#define DTRACE_PRINT6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6)129#define DTRACE_PRINT7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7)130#define DTRACE_PRINT8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8)131132/* printf style trace macros that automatically output a newline */133#define DTRACE_PRINTLN(_fmt)134#define DTRACE_PRINTLN1(_fmt, _arg1)135#define DTRACE_PRINTLN2(_fmt, _arg1, _arg2)136#define DTRACE_PRINTLN3(_fmt, _arg1, _arg2, _arg3)137#define DTRACE_PRINTLN4(_fmt, _arg1, _arg2, _arg3, _arg4)138#define DTRACE_PRINTLN5(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5)139#define DTRACE_PRINTLN6(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6)140#define DTRACE_PRINTLN7(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7)141#define DTRACE_PRINTLN8(_fmt, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8)142143#endif /* endif DEBUG defined */144145#if defined(__cplusplus)146} /* extern "C" */147#endif148149#endif /* _DEBUG_TRACE_H */150151152