From 7be218c7648656b95418709c7086a97955ca84cf Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Wed, 25 Aug 2021 11:36:00 +0800 Subject: [PATCH] update head files (#1898) --- .../main/native/head/classfile_constants.h | 72 ++-- arthas-vmtool/src/main/native/head/jawt.h | 131 +++++-- .../src/main/native/head/jdwpTransport.h | 55 +-- arthas-vmtool/src/main/native/head/jni.h | 63 +++- arthas-vmtool/src/main/native/head/jvmti.h | 319 +++++++++++------- .../src/main/native/head/jvmticmlr.h | 42 +-- .../src/main/native/head/linux/jawt_md.h | 43 ++- .../src/main/native/head/linux/jni_md.h | 67 ++-- .../src/main/native/head/macos/jawt_md.h | 44 +-- .../src/main/native/head/macos/jni_md.h | 44 +-- .../head/windows/AccessBridgeCallbacks.h | 48 ++- .../native/head/windows/AccessBridgeCalls.c | 53 ++- .../native/head/windows/AccessBridgeCalls.h | 43 ++- .../head/windows/AccessBridgePackages.h | 36 +- .../src/main/native/head/windows/jawt_md.h | 42 +-- .../src/main/native/head/windows/jni_md.h | 49 +-- 16 files changed, 701 insertions(+), 450 deletions(-) diff --git a/arthas-vmtool/src/main/native/head/classfile_constants.h b/arthas-vmtool/src/main/native/head/classfile_constants.h index e5c20cd9a..cca9832f8 100755 --- a/arthas-vmtool/src/main/native/head/classfile_constants.h +++ b/arthas-vmtool/src/main/native/head/classfile_constants.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * + * This code 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 in the LICENSE file that + * accompanied this code). * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef CLASSFILE_CONSTANTS_H @@ -31,7 +31,7 @@ extern "C" { #endif /* Classfile version number for this information */ -#define JVM_CLASSFILE_MAJOR_VERSION 52 +#define JVM_CLASSFILE_MAJOR_VERSION 60 #define JVM_CLASSFILE_MINOR_VERSION 0 /* Flags */ @@ -54,9 +54,29 @@ enum { JVM_ACC_STRICT = 0x0800, JVM_ACC_SYNTHETIC = 0x1000, JVM_ACC_ANNOTATION = 0x2000, - JVM_ACC_ENUM = 0x4000 + JVM_ACC_ENUM = 0x4000, + JVM_ACC_MODULE = 0x8000 }; +#define JVM_ACC_PUBLIC_BIT 0 +#define JVM_ACC_PRIVATE_BIT 1 +#define JVM_ACC_PROTECTED_BIT 2 +#define JVM_ACC_STATIC_BIT 3 +#define JVM_ACC_FINAL_BIT 4 +#define JVM_ACC_SYNCHRONIZED_BIT 5 +#define JVM_ACC_SUPER_BIT 5 +#define JVM_ACC_VOLATILE_BIT 6 +#define JVM_ACC_BRIDGE_BIT 6 +#define JVM_ACC_TRANSIENT_BIT 7 +#define JVM_ACC_VARARGS_BIT 7 +#define JVM_ACC_NATIVE_BIT 8 +#define JVM_ACC_INTERFACE_BIT 9 +#define JVM_ACC_ABSTRACT_BIT 10 +#define JVM_ACC_STRICT_BIT 11 +#define JVM_ACC_SYNTHETIC_BIT 12 +#define JVM_ACC_ANNOTATION_BIT 13 +#define JVM_ACC_ENUM_BIT 14 + /* Used in newarray instruction. */ enum { @@ -86,8 +106,12 @@ enum { JVM_CONSTANT_InterfaceMethodref = 11, JVM_CONSTANT_NameAndType = 12, JVM_CONSTANT_MethodHandle = 15, // JSR 292 - JVM_CONSTANT_MethodType = 16, // JSR 292 - JVM_CONSTANT_InvokeDynamic = 18 + JVM_CONSTANT_MethodType = 16, // JSR 292 + JVM_CONSTANT_Dynamic = 17, + JVM_CONSTANT_InvokeDynamic = 18, + JVM_CONSTANT_Module = 19, + JVM_CONSTANT_Package = 20, + JVM_CONSTANT_ExternalMax = 20 }; /* JVM_CONSTANT_MethodHandle subtypes */ @@ -120,6 +144,10 @@ enum { /* Type signatures */ enum { + JVM_SIGNATURE_SLASH = '/', + JVM_SIGNATURE_DOT = '.', + JVM_SIGNATURE_SPECIAL = '<', + JVM_SIGNATURE_ENDSPECIAL = '>', JVM_SIGNATURE_ARRAY = '[', JVM_SIGNATURE_BYTE = 'B', JVM_SIGNATURE_CHAR = 'C', diff --git a/arthas-vmtool/src/main/native/head/jawt.h b/arthas-vmtool/src/main/native/head/jawt.h index f06e80713..2079b0bc1 100755 --- a/arthas-vmtool/src/main/native/head/jawt.h +++ b/arthas-vmtool/src/main/native/head/jawt.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JAWT_H_ @@ -33,23 +33,27 @@ extern "C" { #endif /* - * AWT native interface (new in JDK 1.3) + * AWT native interface. * * The AWT native interface allows a native C or C++ application a means * by which to access native structures in AWT. This is to facilitate moving * legacy C and C++ applications to Java and to target the needs of the - * community who, at present, wish to do their own native rendering to canvases - * for performance reasons. Standard extensions such as Java3D also require a - * means to access the underlying native data structures of AWT. + * developers who need to do their own native rendering to canvases + * for performance or other reasons. * - * There may be future extensions to this API depending on demand. + * Conversely it also provides mechanisms for an application which already + * has a native window to provide that to AWT for AWT rendering. * - * A VM does not have to implement this API in order to pass the JCK. - * It is recommended, however, that this API is implemented on VMs that support - * standard extensions, such as Java3D. + * Since every platform may be different in its native data structures + * and APIs for windowing systems the application must necessarily + * provided per-platform source and compile and deliver per-platform + * native code to use this API. + * + * These interfaces are not part of the Java SE specification and + * a VM is not required to implement this API. However it is strongly + * recommended that all implementations which support headful AWT + * also support these interfaces. * - * Since this is a native API, any program which uses it cannot be considered - * 100% pure java. */ /* @@ -58,7 +62,7 @@ extern "C" { * For each platform, there is a native drawing surface structure. This * platform-specific structure can be found in jawt_md.h. It is recommended * that additional platforms follow the same model. It is also recommended - * that VMs on Win32 and Solaris support the existing structures in jawt_md.h. + * that VMs on all platforms support the existing structures in jawt_md.h. * ******************* * EXAMPLE OF USAGE: @@ -98,8 +102,8 @@ extern "C" { * jboolean result; * jint lock; * - * // Get the AWT - * awt.version = JAWT_VERSION_1_3; + * // Get the AWT. Request version 9 to access features in that release. + * awt.version = JAWT_VERSION_9; * result = JAWT_GetAWT(env, &awt); * assert(result != JNI_FALSE); * @@ -154,7 +158,7 @@ typedef struct jawt_DrawingSurfaceInfo { /* * Pointer to the platform-specific information. This can be safely * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a - * JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a + * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On Mac OS X this is a * pointer to a NSObject that conforms to the JAWT_SurfaceLayers * protocol. See jawt_md.h for details. */ @@ -237,7 +241,8 @@ typedef struct jawt_DrawingSurface { typedef struct jawt { /* * Version of this structure. This must always be set before - * calling JAWT_GetAWT() + * calling JAWT_GetAWT(). It affects the functions returned. + * Must be one of the known pre-defined versions. */ jint version; /* @@ -279,6 +284,50 @@ typedef struct jawt { */ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); + /** + * Since 9 + * Creates a java.awt.Frame placed in a native container. Container is + * referenced by the native platform handle. For example on Windows this + * corresponds to an HWND. For other platforms, see the appropriate + * machine-dependent header file for a description. The reference returned + * by this function is a local reference that is only valid in this + * environment. This function returns a NULL reference if no frame could be + * created with matching platform information. + */ + jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo); + + /** + * Since 9 + * Moves and resizes the embedded frame. The new location of the top-left + * corner is specified by x and y parameters relative to the native parent + * component. The new size is specified by width and height. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + * + * java.awt.Component.setLocation() and java.awt.Component.setBounds() for + * EmbeddedFrame really don't move it within the native parent. These + * methods always locate the embedded frame at (0, 0) for backward + * compatibility. To allow moving embedded frames this method was + * introduced, and it works just the same way as setLocation() and + * setBounds() for usual, non-embedded components. + * + * Using usual get/setLocation() and get/setBounds() together with this new + * method is not recommended. + */ + void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame, + jint x, jint y, jint w, jint h); + /** + * Since 9 + * Synthesize a native message to activate or deactivate an EmbeddedFrame + * window depending on the value of parameter doActivate, if "true" + * activates the window; otherwise, deactivates the window. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + */ + void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env, + jobject embeddedFrame, jboolean doActivate); } JAWT; /* @@ -288,9 +337,17 @@ typedef struct jawt { _JNI_IMPORT_OR_EXPORT_ jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); +/* + * Specify one of these constants as the JAWT.version + * Specifying an earlier version will limit the available functions to + * those provided in that earlier version of JAWT. + * See the "Since" note on each API. Methods with no "Since" + * may be presumed to be present in JAWT_VERSION_1_3. + */ #define JAWT_VERSION_1_3 0x00010003 #define JAWT_VERSION_1_4 0x00010004 #define JAWT_VERSION_1_7 0x00010007 +#define JAWT_VERSION_9 0x00090000 #ifdef __cplusplus } /* extern "C" */ diff --git a/arthas-vmtool/src/main/native/head/jdwpTransport.h b/arthas-vmtool/src/main/native/head/jdwpTransport.h index 4f4b92ede..cdbd04d42 100755 --- a/arthas-vmtool/src/main/native/head/jdwpTransport.h +++ b/arthas-vmtool/src/main/native/head/jdwpTransport.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * + * This code 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 in the LICENSE file that + * accompanied this code). * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ /* @@ -33,7 +33,8 @@ #include "jni.h" enum { - JDWPTRANSPORT_VERSION_1_0 = 0x00010000 + JDWPTRANSPORT_VERSION_1_0 = 0x00010000, + JDWPTRANSPORT_VERSION_1_1 = 0x00010001 }; #ifdef __cplusplus @@ -95,6 +96,8 @@ typedef struct { * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html */ +#define JDWP_HEADER_SIZE 11 + enum { /* * If additional flags are added that apply to jdwpCmdPacket, @@ -142,6 +145,13 @@ typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm, jint version, jdwpTransportEnv** env); +/* + * JDWP transport configuration from the agent. + */ +typedef struct jdwpTransportConfiguration { + /* Field added in JDWPTRANSPORT_VERSION_1_1: */ + const char* allowed_peers; /* Peers allowed for connection */ +} jdwpTransportConfiguration; /* Function Interface */ @@ -191,6 +201,9 @@ struct jdwpTransportNativeInterface_ { jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env, char** error); + /* 12: SetTransportConfiguration added in JDWPTRANSPORT_VERSION_1_1 */ + jdwpTransportError (JNICALL *SetTransportConfiguration)(jdwpTransportEnv* env, + jdwpTransportConfiguration *config); }; @@ -248,6 +261,10 @@ struct _jdwpTransportEnv { return functions->GetLastError(this, error); } + /* SetTransportConfiguration added in JDWPTRANSPORT_VERSION_1_1 */ + jdwpTransportError SetTransportConfiguration(jdwpTransportEnv* env, + return functions->SetTransportConfiguration(this, config); + } #endif /* __cplusplus */ }; diff --git a/arthas-vmtool/src/main/native/head/jni.h b/arthas-vmtool/src/main/native/head/jni.h index 0ffe244b6..aa0cdf5c2 100755 --- a/arthas-vmtool/src/main/native/head/jni.h +++ b/arthas-vmtool/src/main/native/head/jni.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * + * This code 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 in the LICENSE file that + * accompanied this code). * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ /* @@ -765,6 +765,11 @@ struct JNINativeInterface_ { jobjectRefType (JNICALL *GetObjectRefType) (JNIEnv* env, jobject obj); + + /* Module Features */ + + jobject (JNICALL *GetModule) + (JNIEnv* env, jclass clazz); }; /* @@ -1857,9 +1862,29 @@ struct JNIEnv_ { return functions->GetObjectRefType(this, obj); } + /* Module Features */ + + jobject GetModule(jclass clazz) { + return functions->GetModule(this, clazz); + } + #endif /* __cplusplus */ }; +/* + * optionString may be any option accepted by the JVM, or one of the + * following: + * + * -D= Set a system property. + * -verbose[:class|gc|jni] Enable verbose output, comma-separated. E.g. + * "-verbose:class" or "-verbose:gc,class" + * Standard names include: gc, class, and jni. + * All nonstandard (VM-specific) names must begin + * with "X". + * vfprintf extraInfo is a pointer to the vfprintf hook. + * exit extraInfo is a pointer to the exit hook. + * abort extraInfo is a pointer to the abort hook. + */ typedef struct JavaVMOption { char *optionString; void *extraInfo; @@ -1952,6 +1977,8 @@ JNI_OnUnload(JavaVM *vm, void *reserved); #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 #define JNI_VERSION_1_8 0x00010008 +#define JNI_VERSION_9 0x00090000 +#define JNI_VERSION_10 0x000a0000 #ifdef __cplusplus } /* extern "C" */ diff --git a/arthas-vmtool/src/main/native/head/jvmti.h b/arthas-vmtool/src/main/native/head/jvmti.h index 74243f540..87df35ae5 100755 --- a/arthas-vmtool/src/main/native/head/jvmti.h +++ b/arthas-vmtool/src/main/native/head/jvmti.h @@ -1,30 +1,29 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * + * This code 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 in the LICENSE file that + * accompanied this code). * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ - /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ - + /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ /* Include file for the Java(tm) Virtual Machine Tool Interface */ @@ -42,8 +41,10 @@ enum { JVMTI_VERSION_1_0 = 0x30010000, JVMTI_VERSION_1_1 = 0x30010100, JVMTI_VERSION_1_2 = 0x30010200, + JVMTI_VERSION_9 = 0x30090000, + JVMTI_VERSION_11 = 0x300B0000, - JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (2 * 0x100) + 1 /* version: 1.2.1 */ + JVMTI_VERSION = 0x30000000 + (16 * 0x10000) + ( 0 * 0x100) + 0 /* version: 16.0.0 */ }; JNIEXPORT jint JNICALL @@ -348,6 +349,7 @@ typedef enum { JVMTI_ERROR_INVALID_METHODID = 23, JVMTI_ERROR_INVALID_LOCATION = 24, JVMTI_ERROR_INVALID_FIELDID = 25, + JVMTI_ERROR_INVALID_MODULE = 26, JVMTI_ERROR_NO_MORE_FRAMES = 31, JVMTI_ERROR_OPAQUE_FRAME = 32, JVMTI_ERROR_TYPE_MISMATCH = 34, @@ -369,7 +371,9 @@ typedef enum { JVMTI_ERROR_NAMES_DONT_MATCH = 69, JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70, JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED = 72, JVMTI_ERROR_UNMODIFIABLE_CLASS = 79, + JVMTI_ERROR_UNMODIFIABLE_MODULE = 80, JVMTI_ERROR_NOT_AVAILABLE = 98, JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99, JVMTI_ERROR_NULL_POINTER = 100, @@ -422,55 +426,56 @@ typedef enum { JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82, JVMTI_EVENT_OBJECT_FREE = 83, JVMTI_EVENT_VM_OBJECT_ALLOC = 84, - JVMTI_MAX_EVENT_TYPE_VAL = 84 + JVMTI_EVENT_SAMPLED_OBJECT_ALLOC = 86, + JVMTI_MAX_EVENT_TYPE_VAL = 86 } jvmtiEvent; /* Pre-Declarations */ -struct _jvmtiThreadInfo; -typedef struct _jvmtiThreadInfo jvmtiThreadInfo; -struct _jvmtiMonitorStackDepthInfo; -typedef struct _jvmtiMonitorStackDepthInfo jvmtiMonitorStackDepthInfo; -struct _jvmtiThreadGroupInfo; -typedef struct _jvmtiThreadGroupInfo jvmtiThreadGroupInfo; -struct _jvmtiFrameInfo; -typedef struct _jvmtiFrameInfo jvmtiFrameInfo; -struct _jvmtiStackInfo; -typedef struct _jvmtiStackInfo jvmtiStackInfo; -struct _jvmtiHeapReferenceInfoField; -typedef struct _jvmtiHeapReferenceInfoField jvmtiHeapReferenceInfoField; -struct _jvmtiHeapReferenceInfoArray; -typedef struct _jvmtiHeapReferenceInfoArray jvmtiHeapReferenceInfoArray; -struct _jvmtiHeapReferenceInfoConstantPool; -typedef struct _jvmtiHeapReferenceInfoConstantPool jvmtiHeapReferenceInfoConstantPool; -struct _jvmtiHeapReferenceInfoStackLocal; -typedef struct _jvmtiHeapReferenceInfoStackLocal jvmtiHeapReferenceInfoStackLocal; -struct _jvmtiHeapReferenceInfoJniLocal; -typedef struct _jvmtiHeapReferenceInfoJniLocal jvmtiHeapReferenceInfoJniLocal; -struct _jvmtiHeapReferenceInfoReserved; -typedef struct _jvmtiHeapReferenceInfoReserved jvmtiHeapReferenceInfoReserved; -union _jvmtiHeapReferenceInfo; -typedef union _jvmtiHeapReferenceInfo jvmtiHeapReferenceInfo; -struct _jvmtiHeapCallbacks; -typedef struct _jvmtiHeapCallbacks jvmtiHeapCallbacks; -struct _jvmtiClassDefinition; -typedef struct _jvmtiClassDefinition jvmtiClassDefinition; -struct _jvmtiMonitorUsage; -typedef struct _jvmtiMonitorUsage jvmtiMonitorUsage; -struct _jvmtiLineNumberEntry; -typedef struct _jvmtiLineNumberEntry jvmtiLineNumberEntry; -struct _jvmtiLocalVariableEntry; -typedef struct _jvmtiLocalVariableEntry jvmtiLocalVariableEntry; -struct _jvmtiParamInfo; -typedef struct _jvmtiParamInfo jvmtiParamInfo; -struct _jvmtiExtensionFunctionInfo; -typedef struct _jvmtiExtensionFunctionInfo jvmtiExtensionFunctionInfo; -struct _jvmtiExtensionEventInfo; -typedef struct _jvmtiExtensionEventInfo jvmtiExtensionEventInfo; -struct _jvmtiTimerInfo; -typedef struct _jvmtiTimerInfo jvmtiTimerInfo; -struct _jvmtiAddrLocationMap; -typedef struct _jvmtiAddrLocationMap jvmtiAddrLocationMap; +struct jvmtiThreadInfo; +typedef struct jvmtiThreadInfo jvmtiThreadInfo; +struct jvmtiMonitorStackDepthInfo; +typedef struct jvmtiMonitorStackDepthInfo jvmtiMonitorStackDepthInfo; +struct jvmtiThreadGroupInfo; +typedef struct jvmtiThreadGroupInfo jvmtiThreadGroupInfo; +struct jvmtiFrameInfo; +typedef struct jvmtiFrameInfo jvmtiFrameInfo; +struct jvmtiStackInfo; +typedef struct jvmtiStackInfo jvmtiStackInfo; +struct jvmtiHeapReferenceInfoField; +typedef struct jvmtiHeapReferenceInfoField jvmtiHeapReferenceInfoField; +struct jvmtiHeapReferenceInfoArray; +typedef struct jvmtiHeapReferenceInfoArray jvmtiHeapReferenceInfoArray; +struct jvmtiHeapReferenceInfoConstantPool; +typedef struct jvmtiHeapReferenceInfoConstantPool jvmtiHeapReferenceInfoConstantPool; +struct jvmtiHeapReferenceInfoStackLocal; +typedef struct jvmtiHeapReferenceInfoStackLocal jvmtiHeapReferenceInfoStackLocal; +struct jvmtiHeapReferenceInfoJniLocal; +typedef struct jvmtiHeapReferenceInfoJniLocal jvmtiHeapReferenceInfoJniLocal; +struct jvmtiHeapReferenceInfoReserved; +typedef struct jvmtiHeapReferenceInfoReserved jvmtiHeapReferenceInfoReserved; +union jvmtiHeapReferenceInfo; +typedef union jvmtiHeapReferenceInfo jvmtiHeapReferenceInfo; +struct jvmtiHeapCallbacks; +typedef struct jvmtiHeapCallbacks jvmtiHeapCallbacks; +struct jvmtiClassDefinition; +typedef struct jvmtiClassDefinition jvmtiClassDefinition; +struct jvmtiMonitorUsage; +typedef struct jvmtiMonitorUsage jvmtiMonitorUsage; +struct jvmtiLineNumberEntry; +typedef struct jvmtiLineNumberEntry jvmtiLineNumberEntry; +struct jvmtiLocalVariableEntry; +typedef struct jvmtiLocalVariableEntry jvmtiLocalVariableEntry; +struct jvmtiParamInfo; +typedef struct jvmtiParamInfo jvmtiParamInfo; +struct jvmtiExtensionFunctionInfo; +typedef struct jvmtiExtensionFunctionInfo jvmtiExtensionFunctionInfo; +struct jvmtiExtensionEventInfo; +typedef struct jvmtiExtensionEventInfo jvmtiExtensionEventInfo; +struct jvmtiTimerInfo; +typedef struct jvmtiTimerInfo jvmtiTimerInfo; +struct jvmtiAddrLocationMap; +typedef struct jvmtiAddrLocationMap jvmtiAddrLocationMap; /* Function Types */ @@ -515,43 +520,43 @@ typedef void (JNICALL *jvmtiExtensionEvent) /* Structure Types */ -struct _jvmtiThreadInfo { +struct jvmtiThreadInfo { char* name; jint priority; jboolean is_daemon; jthreadGroup thread_group; jobject context_class_loader; }; -struct _jvmtiMonitorStackDepthInfo { +struct jvmtiMonitorStackDepthInfo { jobject monitor; jint stack_depth; }; -struct _jvmtiThreadGroupInfo { +struct jvmtiThreadGroupInfo { jthreadGroup parent; char* name; jint max_priority; jboolean is_daemon; }; -struct _jvmtiFrameInfo { +struct jvmtiFrameInfo { jmethodID method; jlocation location; }; -struct _jvmtiStackInfo { +struct jvmtiStackInfo { jthread thread; jint state; jvmtiFrameInfo* frame_buffer; jint frame_count; }; -struct _jvmtiHeapReferenceInfoField { +struct jvmtiHeapReferenceInfoField { jint index; }; -struct _jvmtiHeapReferenceInfoArray { +struct jvmtiHeapReferenceInfoArray { jint index; }; -struct _jvmtiHeapReferenceInfoConstantPool { +struct jvmtiHeapReferenceInfoConstantPool { jint index; }; -struct _jvmtiHeapReferenceInfoStackLocal { +struct jvmtiHeapReferenceInfoStackLocal { jlong thread_tag; jlong thread_id; jint depth; @@ -559,13 +564,13 @@ struct _jvmtiHeapReferenceInfoStackLocal { jlocation location; jint slot; }; -struct _jvmtiHeapReferenceInfoJniLocal { +struct jvmtiHeapReferenceInfoJniLocal { jlong thread_tag; jlong thread_id; jint depth; jmethodID method; }; -struct _jvmtiHeapReferenceInfoReserved { +struct jvmtiHeapReferenceInfoReserved { jlong reserved1; jlong reserved2; jlong reserved3; @@ -575,7 +580,7 @@ struct _jvmtiHeapReferenceInfoReserved { jlong reserved7; jlong reserved8; }; -union _jvmtiHeapReferenceInfo { +union jvmtiHeapReferenceInfo { jvmtiHeapReferenceInfoField field; jvmtiHeapReferenceInfoArray array; jvmtiHeapReferenceInfoConstantPool constant_pool; @@ -583,7 +588,7 @@ union _jvmtiHeapReferenceInfo { jvmtiHeapReferenceInfoJniLocal jni_local; jvmtiHeapReferenceInfoReserved other; }; -struct _jvmtiHeapCallbacks { +struct jvmtiHeapCallbacks { jvmtiHeapIterationCallback heap_iteration_callback; jvmtiHeapReferenceCallback heap_reference_callback; jvmtiPrimitiveFieldCallback primitive_field_callback; @@ -601,12 +606,12 @@ struct _jvmtiHeapCallbacks { jvmtiReservedCallback reserved14; jvmtiReservedCallback reserved15; }; -struct _jvmtiClassDefinition { +struct jvmtiClassDefinition { jclass klass; jint class_byte_count; const unsigned char* class_bytes; }; -struct _jvmtiMonitorUsage { +struct jvmtiMonitorUsage { jthread owner; jint entry_count; jint waiter_count; @@ -614,11 +619,11 @@ struct _jvmtiMonitorUsage { jint notify_waiter_count; jthread* notify_waiters; }; -struct _jvmtiLineNumberEntry { +struct jvmtiLineNumberEntry { jlocation start_location; jint line_number; }; -struct _jvmtiLocalVariableEntry { +struct jvmtiLocalVariableEntry { jlocation start_location; jint length; char* name; @@ -626,13 +631,13 @@ struct _jvmtiLocalVariableEntry { char* generic_signature; jint slot; }; -struct _jvmtiParamInfo { +struct jvmtiParamInfo { char* name; jvmtiParamKind kind; jvmtiParamTypes base_type; jboolean null_ok; }; -struct _jvmtiExtensionFunctionInfo { +struct jvmtiExtensionFunctionInfo { jvmtiExtensionFunction func; char* id; char* short_description; @@ -641,14 +646,14 @@ struct _jvmtiExtensionFunctionInfo { jint error_count; jvmtiError* errors; }; -struct _jvmtiExtensionEventInfo { +struct jvmtiExtensionEventInfo { jint extension_event_index; char* id; char* short_description; jint param_count; jvmtiParamInfo* params; }; -struct _jvmtiTimerInfo { +struct jvmtiTimerInfo { jlong max_value; jboolean may_skip_forward; jboolean may_skip_backward; @@ -656,7 +661,7 @@ struct _jvmtiTimerInfo { jlong reserved1; jlong reserved2; }; -struct _jvmtiAddrLocationMap { +struct jvmtiAddrLocationMap { const void* start_address; jlocation location; }; @@ -703,7 +708,10 @@ typedef struct { unsigned int can_retransform_any_class : 1; unsigned int can_generate_resource_exhaustion_heap_events : 1; unsigned int can_generate_resource_exhaustion_threads_events : 1; - unsigned int : 7; + unsigned int can_generate_early_vmstart : 1; + unsigned int can_generate_early_class_hook_events : 1; + unsigned int can_generate_sampled_object_alloc_events : 1; + unsigned int : 4; unsigned int : 16; unsigned int : 16; unsigned int : 16; @@ -883,6 +891,14 @@ typedef void (JNICALL *jvmtiEventResourceExhausted) const void* reserved, const char* description); +typedef void (JNICALL *jvmtiEventSampledObjectAlloc) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jobject object, + jclass object_klass, + jlong size); + typedef void (JNICALL *jvmtiEventSingleStep) (jvmtiEnv *jvmti_env, JNIEnv* jni_env, @@ -994,6 +1010,10 @@ typedef struct { jvmtiEventObjectFree ObjectFree; /* 84 : VM Object Allocation */ jvmtiEventVMObjectAlloc VMObjectAlloc; + /* 85 */ + jvmtiEventReserved reserved85; + /* 86 : Sampled Object Allocation */ + jvmtiEventSampledObjectAlloc SampledObjectAlloc; } jvmtiEventCallbacks; @@ -1011,8 +1031,10 @@ typedef struct jvmtiInterface_1_ { jthread event_thread, ...); - /* 3 : RESERVED */ - void *reserved3; + /* 3 : Get All Modules */ + jvmtiError (JNICALL *GetAllModules) (jvmtiEnv* env, + jint* module_count_ptr, + jobject** modules_ptr); /* 4 : Get All Threads */ jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env, @@ -1213,8 +1235,11 @@ typedef struct jvmtiInterface_1_ { jmethodID method, jlocation location); - /* 40 : RESERVED */ - void *reserved40; + /* 40 : Get Named Module */ + jvmtiError (JNICALL *GetNamedModule) (jvmtiEnv* env, + jobject class_loader, + const char* package_name, + jobject* module_ptr); /* 41 : Set Field Access Watch */ jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env, @@ -1492,23 +1517,38 @@ typedef struct jvmtiInterface_1_ { const jthread* request_list, jvmtiError* results); - /* 94 : RESERVED */ - void *reserved94; - - /* 95 : RESERVED */ - void *reserved95; - - /* 96 : RESERVED */ - void *reserved96; - - /* 97 : RESERVED */ - void *reserved97; - - /* 98 : RESERVED */ - void *reserved98; - - /* 99 : RESERVED */ - void *reserved99; + /* 94 : Add Module Reads */ + jvmtiError (JNICALL *AddModuleReads) (jvmtiEnv* env, + jobject module, + jobject to_module); + + /* 95 : Add Module Exports */ + jvmtiError (JNICALL *AddModuleExports) (jvmtiEnv* env, + jobject module, + const char* pkg_name, + jobject to_module); + + /* 96 : Add Module Opens */ + jvmtiError (JNICALL *AddModuleOpens) (jvmtiEnv* env, + jobject module, + const char* pkg_name, + jobject to_module); + + /* 97 : Add Module Uses */ + jvmtiError (JNICALL *AddModuleUses) (jvmtiEnv* env, + jobject module, + jclass service); + + /* 98 : Add Module Provides */ + jvmtiError (JNICALL *AddModuleProvides) (jvmtiEnv* env, + jobject module, + jclass service, + jclass impl_class); + + /* 99 : Is Modifiable Module */ + jvmtiError (JNICALL *IsModifiableModule) (jvmtiEnv* env, + jobject module, + jboolean* is_modifiable_module_ptr); /* 100 : Get All Stack Traces */ jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env, @@ -1675,7 +1715,7 @@ typedef struct jvmtiInterface_1_ { /* 132 : Set System Property */ jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env, const char* property, - const char* value); + const char* value_ptr); /* 133 : Get Phase */ jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env, @@ -1781,6 +1821,10 @@ typedef struct jvmtiInterface_1_ { jint depth, jobject* value_ptr); + /* 156 : Set Heap Sampling Interval */ + jvmtiError (JNICALL *SetHeapSamplingInterval) (jvmtiEnv* env, + jint sampling_interval); + } jvmtiInterface_1; struct _jvmtiEnv { @@ -2137,6 +2181,50 @@ struct _jvmtiEnv { return functions->ClearFieldModificationWatch(this, klass, field); } + jvmtiError GetAllModules(jint* module_count_ptr, + jobject** modules_ptr) { + return functions->GetAllModules(this, module_count_ptr, modules_ptr); + } + + jvmtiError GetNamedModule(jobject class_loader, + const char* package_name, + jobject* module_ptr) { + return functions->GetNamedModule(this, class_loader, package_name, module_ptr); + } + + jvmtiError AddModuleReads(jobject module, + jobject to_module) { + return functions->AddModuleReads(this, module, to_module); + } + + jvmtiError AddModuleExports(jobject module, + const char* pkg_name, + jobject to_module) { + return functions->AddModuleExports(this, module, pkg_name, to_module); + } + + jvmtiError AddModuleOpens(jobject module, + const char* pkg_name, + jobject to_module) { + return functions->AddModuleOpens(this, module, pkg_name, to_module); + } + + jvmtiError AddModuleUses(jobject module, + jclass service) { + return functions->AddModuleUses(this, module, service); + } + + jvmtiError AddModuleProvides(jobject module, + jclass service, + jclass impl_class) { + return functions->AddModuleProvides(this, module, service, impl_class); + } + + jvmtiError IsModifiableModule(jobject module, + jboolean* is_modifiable_module_ptr) { + return functions->IsModifiableModule(this, module, is_modifiable_module_ptr); + } + jvmtiError GetLoadedClasses(jint* class_count_ptr, jclass** classes_ptr) { return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr); @@ -2484,8 +2572,8 @@ struct _jvmtiEnv { } jvmtiError SetSystemProperty(const char* property, - const char* value) { - return functions->SetSystemProperty(this, property, value); + const char* value_ptr) { + return functions->SetSystemProperty(this, property, value_ptr); } jvmtiError GetPhase(jvmtiPhase* phase_ptr) { @@ -2522,6 +2610,10 @@ struct _jvmtiEnv { return functions->GetJLocationFormat(this, format_ptr); } + jvmtiError SetHeapSamplingInterval(jint sampling_interval) { + return functions->SetHeapSamplingInterval(this, sampling_interval); + } + #endif /* __cplusplus */ }; @@ -2531,4 +2623,3 @@ struct _jvmtiEnv { #endif /* __cplusplus */ #endif /* !_JAVA_JVMTI_H_ */ - diff --git a/arthas-vmtool/src/main/native/head/jvmticmlr.h b/arthas-vmtool/src/main/native/head/jvmticmlr.h index a9c88f36e..c2106d3a7 100755 --- a/arthas-vmtool/src/main/native/head/jvmticmlr.h +++ b/arthas-vmtool/src/main/native/head/jvmticmlr.h @@ -1,26 +1,26 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ /* diff --git a/arthas-vmtool/src/main/native/head/linux/jawt_md.h b/arthas-vmtool/src/main/native/head/linux/jawt_md.h index 825142ca8..2ba3a8e83 100644 --- a/arthas-vmtool/src/main/native/head/linux/jawt_md.h +++ b/arthas-vmtool/src/main/native/head/linux/jawt_md.h @@ -1,26 +1,26 @@ /* * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JAWT_MD_H_ @@ -28,7 +28,6 @@ #include #include -#include #include "jawt.h" #ifdef __cplusplus diff --git a/arthas-vmtool/src/main/native/head/linux/jni_md.h b/arthas-vmtool/src/main/native/head/linux/jni_md.h index ff30a32c3..6e583da71 100644 --- a/arthas-vmtool/src/main/native/head/linux/jni_md.h +++ b/arthas-vmtool/src/main/native/head/linux/jni_md.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JNI_MD_H_ @@ -29,18 +29,33 @@ #ifndef __has_attribute #define __has_attribute(x) 0 #endif + +#ifndef JNIEXPORT + #if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) + #ifdef ARM + #define JNIEXPORT __attribute__((externally_visible,visibility("default"))) + #else + #define JNIEXPORT __attribute__((visibility("default"))) + #endif + #else + #define JNIEXPORT + #endif +#endif + #if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) - #define JNIEXPORT __attribute__((visibility("default"))) - #define JNIIMPORT __attribute__((visibility("default"))) + #ifdef ARM + #define JNIIMPORT __attribute__((externally_visible,visibility("default"))) + #else + #define JNIIMPORT __attribute__((visibility("default"))) + #endif #else - #define JNIEXPORT #define JNIIMPORT #endif #define JNICALL typedef int jint; -#ifdef _LP64 /* 64-bit Solaris */ +#ifdef _LP64 typedef long jlong; #else typedef long long jlong; diff --git a/arthas-vmtool/src/main/native/head/macos/jawt_md.h b/arthas-vmtool/src/main/native/head/macos/jawt_md.h index d803a0f7f..94a13c9ab 100644 --- a/arthas-vmtool/src/main/native/head/macos/jawt_md.h +++ b/arthas-vmtool/src/main/native/head/macos/jawt_md.h @@ -1,26 +1,26 @@ /* * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JAWT_MD_H_ @@ -37,7 +37,7 @@ extern "C" { #endif /* - * Mac OS X specific declarations for AWT native interface. + * MacOS specific declarations for AWT native interface. * See notes in jawt.h for an example of use. */ diff --git a/arthas-vmtool/src/main/native/head/macos/jni_md.h b/arthas-vmtool/src/main/native/head/macos/jni_md.h index d2b83307f..f0cf64ebe 100644 --- a/arthas-vmtool/src/main/native/head/macos/jni_md.h +++ b/arthas-vmtool/src/main/native/head/macos/jni_md.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JNI_MD_H_ diff --git a/arthas-vmtool/src/main/native/head/windows/AccessBridgeCallbacks.h b/arthas-vmtool/src/main/native/head/windows/AccessBridgeCallbacks.h index df5035b84..3f907d5f9 100755 --- a/arthas-vmtool/src/main/native/head/windows/AccessBridgeCallbacks.h +++ b/arthas-vmtool/src/main/native/head/windows/AccessBridgeCallbacks.h @@ -1,30 +1,26 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - -/* - * AccessBridgeCallbacks.h 1.17 05/03/21 + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ /* diff --git a/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.c b/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.c index 368664818..105f342af 100755 --- a/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.c +++ b/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.c @@ -1,30 +1,33 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - -/* - * @(#)AccessBridgeCalls.c 1.25 05/08/22 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @@ -40,7 +43,6 @@ //#define ACCESSBRIDGE_64 #include "AccessBridgeCalls.h" -#include "AccessBridgeDebug.h" #ifdef __cplusplus extern "C" { @@ -52,21 +54,19 @@ extern "C" { BOOL theAccessBridgeInitializedFlag = FALSE; #define LOAD_FP(result, type, name) \ - PrintDebugString("LOAD_FP loading: %s ...", name); \ if ((theAccessBridge.result = \ (type) GetProcAddress(theAccessBridgeInstance, name)) == (type) 0) { \ - PrintDebugString("LOAD_FP failed: %s", name); \ return FALSE; \ } BOOL initializeAccessBridge() { -#ifdef ACCESSBRIDGE_ARCH_32 // For 32bit AT new bridge +#ifdef ACCESSBRIDGE_ARCH_32 // For 32 bit AT interfacing with Java on 64 bit OS theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE-32"); #else -#ifdef ACCESSBRIDGE_ARCH_64 // For 64bit AT new bridge +#ifdef ACCESSBRIDGE_ARCH_64 // For 64 bit AT interfacing with Java on 64 bit OS theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE-64"); -#else // legacy +#else // For 32 bit AT interfacing with Java on 32 bit OS theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE"); #endif #endif @@ -212,7 +212,6 @@ extern "C" { theAccessBridge.Windows_run(); theAccessBridgeInitializedFlag = TRUE; - PrintDebugString("theAccessBridgeInitializedFlag = TRUE"); return TRUE; } else { return FALSE; diff --git a/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.h b/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.h index ad0074009..46b42fd1c 100755 --- a/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.h +++ b/arthas-vmtool/src/main/native/head/windows/AccessBridgeCalls.h @@ -1,24 +1,43 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * + * This code 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 in the LICENSE file that + * accompanied this code). * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* Note: In addition to this header file AccessBridgeCalls.c must be compiled and + * linked to your application. AccessBridgeCalls.c implements the Java Access + * Bridge API and also hides the complexities associated with interfacing to the + * associated Java Access Bridge DLL which is installed when Java is installed. * + * AccessBridgeCalls.c is available for download from the OpenJDK repository using + * the following link: * + * http://hg.openjdk.java.net/jdk9/jdk9/jdk/raw-file/tip/src/jdk.accessibility/windows/native/bridge/AccessBridgeCalls.c * + * Also note that the API is used in the jaccessinspector and jaccesswalker tools. + * The source for those tools is available in the OpenJDK repository at these links: * + * http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/jdk.accessibility/windows/native/jaccessinspector/jaccessinspector.cpp + * http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/jdk.accessibility/windows/native/jaccesswalker/jaccesswalker.cpp * * */ diff --git a/arthas-vmtool/src/main/native/head/windows/AccessBridgePackages.h b/arthas-vmtool/src/main/native/head/windows/AccessBridgePackages.h index 478f7c636..27c31be09 100755 --- a/arthas-vmtool/src/main/native/head/windows/AccessBridgePackages.h +++ b/arthas-vmtool/src/main/native/head/windows/AccessBridgePackages.h @@ -1,26 +1,26 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * + * This code 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 in the LICENSE file that + * accompanied this code). * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ /* diff --git a/arthas-vmtool/src/main/native/head/windows/jawt_md.h b/arthas-vmtool/src/main/native/head/windows/jawt_md.h index 66e7256a2..7d43ff827 100755 --- a/arthas-vmtool/src/main/native/head/windows/jawt_md.h +++ b/arthas-vmtool/src/main/native/head/windows/jawt_md.h @@ -1,26 +1,26 @@ /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JAWT_MD_H_ diff --git a/arthas-vmtool/src/main/native/head/windows/jni_md.h b/arthas-vmtool/src/main/native/head/windows/jni_md.h index 38080013b..b8c144fb0 100755 --- a/arthas-vmtool/src/main/native/head/windows/jni_md.h +++ b/arthas-vmtool/src/main/native/head/windows/jni_md.h @@ -1,35 +1,38 @@ /* - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 in the LICENSE file that + * accompanied this code). + * + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #ifndef _JAVASOFT_JNI_MD_H_ #define _JAVASOFT_JNI_MD_H_ -#define JNIEXPORT __declspec(dllexport) +#ifndef JNIEXPORT + #define JNIEXPORT __declspec(dllexport) +#endif #define JNIIMPORT __declspec(dllimport) #define JNICALL __stdcall +// 'long' is always 32 bit on windows so this matches what jdk expects typedef long jint; typedef __int64 jlong; typedef signed char jbyte;