jvmtiexport.h

来自「This is a resource based on j2me embedde」· C头文件 代码 · 共 1,008 行 · 第 1/3 页

H
1,008
字号
/* * @(#)jvmtiExport.h	1.4 06/10/27 * * Copyright  1990-2008 Sun Microsystems, Inc. All Rights Reserved.   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER   *    * This program is free software; you can redistribute it and/or   * modify it under the terms of the GNU General Public License version   * 2 only, as published by the Free Software Foundation.    *    * This program is distributed in the hope that it will be useful, but   * WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   * General Public License version 2 for more details (a copy is   * included at /legal/license.txt).    *    * You should have received a copy of the GNU General Public License   * version 2 along with this work; if not, write to the Free Software   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA   * 02110-1301 USA    *    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa   * Clara, CA 95054 or visit www.sun.com if you need additional   * information or have any questions.  * */#ifndef _INCLUDED_JVMTIEXPORT_H#define _INCLUDED_JVMTIEXPORT_H#ifdef CVM_JVMTI#include "javavm/include/porting/ansi/stdio.h"#include "javavm/include/porting/ansi/stdlib.h"#include "javavm/include/defs.h"#include "javavm/export/jni.h"#include "javavm/export/jvmti.h"#include "javavm/include/jvmtiEnv.h"/* This class contains the JVMTI interface for the rest of CVM. *//* bits for standard events *//* TODO: This bit encoding assumes the availability of 64bit integers.  If 64bit   ints are implemented as structs in the porting layer, then this   implementation will need to be revised. */#define CVMjvmtiEvent2EventBit(x)   ((x) - JVMTI_MIN_EVENT_TYPE_VAL)#define CVMjvmtiEventBit(x)   CVMjvmtiEvent2EventBit(JVMTI_EVENT_##x)#define SINGLE_STEP_BIT \    (((jlong)1) << CVMjvmtiEventBit(SINGLE_STEP))#define	 FRAME_POP_BIT	\    (((jlong)1) << CVMjvmtiEventBit(FRAME_POP))#define	  BREAKPOINT_BIT \    (((jlong)1) << CVMjvmtiEventBit(BREAKPOINT))#define	  FIELD_ACCESS_BIT \    (((jlong)1) << CVMjvmtiEventBit(FIELD_ACCESS))#define	  FIELD_MODIFICATION_BIT \    (((jlong)1) << CVMjvmtiEventBit(FIELD_MODIFICATION))#define	  METHOD_ENTRY_BIT \    (((jlong)1) << CVMjvmtiEventBit(METHOD_ENTRY))#define	  METHOD_EXIT_BIT \    (((jlong)1) << CVMjvmtiEventBit(METHOD_EXIT))#define	  CLASS_FILE_LOAD_HOOK_BIT \    (((jlong)1) << CVMjvmtiEventBit(CLASS_FILE_LOAD_HOOK))#define	  NATIVE_METHOD_BIND_BIT \    (((jlong)1) << CVMjvmtiEventBit(NATIVE_METHOD_BIND))#define	  VM_START_BIT \    (((jlong)1) << CVMjvmtiEventBit(VM_START))#define	  VM_INIT_BIT \    (((jlong)1) << CVMjvmtiEventBit(VM_INIT))#define	  VM_DEATH_BIT \    (((jlong)1) << CVMjvmtiEventBit(VM_DEATH))#define	  CLASS_LOAD_BIT \    (((jlong)1) << CVMjvmtiEventBit(CLASS_LOAD))#define	  CLASS_PREPARE_BIT \    (((jlong)1) << CVMjvmtiEventBit(CLASS_PREPARE))#define	  THREAD_START_BIT \    (((jlong)1) << CVMjvmtiEventBit(THREAD_START))#define	  THREAD_END_BIT \    (((jlong)1) << CVMjvmtiEventBit(THREAD_END))#define	  EXCEPTION_THROW_BIT \    (((jlong)1) << CVMjvmtiEventBit(EXCEPTION))#define	  EXCEPTION_CATCH_BIT \    (((jlong)1) << CVMjvmtiEventBit(EXCEPTION_CATCH))#define	  MONITOR_CONTENDED_ENTER_BIT \    (((jlong)1) << CVMjvmtiEventBit(MONITOR_CONTENDED_ENTER))#define	  MONITOR_CONTENDED_ENTERED_BIT \    (((jlong)1) << CVMjvmtiEventBit(MONITOR_CONTENDED_ENTERED))#define	  MONITOR_WAIT_BIT \    (((jlong)1) << CVMjvmtiEventBit(MONITOR_WAIT))#define	  MONITOR_WAITED_BIT \    (((jlong)1) << CVMjvmtiEventBit(MONITOR_WAITED))#define	  DYNAMIC_CODE_GENERATED_BIT \    (((jlong)1) << CVMjvmtiEventBit(DYNAMIC_CODE_GENERATED))#define	  DATA_DUMP_BIT \    (((jlong)1) << CVMjvmtiEventBit(DATA_DUMP_REQUEST))#define	  COMPILED_METHOD_LOAD_BIT \    (((jlong)1) << CVMjvmtiEventBit(COMPILED_METHOD_LOAD))#define	  COMPILED_METHOD_UNLOAD_BIT \    (((jlong)1) << CVMjvmtiEventBit(COMPILED_METHOD_UNLOAD))#define	  GARBAGE_COLLECTION_START_BIT \    (((jlong)1) << CVMjvmtiEventBit(GARBAGE_COLLECTION_START))#define	  GARBAGE_COLLECTION_FINISH_BIT \    (((jlong)1) << CVMjvmtiEventBit(GARBAGE_COLLECTION_FINISH))#define	  OBJECT_FREE_BIT \    (((jlong)1) << CVMjvmtiEventBit(OBJECT_FREE))#define	  VM_OBJECT_ALLOC_BIT \    (((jlong)1) << CVMjvmtiEventBit(VM_OBJECT_ALLOC))/* Bit masks for groups of JVMTI events: */#define	 MONITOR_BITS \    (MONITOR_CONTENDED_ENTER_BIT | MONITOR_CONTENDED_ENTERED_BIT | \        MONITOR_WAIT_BIT | MONITOR_WAITED_BIT)#define	 EXCEPTION_BITS \    (EXCEPTION_THROW_BIT | EXCEPTION_CATCH_BIT)#define	 INTERP_EVENT_BITS \    (SINGLE_STEP_BIT | METHOD_ENTRY_BIT | METHOD_EXIT_BIT | \        FRAME_POP_BIT | FIELD_ACCESS_BIT | FIELD_MODIFICATION_BIT)#define	 THREAD_FILTERED_EVENT_BITS \    (INTERP_EVENT_BITS | EXCEPTION_BITS | MONITOR_BITS | \        BREAKPOINT_BIT | CLASS_LOAD_BIT | CLASS_PREPARE_BIT | THREAD_END_BIT)#define NEED_THREAD_LIFE_EVENTS \    (THREAD_FILTERED_EVENT_BITS | THREAD_START_BIT)#define	 EARLY_EVENT_BITS \    (CLASS_FILE_LOAD_HOOK_BIT | VM_START_BIT | VM_INIT_BIT | VM_DEATH_BIT | \        NATIVE_METHOD_BIND_BIT | THREAD_START_BIT | THREAD_END_BIT | \        DYNAMIC_CODE_GENERATED_BIT;)typedef struct CVMJvmtiThreadNode CVMJvmtiThreadNode;struct CVMJvmtiThreadNode {    CVMObjectICell* thread;        /* Global root; always allocated */    jobject lastDetectedException; /* JNI Global Ref; allocated in                                      CVMjvmtiPostExceptionEvent */    jvmtiStartFunction startFunction;  /* for debug threads only */    const void *startFunctionArg;      /* for debug threads only */    CVMJvmtiContext *context;    void *jvmtiPrivateData;    /* JVMTI thread-local data. */    CVMClassBlock *oldCb;       /* current class being redefined */    CVMClassBlock *redefineCb;  /* new classblock of redefined class */    CVMBool startEventSent;    CVMJvmtiThreadNode *next;};typedef struct CVMJvmtiGlobals CVMJvmtiGlobals;struct CVMJvmtiGlobals {    /* The following struct is based on JDK HotSpot's _jvmtiExports struct: */    struct {	int             fieldAccessCount;	int             fieldModificationCount;	jboolean        canGetSourceDebugExtension;	jboolean        canExamineOrDeoptAnywhere;	jboolean        canMaintainOriginalMethodOrder;	jboolean        canPostInterpreterEvents;	jboolean        canHotswapOrPostBreakpoint;	jboolean        canModifyAnyClass;	jboolean        canWalkAnySpace;	jboolean        canAccessLocalVariables;	jboolean        canPostExceptions;	jboolean        canPostBreakpoint;	jboolean        canPostFieldAccess;	jboolean        canPostFieldModification;	jboolean        canPostMethodEntry;	jboolean        canPostMethodExit;	jboolean        canPopFrame;	jboolean        canForceEarlyReturn;	jboolean        shouldPostSingleStep;	jboolean        shouldPostFieldAccess;	jboolean        shouldPostFieldModification;	jboolean        shouldPostClassLoad;	jboolean        shouldPostClassPrepare;	jboolean        shouldPostClassUnload;	jboolean        shouldPostClassFileLoadHook;	jboolean        shouldPostNativeMethodBind;	jboolean        shouldPostCompiledMethodLoad;	jboolean        shouldPostCompiledMethodUnload;	jboolean        shouldPostDynamicCodeGenerated;	jboolean        shouldPostMonitorContendedEnter;	jboolean        shouldPostMonitorContendedEntered;	jboolean        shouldPostMonitorWait;	jboolean        shouldPostMonitorWaited;	jboolean        shouldPostDataDump;	jboolean        shouldPostGarbageCollectionStart;	jboolean        shouldPostGarbageCollectionFinish;	jboolean        shouldPostThreadLife;	jboolean        shouldPostObjectFree;	jboolean        shouldCleanUpHeapObjects;	jboolean        shouldPostVmObjectAlloc;    	jboolean        hasRedefinedAClass;	jboolean        allDependenciesAreRecorded;    } exports;    CVMBool dataDumpRequested;    CVMBool isEnabled;    CVMBool isInDebugMode;    CVMBool debugOptionSet;  /* -Xdebug option passed in */    /* Are one or more fields being watched?     * These flags are accessed by the interpreter to determine if     * jvmti should be notified.     */    CVMBool isWatchingFieldAccess;    CVMBool isWatchingFieldModification;    /* The following struct isfor storing statics used by the JVMTI       implementation: */    struct {	/* event hooks, etc */	JavaVM* vm;	/* Not used:         jvmtiEventCallbacks *eventHook;	JVMTIAllocHook allocHook;	JVMTIDeallocHook deallocHook; 	*/	struct CVMBag* breakpoints;	struct CVMBag* framePops;	struct CVMBag* watchedFieldModifications;	struct CVMBag* watchedFieldAccesses;	volatile CVMJvmtiThreadNode *threadList;	CVMJvmtiContext *context;	/* From jvmtiExport.c */	jvmtiPhase currentPhase;	/* Not used:        jlong      clks_per_sec;        CVMBool    debuggerConnected = CVM_FALSE;	CVMUint32  uniqueId = 0x10000;	*/	CVMJvmtiMethodNode *nodeByMB[HASH_SLOT_COUNT];	/* From jvmtiEnv.c: */	/* Not used:	CVMJvmtiContext *RetransformableEnvironments;	CVMJvmtiContext *NonRetransformableEnvironments;	*/	/* Used in jvmti_GetThreadInfo(): */	jfieldID nameID;	jfieldID priorityID;	jfieldID daemonID;	jfieldID groupID;	jfieldID loaderID;	/* Used in jvmti_GetThreadGroupInfo(): */	jfieldID tgParentID;	jfieldID tgNameID;	jfieldID tgMaxPriorityID;	jfieldID tgDaemonID;	/* Used in jvmti_GetThreadGroupChildren(): */	jfieldID nthreadsID;	jfieldID threadsID;	jfieldID ngroupsID;	jfieldID groupsID;	/* For Heap functions in jvmtiEnv.c: */	CVMJvmtiVisitStack currentStack; /* for Heap functions. */	CVMJvmtiTagNode *romObjects[HASH_SLOT_COUNT];	/* From jvmtiDumper.c: */	CVMJvmtiTagNode *objectsByRef[HASH_SLOT_COUNT];    } statics;    /* From jvmtiCapabilities.c: */    struct {	/* capabilities which are always potentially available */	jvmtiCapabilities always;	/* capabilities which are potentially available during OnLoad */	jvmtiCapabilities onload;	/* capabilities which are always potentially available */	/* but to only one environment */	jvmtiCapabilities always_solo;	/* capabilities which are potentially available during OnLoad */	/* but to only one environment */	jvmtiCapabilities onload_solo;	/* remaining capabilities which are always potentially available */	/* but to only one environment */	jvmtiCapabilities always_solo_remaining;	/* remaining capabilities which are potentially available during	 * OnLoad but to only one environment */	jvmtiCapabilities onload_solo_remaining;	/* all capabilities ever acquired */	jvmtiCapabilities acquired;    } capabilities;};/* The following functions are implemented as macros so that they can be   inlined:   NOTE: can* conditions (below) are set at OnLoad and never changed. */void CVMjvmtiSetCanGetSourceDebugExtension(jboolean on);#define CVMjvmtiSetCanGetSourceDebugExtension(on_) \    (CVMglobals.jvmti.exports.canGetSourceDebugExtension = (on_))void CVMjvmtiSetCanExamineOrDeoptAnywhere(jboolean on);#define CVMjvmtiSetCanExamineOrDeoptAnywhere(on_) \    (CVMglobals.jvmti.exports.canExamineOrDeoptAnywhere = (on_))void CVMjvmtiSetCanMaintainOriginalMethodOrder(jboolean on);#define CVMjvmtiSetCanMaintainOriginalMethodOrder(on_) \    (CVMglobals.jvmti.exports.canMaintainOriginalMethodOrder = (on_))void CVMjvmtiSetCanPostInterpreterEvents(jboolean on);#define CVMjvmtiSetCanPostInterpreterEvents(on_) \    (CVMglobals.jvmti.exports.canPostInterpreterEvents = (on_))void CVMjvmtiSetCanHotswapOrPostBreakpoint(jboolean on);#define CVMjvmtiSetCanHotswapOrPostBreakpoint(on_) \    (CVMglobals.jvmti.exports.canHotswapOrPostBreakpoint = (on_));void CVMjvmtiSetCanModifyAnyClass(jboolean on);#define CVMjvmtiSetCanModifyAnyClass(on_) \    (CVMglobals.jvmti.exports.canModifyAnyClass = (on_))void CVMjvmtiSetCanWalkAnySpace(jboolean on);#define CVMjvmtiSetCanWalkAnySpace(on_) \    (CVMglobals.jvmti.exports.canWalkAnySpace = (on_))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?