test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp
changeset 52952 837f1b8442be
parent 52642 9cfc8b0c45fd
equal deleted inserted replaced
52951:722eaae2a785 52952:837f1b8442be
   148 void JNICALL
   148 void JNICALL
   149 ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass) {
   149 ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass) {
   150     char *cls_sig;
   150     char *cls_sig;
   151     jint clsByteCount;
   151     jint clsByteCount;
   152 
   152 
   153     display((hotswap != HOTSWAP_OFF)?0:1,
   153     display((hotswap != HOTSWAP_OFF) ? 0 : 1,
   154         "#### JVMTIagent: ClassLoad occurred ####\n");
   154         "#### JVMTIagent: ClassLoad occurred ####\n");
   155 
   155 
   156     getVerdict(jni_env, "ClassLoad");
   156     getVerdict(jni_env, "ClassLoad");
   157 
   157 
   158     if (hotswap != HOTSWAP_OFF) {
   158     if (hotswap != HOTSWAP_OFF) {
   234         jmethodID method, jlocation location, jobject exception,
   234         jmethodID method, jlocation location, jobject exception,
   235         jmethodID catch_method, jlocation catch_location) {
   235         jmethodID catch_method, jlocation catch_location) {
   236     jclass decl_clazz;
   236     jclass decl_clazz;
   237 
   237 
   238     display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
   238     display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
   239             hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS)?0:1,
   239             hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) ? 0 : 1,
   240         "#### JVMTIagent: Exception occurred ####\n");
   240         "#### JVMTIagent: Exception occurred ####\n");
   241 
   241 
   242     getVerdict(jni_env, "Exception");
   242     getVerdict(jni_env, "Exception");
   243 
   243 
   244     if (hotswap == HOTSWAP_EVERY_EXCEPTION ||
   244     if (hotswap == HOTSWAP_EVERY_EXCEPTION ||
   406 void JNICALL
   406 void JNICALL
   407 SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
   407 SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
   408         jmethodID method, jlocation location) {
   408         jmethodID method, jlocation location) {
   409     jclass decl_clazz;
   409     jclass decl_clazz;
   410 
   410 
   411     display((hotswap == HOTSWAP_EVERY_SINGLE_STEP)?0:1,
   411     display((hotswap == HOTSWAP_EVERY_SINGLE_STEP) ? 0 : 1,
   412         "#### JVMTIagent: SingleStep occurred ####\n");
   412         "#### JVMTIagent: SingleStep occurred ####\n");
   413 
   413 
   414     getVerdict(jni_env, "SingleStep");
   414     getVerdict(jni_env, "SingleStep");
   415 
   415 
   416     if (hotswap == HOTSWAP_EVERY_SINGLE_STEP) {
   416     if (hotswap == HOTSWAP_EVERY_SINGLE_STEP) {
   426 MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env,
   426 MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env,
   427         jthread thr, jmethodID method) {
   427         jthread thr, jmethodID method) {
   428     jclass decl_clazz;
   428     jclass decl_clazz;
   429 
   429 
   430     display((hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
   430     display((hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
   431             hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS)?0:1,
   431             hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS) ? 0 : 1,
   432         "#### JVMTIagent: MethodEntry occurred ####\n");
   432         "#### JVMTIagent: MethodEntry occurred ####\n");
   433 
   433 
   434     getVerdict(jni_env, "MethodEntry");
   434     getVerdict(jni_env, "MethodEntry");
   435 
   435 
   436     if (hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
   436     if (hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
   457 ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thr,
   457 ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thr,
   458         jmethodID method, jlocation location, jobject exception) {
   458         jmethodID method, jlocation location, jobject exception) {
   459     jclass decl_clazz;
   459     jclass decl_clazz;
   460 
   460 
   461     display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
   461     display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
   462             hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS)?0:1,
   462             hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) ? 0 : 1,
   463         "#### JVMTIagent: ExceptionCatch occurred ####\n");
   463         "#### JVMTIagent: ExceptionCatch occurred ####\n");
   464 
   464 
   465     getVerdict(jni_env, "ExceptionCatch");
   465     getVerdict(jni_env, "ExceptionCatch");
   466 
   466 
   467     if (hotswap == HOTSWAP_EVERY_EXCEPTION ||
   467     if (hotswap == HOTSWAP_EVERY_EXCEPTION ||
  1151 
  1151 
  1152     if (vm_death_occured == TRUE) {
  1152     if (vm_death_occured == TRUE) {
  1153         sprintf(error_msg, "JVMTIagent: getVerdict: %s event occured after VMDeath",
  1153         sprintf(error_msg, "JVMTIagent: getVerdict: %s event occured after VMDeath",
  1154             evnt);
  1154             evnt);
  1155 
  1155 
  1156         if (jni_env==NULL) { /* some event callbacks have no pointer to jni */
  1156         if (jni_env == NULL) { /* some event callbacks have no pointer to jni */
  1157             printf("ERROR: %s\n", error_msg);
  1157             printf("ERROR: %s\n", error_msg);
  1158             exit(97);
  1158             exit(97);
  1159         }
  1159         }
  1160         else
  1160         else
  1161             jni_env->FatalError(error_msg);
  1161             jni_env->FatalError(error_msg);