1 /* 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 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 #ifndef JDWP_LOG_MESSAGES_H 27 #define JDWP_LOG_MESSAGES_H 28 29 /* LOG: Must be called like: LOG_category(("anything")) or LOG_category((format,args)) */ 30 31 void setup_logging(const char *, unsigned); 32 void finish_logging(); 33 34 #define LOG_NULL ((void)0) 35 36 #ifdef JDWP_LOGGING 37 38 #define _LOG(flavor,args) \ 39 (log_message_begin(flavor,__FILE__,__LINE__), \ 40 log_message_end args) 41 42 #define LOG_TEST(flag) (gdata->log_flags & (flag)) 43 44 #define LOG_JVM(args) \ 45 (LOG_TEST(JDWP_LOG_JVM) ?_LOG("JVM", args):LOG_NULL) 46 #define LOG_JNI(args) \ 47 (LOG_TEST(JDWP_LOG_JNI) ?_LOG("JNI", args):LOG_NULL) 48 #define LOG_JVMTI(args) \ 49 (LOG_TEST(JDWP_LOG_JVMTI)?_LOG("JVMTI",args):LOG_NULL) 50 #define LOG_MISC(args) \ 51 (LOG_TEST(JDWP_LOG_MISC) ?_LOG("MISC", args):LOG_NULL) 52 #define LOG_STEP(args) \ 53 (LOG_TEST(JDWP_LOG_STEP) ?_LOG("STEP", args):LOG_NULL) 54 #define LOG_LOC(args) \ 55 (LOG_TEST(JDWP_LOG_LOC) ?_LOG("LOC", args):LOG_NULL) 56 #define LOG_CB(args) \ 57 (LOG_TEST(JDWP_LOG_CB)?_LOG("CB",args):LOG_NULL) 58 #define LOG_ERROR(args) \ 59 (LOG_TEST(JDWP_LOG_ERROR)?_LOG("ERROR",args):LOG_NULL) 60 61 62 /* DO NOT USE THESE DIRECTLY */ 63 void log_message_begin(const char *, const char *, int); 64 void log_message_end(const char *, ...); 65 66 #else 67 68 #define LOG_TEST(flag) 0 69 70 #define LOG_JVM(args) LOG_NULL 71 #define LOG_JNI(args) LOG_NULL 72 #define LOG_JVMTI(args) LOG_NULL 73 #define LOG_MISC(args) LOG_NULL 74 #define LOG_STEP(args) LOG_NULL 75 #define LOG_LOC(args) LOG_NULL 76 #define LOG_CB(args) LOG_NULL 77 #define LOG_ERROR(args) LOG_NULL 78 79 #endif 80 81 #define JDWP_LOG_JVM 0x00000001 82 #define JDWP_LOG_JNI 0x00000002 83 #define JDWP_LOG_JVMTI 0x00000004 84 #define JDWP_LOG_MISC 0x00000008 85 #define JDWP_LOG_STEP 0x00000010 86 #define JDWP_LOG_LOC 0x00000020 87 #define JDWP_LOG_CB 0x00000040 88 #define JDWP_LOG_ERROR 0x00000080 89 #define JDWP_LOG_ALL 0xffffffff 90 91 #endif 92