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