jdk-24/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti
Ramkumar Sunderbabu 855c8a7def 8334305: Remove all code for nsk.share.Log verbose mode
Reviewed-by: mli, cjplummer, lmesnik
2024-10-02 10:48:21 +00:00
..
AddToBootstrapClassLoaderSearch 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
AddToSystemClassLoaderSearch 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
agent_common 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
aod 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
attach/loader 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00
GetConstantPool 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00
hotswap 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
RetransformClasses/LinearHierarchy 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00
unit 8326524: Rename agent_common.h 2024-02-27 10:26:42 +00:00
agent_tools.cpp 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
ArgumentHandler.java 8253878: clean up nsk/share/jvmti/ArgumentHandler 2020-09-30 23:34:06 +00:00
DebugeeClass.java 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00
Injector.cpp 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
Injector.hpp 8325055: Rename Injector.h 2024-02-02 16:19:08 +00:00
jvmti_FollowRefObjects.cpp 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
jvmti_FollowRefObjects.hpp 8325180: Rename jvmti_FollowRefObjects.h 2024-02-06 17:15:36 +00:00
jvmti_tools.cpp 8333178: ubsan: jvmti_tools.cpp:149:16: runtime error: null pointer passed as argument 2, which is declared to never be null 2024-06-06 07:46:35 +00:00
jvmti_tools.hpp 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
JVMTITest.java 8334305: Remove all code for nsk.share.Log verbose mode 2024-10-02 10:48:21 +00:00
JVMTITools.cpp 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
JVMTITools.hpp 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
ProfileCollector.java 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00
README 8324799: Use correct extension for C++ test headers 2024-02-29 06:24:42 +00:00
RedefineAgent.java 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00
ThreadState.java 8199383: [TESTBUG] Open source VM testbase JVMTI tests 2018-05-24 17:12:15 -07:00

Copyright (c) 2003, 2024, 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.

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.

---------------------------------------------------------------------------------

This directory contains source files of testbase_nsk JVMTI framework,
which provides support for JVMTI tests and accessing JVMTI environment.

    Source files:
        jvmti_tools.hpp
        jvmti_tools.cpp
        agent_tools.cpp
        Injector.hpp
        Injector.cpp
        JVMTITools.hpp
        JVMTITools.cpp

    Naming conventions:
        macroses:  NSK_JVMTI_*
        functions: nsk_jvmti_*

---------------------------------------------------------------------------------

jvmti_tools.hpp

Provides functions and macroses for invocation of JVMTI functions
and checking JVMTI errors:

    NSK_JVMTI_VERIFY(call)
    NSK_JVMTI_VERIFY_NEGATIVE(call)
    NSK_JVMTI_VERIFY_CODE(code, action)

Also provides functions for running JVMTI agent:

    - init agent with options:

        int nsk_jvmti_parseOptions(const char options[]);

    - access agent options

        int  nsk_jvmti_getWaitTime();
        void nsk_jvmti_setWaitTime(int waittime);

        const char* nsk_jvmti_findOptionValue(const char name[]);
        const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defaultValue);
        int nsk_jvmti_findOptionIntValue(const char name[], int defaultValue);

        int nsk_jvmti_getOptionsCount();
        const char* nsk_jvmti_getOptionName(int i);
        const char* nsk_jvmti_getOptionValue(int i);

    - create JVMTI environment and register agent thread

        jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* jvm, void* reserved);
        int       nsk_jvmti_setAgentProc(jvmtiStartFunction proc, const void* arg);

    - initialize multiple agent chain via processing of nativeMethodBind event

        int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks);

    - access agent thread environment

        jthread   nsk_jvmti_getAgentThread();
        jvmtiEnv* nsk_jvmti_getAgentJVMTIEnv();
        JNIEnv*   nsk_jvmti_getAgentJNIEnv();

    - synchronize agent with debuggee

        int  nsk_jvmti_waitForSync(jlong timeout);
        int  nsk_jvmti_resumeSync();
        void nsk_jvmti_sleep(jlong timeout);

    - provide proper exit status

        void nsk_jvmti_setFailStatus();
        int  nsk_jvmti_isFailStatus();
        jint nsk_jvmti_getStatus();

    - use locations and breakpoints

        int nsk_jvmti_addLocationCapabilities();
        int nsk_jvmti_addBreakpointCapabilities();

        jlocation nsk_jvmti_getLineLocation(jclass cls, jmethodID method, int line);
        jlocation nsk_jvmti_setLineBreakpoint(jclass cls, jmethodID method, int line);
        jlocation nsk_jvmti_clearLineBreakpoint(jclass cls, jmethodID method, int line);

    - find classes and threads

        jclass nsk_jvmti_classBySignature(const char signature[]);
        jthread nsk_jvmti_threadByName(const char name[]);

    - events management

        int nsk_jvmti_isOptionalEvent(jvmtiEvent event);
        int nsk_jvmti_enableEvents(jvmtiEventMode enable, int size,
                                   jvmtiEvent list[], jthread thread);
        void nsk_jvmti_showPossessedCapabilities(jvmtiEnv *jvmti);

---------------------------------------------------------------------------------

Typical example of usage of the NSK_JVMTI_VERIFY macro
for invocation of JVMTI functions:

    // jvmti->GetVersion(jvmti, &version)
    if (!NSK_JVMTI_VERIFY(jvmti->GetVersion(&version) != NULL)) {
        return JNI_ERR;
    }

or with saving error code:

    // err = jvmti->GetVersion(jvmti, &version)
    if (!NSK_JVMTI_VERIFY(err = jvmti->GetVersion(&version))) {
        return err;
    }
        functions: nsk_jvmti_*

---------------------------------------------------------------------------------

JVMTITools.hpp

Provides set of functions which convert JVMTI binary data to
a null-terminated character string:


    const char* TranslateEvent(jvmtiEvent event_type);
    const char* TranslateState(jint flags);
    const char* TranslateError(jvmtiError err);
    const char* TranslatePhase(jvmtiPhase phase);
    const char* TranslateRootKind(jvmtiHeapRootKind root);
    const char* TranslateObjectRefKind(jvmtiObjectReferenceKind ref);

---------------------------------------------------------------------------------

Injector.hpp

Provides class file format constants and the function which inject some
profiling bytecodes into Java class files:

    int Inject(const u1* old_bytes, const jint old_length,
               u1** new_bytes, jint* new_length, int bci_mode);

---------------------------------------------------------------------------------