duke@435: /* stefank@2314: * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef SHARE_VM_PRIMS_JVMTITRACE_HPP stefank@2314: #define SHARE_VM_PRIMS_JVMTITRACE_HPP stefank@2314: stefank@2314: #include "classfile/systemDictionary.hpp" stefank@2314: #include "jvmtifiles/jvmti.h" stefank@2314: #include "oops/objArrayOop.hpp" stefank@2314: #include "prims/jvmtiEnvThreadState.hpp" stefank@2314: #include "prims/jvmtiEventController.hpp" stefank@2314: #include "prims/jvmtiUtil.hpp" stefank@2314: #include "runtime/stackValueCollection.hpp" stefank@2314: #include "runtime/vm_operations.hpp" stefank@2314: duke@435: /////////////////////////////////////////////////////////////// duke@435: // duke@435: // class JvmtiTrace duke@435: // duke@435: // Support for JVMTI tracing code duke@435: // duke@435: duke@435: // Support tracing except in product build on the client compiler duke@435: #ifndef PRODUCT duke@435: #define JVMTI_TRACE 1 duke@435: #else duke@435: #ifdef COMPILER2 duke@435: #define JVMTI_TRACE 1 duke@435: #endif duke@435: #endif duke@435: duke@435: #ifdef JVMTI_TRACE duke@435: duke@435: class JvmtiTrace : AllStatic { duke@435: duke@435: static bool _initialized; duke@435: static bool _on; duke@435: static bool _trace_event_controller; duke@435: static jbyte _trace_flags[]; duke@435: static jbyte _event_trace_flags[]; duke@435: static const char* _event_names[]; duke@435: static jint _max_function_index; duke@435: static jint _max_event_index; duke@435: static short _exclude_functions[]; duke@435: static const char* _function_names[]; duke@435: duke@435: public: duke@435: duke@435: enum { duke@435: SHOW_IN = 01, duke@435: SHOW_OUT = 02, duke@435: SHOW_ERROR = 04, duke@435: SHOW_IN_DETAIL = 010, duke@435: SHOW_OUT_DETAIL = 020, duke@435: SHOW_EVENT_TRIGGER = 040, duke@435: SHOW_EVENT_SENT = 0100 duke@435: }; duke@435: duke@435: static bool tracing() { return _on; } duke@435: static bool trace_event_controller() { return _trace_event_controller; } duke@435: static jbyte trace_flags(int num) { return _trace_flags[num]; } duke@435: static jbyte event_trace_flags(int num) { return _event_trace_flags[num]; } duke@435: static const char* function_name(int num) { return _function_names[num]; } // To Do: add range checking duke@435: duke@435: static const char* event_name(int num) { duke@435: static char* ext_event_name = (char*)"(extension event)"; duke@435: if (num >= JVMTI_MIN_EVENT_TYPE_VAL && num <= JVMTI_MAX_EVENT_TYPE_VAL) { duke@435: return _event_names[num]; duke@435: } else { duke@435: return ext_event_name; duke@435: } duke@435: } duke@435: duke@435: static const char* enum_name(const char** names, const jint* values, jint value); duke@435: duke@435: static void initialize(); duke@435: static void shutdown(); duke@435: duke@435: // return a valid string no matter what state the thread is in duke@435: static const char *safe_get_thread_name(Thread *thread); duke@435: duke@435: // return the name of the current thread duke@435: static const char *safe_get_current_thread_name(); duke@435: duke@435: // return a valid string no matter what the state of k_mirror duke@435: static const char *get_class_name(oop k_mirror); duke@435: }; duke@435: duke@435: #endif /*JVMTI_TRACE */ stefank@2314: stefank@2314: #endif // SHARE_VM_PRIMS_JVMTITRACE_HPP