-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
x86
-
windows_nt
Name: kbC93603 Date: 12/08/99
The HotSpot 1.3fcs-Q (internal build 12/06/99) now allows to enable
JVMPI_EVENT_INSTRUCTION_START event, but it does not actually
generate events of this kind, even if -XX:+EnableJVMPIInstructionStartEvent
flag is passed.
To reproduce the bug, put the three files below into one
directory and run doit.bat :
--- doit.bat ---
@echo off
rem Parameter %1%: JDK root directory (e.g. /usr/local/java/jdk1.2.2)
if -%1%==- goto ERR
set HSJDK=%1%
set JAVA=%HSJDK%\bin\java
cl /D "WIN32" /D "_WINDOWS" /I%HSJDK%\include /I%HSJDK%\include\win32 /LD /Fejcov001.dll jcov001.c
%JAVA%c *.java
%JAVA% -version
%JAVA% -Xinternalversion
%JAVA% -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov001 jcov001
goto END
:ERR
echo doit: ERROR: the first parameter should be JDK root directory
:END
----------------
--- jcov001.java ---
public class jcov001 {
public static void main(String[] args) {
System.exit(0);
}
}
--------------------
--- jcov001.c ---
#include <stdio.h>
#include <string.h>
#include "jvmpi.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef JNI_ENV_ARG
#ifdef __cplusplus
#define JNI_ENV_ARG(x, y) y
#define JNI_ENV_PTR(x) x
#else
#define JNI_ENV_ARG(x,y) x, y
#define JNI_ENV_PTR(x) (*x)
#endif
#endif
JVMPI_Interface *jvmpi;
static int instr_start_cnt;
static void notify_event(JVMPI_Event *event) {
if (event == NULL)
return;
if (event->event_type == JVMPI_EVENT_INSTRUCTION_START)
instr_start_cnt++;
else if (event->event_type == JVMPI_EVENT_JVM_SHUT_DOWN)
if (instr_start_cnt == 0)
printf("\n\nNo JVMPI_EVENT_INSTRUCTION_START events has been generated\n");
}
JNIEXPORT jint JNICALL JVM_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmpi), JVMPI_VERSION_1);
if ( res < 0 ) {
printf("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
jvmpi->NotifyEvent = notify_event;
if ((res = jvmpi->EnableEvent(JVMPI_EVENT_JVM_SHUT_DOWN, NULL)) != JVMPI_SUCCESS) {
printf("\n\nCan not enable JVMPI_EVENT_JVM_SHUT_DOWN: %d\n", res);
}
if ((res = jvmpi->EnableEvent(JVMPI_EVENT_INSTRUCTION_START, NULL)) != JVMPI_SUCCESS) {
printf("\n\nCan not enable JVMPI_EVENT_INSTRUCTION_START: %d\n", res);
}
instr_start_cnt = 0;
return JNI_OK;
}
#ifdef __cplusplus
}
#endif
-----------------
======================================================================
- duplicates
-
JDK-4297939 JVMPI_EVENT_INSTRUCTION_START events are not generated
- Closed
- relates to
-
JDK-4297121 JVMPI: can not enable INSTRUCTION_START event
- Closed