⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvmdi.h

📁 usbio Ver 2.40 source code!!! 做USB开发的值得
💻 H
📖 第 1 页 / 共 3 页
字号:
/*
 * @(#)jvmdi.h	1.47 03/01/23
 *
 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 *   Java Virtual Machine Debug Interface
 *
 *   Defines debugging functionality that a VM should provide.  
 *
 *   Should not overlap functionality in jni.h
 */

#ifndef _JAVASOFT_JVMDI_H_
#define _JAVASOFT_JVMDI_H_

#include "jni.h"

#define JVMDI_VERSION_1    0x20010000
#define JVMDI_VERSION_1_1  0x20010001
#define JVMDI_VERSION_1_2  0x20010002
#define JVMDI_VERSION_1_3  0x20010003

#ifdef __cplusplus
extern "C" {
#endif

typedef jobject jthread;

typedef jobject jthreadGroup;

struct _jframeID;
typedef struct _jframeID *jframeID;

  /* specifies program location "pc" - often byte code index */
typedef jlong jlocation;

  /* The jmethodID for methods that have been replaced */
  /* via RedefineClasses - used when the implementation */
  /* does not wish to retain replaced jmethodIDs */
#define OBSOLETE_METHOD_ID ((jmethodID)(NULL))

  /*
   *  Errors
   */

typedef jint jvmdiError;

  /* no error */
#define JVMDI_ERROR_NONE                 ((jvmdiError)0)

  /*
   * Errors on thread operations
   */

  /* invalid thread */
#define JVMDI_ERROR_INVALID_THREAD       ((jvmdiError)10)
  /* invalid thread group */
#define JVMDI_ERROR_INVALID_THREAD_GROUP ((jvmdiError)11)
  /* invalid thread priority */
#define JVMDI_ERROR_INVALID_PRIORITY     ((jvmdiError)12)
  /* thread not suspended */
#define JVMDI_ERROR_THREAD_NOT_SUSPENDED ((jvmdiError)13)
  /* thread already suspended */
#define JVMDI_ERROR_THREAD_SUSPENDED     ((jvmdiError)14)

  /* 
   * Errors on object and class operations
   */

  /* invalid object (implementation not required to gracefully catch) */
#define JVMDI_ERROR_INVALID_OBJECT       ((jvmdiError)20)
  /* invalid class (implementation not required to gracefully catch) */
#define JVMDI_ERROR_INVALID_CLASS        ((jvmdiError)21)
  /* class not prepared */
#define JVMDI_ERROR_CLASS_NOT_PREPARED   ((jvmdiError)22)
  /* invalid methodID (implementation not required to gracefully catch) */
#define JVMDI_ERROR_INVALID_METHODID     ((jvmdiError)23)
  /* invalid location */
#define JVMDI_ERROR_INVALID_LOCATION     ((jvmdiError)24)
  /* invalid fieldID (implementation not required to gracefully catch) */
#define JVMDI_ERROR_INVALID_FIELDID      ((jvmdiError)25)

  /*
   * Errors on frame operations
   */

  /* invalid frameID (implementation not required to gracefully catch) */
#define JVMDI_ERROR_INVALID_FRAMEID      ((jvmdiError)30)
  /* there are no more frames on the stack */
#define JVMDI_ERROR_NO_MORE_FRAMES       ((jvmdiError)31)
  /* operation cannot be performed on this frame */
#define JVMDI_ERROR_OPAQUE_FRAME         ((jvmdiError)32)
  /* operation can only be performed on current frame */
#define JVMDI_ERROR_NOT_CURRENT_FRAME    ((jvmdiError)33)
  /* type mismatch (implementation not required to gracefully catch) */
#define JVMDI_ERROR_TYPE_MISMATCH        ((jvmdiError)34)
  /* invalid slot */
#define JVMDI_ERROR_INVALID_SLOT         ((jvmdiError)35)

  /*
   * Errors on set/clear/find operations
   */

  /* item already present */
#define JVMDI_ERROR_DUPLICATE            ((jvmdiError)40)
  /* item not found */
#define JVMDI_ERROR_NOT_FOUND            ((jvmdiError)41)

  /*
   * Errors on monitor operations
   */

  /* invalid monitor */
#define JVMDI_ERROR_INVALID_MONITOR      ((jvmdiError)50)
  /* wait, notify, notify all tried without entering monitor  */
#define JVMDI_ERROR_NOT_MONITOR_OWNER    ((jvmdiError)51)
  /* waiting thread interrupted */
#define JVMDI_ERROR_INTERRUPT            ((jvmdiError)52)
  
  /*
   * Class redefinition / operand stack errors
   */

  /* The equivalent of ClassFormatError */
#define JVMDI_ERROR_INVALID_CLASS_FORMAT          ((jvmdiError)60)
  /* The equivalent of ClassCircularityError */
#define JVMDI_ERROR_CIRCULAR_CLASS_DEFINITION     ((jvmdiError)61)
  /* The class bytes fail verification */
#define JVMDI_ERROR_FAILS_VERIFICATION            ((jvmdiError)62)
  /* The new class version adds new methods */
  /* and can_add_method is false */
#define JVMDI_ERROR_ADD_METHOD_NOT_IMPLEMENTED    ((jvmdiError)63)
  /* The new class version changes fields */ 
  /* and can_unrestrictedly_redefine_classes is false */
#define JVMDI_ERROR_SCHEMA_CHANGE_NOT_IMPLEMENTED ((jvmdiError)64)
  /* bci/operand stack/local var combination is not verifiably */
  /* type safe */
#define JVMDI_ERROR_INVALID_TYPESTATE             ((jvmdiError)65)
  /* A direct superclass is different for the new class */
  /* version, or the set of directly implemented */
  /* interfaces is different */
  /* and can_unrestrictedly_redefine_classes is false */
#define JVMDI_ERROR_HIERARCHY_CHANGE_NOT_IMPLEMENTED ((jvmdiError)66)
  /* The new class version does not declare a method */
  /* declared in the old class version */
  /* and can_unrestrictedly_redefine_classes is false */
#define JVMDI_ERROR_DELETE_METHOD_NOT_IMPLEMENTED ((jvmdiError)67)
  /* A class file has a version number not supported */
  /* by this VM. */
#define JVMDI_ERROR_UNSUPPORTED_VERSION           ((jvmdiError)68)
  /* The class name defined in the new class file is */
  /* different from the name in the old class object */
#define JVMDI_ERROR_NAMES_DONT_MATCH              ((jvmdiError)69)
  /* The new class version has different modifiers and */
  /* can_unrestrictedly_redefine_classes is false */
#define JVMDI_ERROR_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED   ((jvmdiError)70)
  /* A method in the new class version has different modifiers */
  /* than its counterpart in the old class version */
  /* and can_unrestrictedly_redefine_classes is false */
#define JVMDI_ERROR_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED  ((jvmdiError)71)

  /*
   * Miscellaneous errors
   */

  /* Not yet implemented */
#define JVMDI_ERROR_NOT_IMPLEMENTED      ((jvmdiError)99)
  /* null pointer */
#define JVMDI_ERROR_NULL_POINTER         ((jvmdiError)100)
  /* information is absent */
#define JVMDI_ERROR_ABSENT_INFORMATION   ((jvmdiError)101)
  /* invalid event type  */
#define JVMDI_ERROR_INVALID_EVENT_TYPE   ((jvmdiError)102)
  /* invalid argument  */
#define JVMDI_ERROR_ILLEGAL_ARGUMENT     ((jvmdiError)103)

  /*
   * Universal errors. These errors may be returned by
   * any JVMDI function, not just the ones for which they are listed
   * below.
   */

  /* no more memory available for allocation */
#define JVMDI_ERROR_OUT_OF_MEMORY        ((jvmdiError)110)
  /* debugging has not been enabled in this VM */
#define JVMDI_ERROR_ACCESS_DENIED        ((jvmdiError)111)
  /* VM is dead (implementation not required to gracefully catch) */
#define JVMDI_ERROR_VM_DEAD              ((jvmdiError)112)
  /* internal error  */
#define JVMDI_ERROR_INTERNAL             ((jvmdiError)113)
  /* Thread calling JVMDI function not attached to VM */
#define JVMDI_ERROR_UNATTACHED_THREAD    ((jvmdiError)115)


  /*
   *  Threads
   */

  /* Thread status is unknown */
#define JVMDI_THREAD_STATUS_UNKNOWN      ((jint)-1)
  /* Thread is waiting to die */
#define JVMDI_THREAD_STATUS_ZOMBIE       ((jint)0)
  /* Thread is runnable */
#define JVMDI_THREAD_STATUS_RUNNING      ((jint)1)
  /* Thread is sleeping - Thread.sleep() or JVM_Sleep() was called */
#define JVMDI_THREAD_STATUS_SLEEPING     ((jint)2)
  /* Thread is waiting on a java monitor */
#define JVMDI_THREAD_STATUS_MONITOR      ((jint)3)
  /* Thread is waiting - Thread.wait() or JVM_MonitorWait() was called */
#define JVMDI_THREAD_STATUS_WAIT         ((jint)4)

  /* Thread is suspended - Thread.suspend(), JVM_Suspend() or
   * JVMDI_Suspend was called */
#define JVMDI_SUSPEND_STATUS_SUSPENDED   ((jint)0x1)
  /* Thread is at a breakpoint */
#define JVMDI_SUSPEND_STATUS_BREAK       ((jint)0x2)


  /* Thread priority constants */
#define JVMDI_THREAD_MIN_PRIORITY   ((jint)1)
#define JVMDI_THREAD_NORM_PRIORITY  ((jint)5)
#define JVMDI_THREAD_MAX_PRIORITY   ((jint)10)

typedef struct {
    char *name;
    jint  priority;
    jboolean is_daemon;
    jthreadGroup thread_group;
    jobject context_class_loader;
} JVMDI_thread_info;

typedef struct {
    jthreadGroup parent;
    char *name;
    jint  max_priority;
    jboolean is_daemon;
} JVMDI_thread_group_info;

#define JVMDI_DISABLE ((jint) 0)
#define JVMDI_ENABLE  ((jint) 1)

/*
 * Initial function for debug threads created through JVMDI
 */
typedef void (*JVMDI_StartFunction)(void *);

/*
 * Type for debug monitors created through JVMDI
 */
typedef void *JVMDI_RawMonitor;

#define JVMDI_MONITOR_WAIT_FOREVER ((jlong)(-1))

/*
 * Monitor information
 */
typedef struct {
    jthread owner;
    jint entry_count;
    jint waiter_count;
    jthread *waiters;
} JVMDI_monitor_info;

typedef struct {
    jint owned_monitor_count;
    jobject *owned_monitors;
} JVMDI_owned_monitor_info;

  /*
   *  Events
   */

    /* kind = JVMDI_EVENT_SINGLE_STEP */
    typedef struct { 
        jthread thread;
        jclass clazz;
        jmethodID method;
        jlocation location;
    } JVMDI_single_step_event_data;
			
    /* kind = JVMDI_EVENT_BREAKPOINT */
    typedef struct { 
        jthread thread;
        jclass clazz;
        jmethodID method;
        jlocation location;
    } JVMDI_breakpoint_event_data;
    
    /* kind = JVMDI_EVENT_FIELD_ACCESS */
    typedef struct { 
        jthread thread;
        jclass clazz;
        jmethodID method;
        jlocation location;
        jclass field_clazz;
        jobject object;
        jfieldID field;
    } JVMDI_field_access_event_data;
    
    /* kind = JVMDI_EVENT_FIELD_MODIFICATION */
    typedef struct { 
        jthread thread;
        jclass clazz;
        jmethodID method;
        jlocation location;
        jclass field_clazz;
        jobject object;
        jfieldID field;
        char signature_type;
        jvalue new_value;
    } JVMDI_field_modification_event_data;
    
    /* kind = JVMDI_EVENT_FRAME_POP */
    /* kind = JVMDI_EVENT_METHOD_ENTRY */
    /* kind = JVMDI_EVENT_METHOD_EXIT */
    typedef struct { 
        jthread thread;
        jclass clazz;
        jmethodID method;
        jframeID frame;
    } JVMDI_frame_event_data;
    
    /* kind = JVMDI_EVENT_EXCEPTION */
    typedef struct { 
        jthread thread;
        jclass clazz;
        jmethodID method;
        jlocation location;
        jobject exception;
        jclass catch_clazz;
        jmethodID catch_method;
        jlocation catch_location;
    } JVMDI_exception_event_data;
    
    /* kind = JVMDI_EVENT_EXCEPTION_CATCH */

⌨️ 快捷键说明

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