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 /* ANDROID-CHANGED: Added directlog argument */ 32 void setup_logging(const char *, unsigned, int); 33 void finish_logging(); 34 35 #define LOG_NULL ((void)0) 36 37 /* Use THIS_FILE when it is available. */ 38 #ifndef THIS_FILE 39 #define THIS_FILE __FILE__ 40 #endif 41 42 #ifdef JDWP_LOGGING 43 44 #define _LOG(flavor,args) \ 45 (log_message_begin(flavor,THIS_FILE,__LINE__), \ 46 log_message_end args) 47 48 #define LOG_TEST(flag) (gdata->log_flags & (flag)) 49 50 #define LOG_JVM(args) \ 51 (LOG_TEST(JDWP_LOG_JVM) ?_LOG("JVM", args):LOG_NULL) 52 #define LOG_JNI(args) \ 53 (LOG_TEST(JDWP_LOG_JNI) ?_LOG("JNI", args):LOG_NULL) 54 #define LOG_JVMTI(args) \ 55 (LOG_TEST(JDWP_LOG_JVMTI)?_LOG("JVMTI",args):LOG_NULL) 56 #define LOG_MISC(args) \ 57 (LOG_TEST(JDWP_LOG_MISC) ?_LOG("MISC", args):LOG_NULL) 58 #define LOG_STEP(args) \ 59 (LOG_TEST(JDWP_LOG_STEP) ?_LOG("STEP", args):LOG_NULL) 60 #define LOG_LOC(args) \ 61 (LOG_TEST(JDWP_LOG_LOC) ?_LOG("LOC", args):LOG_NULL) 62 #define LOG_CB(args) \ 63 (LOG_TEST(JDWP_LOG_CB)?_LOG("CB",args):LOG_NULL) 64 #define LOG_ERROR(args) \ 65 (LOG_TEST(JDWP_LOG_ERROR)?_LOG("ERROR",args):LOG_NULL) 66 67 68 /* DO NOT USE THESE DIRECTLY */ 69 void log_message_begin(const char *, const char *, int); 70 void log_message_end(const char *, ...); 71 72 #else 73 74 #define LOG_TEST(flag) 0 75 76 #define LOG_JVM(args) LOG_NULL 77 #define LOG_JNI(args) LOG_NULL 78 #define LOG_JVMTI(args) LOG_NULL 79 #define LOG_MISC(args) LOG_NULL 80 #define LOG_STEP(args) LOG_NULL 81 #define LOG_LOC(args) LOG_NULL 82 #define LOG_CB(args) LOG_NULL 83 #define LOG_ERROR(args) LOG_NULL 84 85 #endif 86 87 #define JDWP_LOG_JVM 0x00000001 88 #define JDWP_LOG_JNI 0x00000002 89 #define JDWP_LOG_JVMTI 0x00000004 90 #define JDWP_LOG_MISC 0x00000008 91 #define JDWP_LOG_STEP 0x00000010 92 #define JDWP_LOG_LOC 0x00000020 93 #define JDWP_LOG_CB 0x00000040 94 #define JDWP_LOG_ERROR 0x00000080 95 #define JDWP_LOG_ALL 0xffffffff 96 97 #endif 98