blob: c2e0b78952a9d24465a9f43dbb88ffa9d0d7ff16 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2003-2005 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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
31void setup_logging(const char *, unsigned);
32void finish_logging(int);
33
34#define LOG_NULL ((void)0)
35
36#ifdef JDWP_LOGGING
37
38
39 #define _LOG(flavor,args) \
40 (log_message_begin(flavor,__FILE__,__LINE__), \
41 log_message_end args)
42
43 #define LOG_TEST(flag) (gdata->log_flags & (flag))
44
45 #define LOG_JVM(args) \
46 (LOG_TEST(JDWP_LOG_JVM) ?_LOG("JVM", args):LOG_NULL)
47 #define LOG_JNI(args) \
48 (LOG_TEST(JDWP_LOG_JNI) ?_LOG("JNI", args):LOG_NULL)
49 #define LOG_JVMTI(args) \
50 (LOG_TEST(JDWP_LOG_JVMTI)?_LOG("JVMTI",args):LOG_NULL)
51 #define LOG_MISC(args) \
52 (LOG_TEST(JDWP_LOG_MISC) ?_LOG("MISC", args):LOG_NULL)
53 #define LOG_STEP(args) \
54 (LOG_TEST(JDWP_LOG_STEP) ?_LOG("STEP", args):LOG_NULL)
55 #define LOG_LOC(args) \
56 (LOG_TEST(JDWP_LOG_LOC) ?_LOG("LOC", args):LOG_NULL)
57 #define LOG_CB(args) \
58 (LOG_TEST(JDWP_LOG_CB)?_LOG("CB",args):LOG_NULL)
59 #define LOG_ERROR(args) \
60 (LOG_TEST(JDWP_LOG_ERROR)?_LOG("ERROR",args):LOG_NULL)
61
62
63 /* DO NOT USE THESE DIRECTLY */
64 void log_message_begin(const char *, const char *, int);
65 void log_message_end(const char *, ...);
66
67#else
68
69 #define LOG_TEST(flag) 0
70
71 #define LOG_JVM(args) LOG_NULL
72 #define LOG_JNI(args) LOG_NULL
73 #define LOG_JVMTI(args) LOG_NULL
74 #define LOG_MISC(args) LOG_NULL
75 #define LOG_STEP(args) LOG_NULL
76 #define LOG_LOC(args) LOG_NULL
77 #define LOG_CB(args) LOG_NULL
78 #define LOG_ERROR(args) LOG_NULL
79
80#endif
81
82#define JDWP_LOG_JVM 0x00000001
83#define JDWP_LOG_JNI 0x00000002
84#define JDWP_LOG_JVMTI 0x00000004
85#define JDWP_LOG_MISC 0x00000008
86#define JDWP_LOG_STEP 0x00000010
87#define JDWP_LOG_LOC 0x00000020
88#define JDWP_LOG_CB 0x00000040
89#define JDWP_LOG_ERROR 0x00000080
90#define JDWP_LOG_ALL 0xffffffff
91
92#endif