-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
sparc
-
solaris_7
Name: icC57033 Date: 09/29/99
Java HotSpot (TM) Client VM (build 1.3-I) can't execute jvmdi function GetThreadGroupInfo().
This problem prevents the hotsparc_client1.3-i VM from passing the test:
nsk/coverage/jvmdi/jvmdi010
which could be found in the HotSpot's testbase:
/net/sqesvr/vsn/testbase/testbase_nsk
Steps to reproduce
------------------
1. Compile the attached jvmdi010.c:
% cc -G -KPIC -I<PATH_TO_TESTED_JDK>/include -I<PATH_TO_TESTED_JDK>/include/solaris -o libjvmdi010.so jvmdi010.c
2. Compile the attached jvmdi010.java:
% javac jvmdi010.java
3. Run jvmdi010
% java -Xdebug -Xnoagent -Djava.library.path=<path to libjvmdi010.so> jvmdi010
HotSpot Client 1.3-i for solaris will output:
#
# HotSpot Virtual Machine Error, Unexpected Signal 11
#
# Error ID: 4F533F534F4C415249530E4350500790 01
#
Error ID: 4F533F534F4C415249530E4350500790 - os_solaris.cpp, 1936
/*---------------------------- jvmdi010.c ---------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "jvmdi.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
JavaVM *jvm;
JVMDI_Interface_1 *jvmdi;
JNIEXPORT jint JNICALL Java_jvmdi010_jvmdi010GetThreadGroupInfo(
JNIEnv *env, jobject mainObject) {
jint groupCountPtr, wasError=0;
jclass *groupsPtr;
JVMDI_thread_group_info infoPtr;
jvmdiError err, err1;
err=jvmdi->GetTopThreadGroups(&groupCountPtr, &groupsPtr);
if( err==JVMDI_ERROR_NONE ) {
int i;
for( i=0 ; i < groupCountPtr ; i++ ){
err1=jvmdi->GetThreadGroupInfo(groupsPtr[i], &infoPtr);
if( err1==JVMDI_ERROR_NONE ) {
JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG(env,infoPtr.parent));
jvmdi->Deallocate((jbyte*)infoPtr.name);
} else {
wasError=1;
}
JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG(env,groupsPtr[i]));
}
jvmdi->Deallocate((jbyte *)groupsPtr);
} else {
wasError=1;
}
return (jint)wasError;
}
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
jint res;
jvm=vm;
res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmdi)
, JVMDI_VERSION_1);
return JNI_VERSION_1_2;
}
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
return;
}
#ifdef __cplusplus
}
#endif
/*---------------------------- jvmdi010.java ---------------------------*/
/* Ident: @(#)jvmdi010.java 1.1 99/09/27 */
/* Copyright 09/27/99 Sun Microsystems, Inc. All Rights Reserved */
import java.io.PrintStream;
public class jvmdi010 {
static String cannotBeRun;
static int linkStatus;
static {
try {
loadLib("jvmdi010");
} catch ( UnsatisfiedLinkError e ) {
}
}
public native int jvmdi010GetThreadGroupInfo();
public static void main(String argv[]) {
final int exitCodeBias = 95;
// JCK-compatible exit
System.exit(run(argv,System.out) + exitCodeBias);
}
public static int run(String argv[],PrintStream out) {
for( int argvi=0; argvi<argv.length; argvi++ ) {
if( argv[argvi].equals("-loadLibraryAllowed") ) {
linkStatus = 2/*STATUS_FAILED*/;
}
}
if (cannotBeRun!=null) {
out.println(cannotBeRun);
return linkStatus;
}
try {
jvmdi010 o=new jvmdi010();
if( o.jvmdi010GetThreadGroupInfo() != 0 ) {
return 2;
}
return 0;
} catch (Throwable error) {
error.printStackTrace(out);
return 2;
}
}
static void loadLib( String libName ) {
SecurityManager mgr = System.getSecurityManager();
boolean canLoad = true;
linkStatus=2/*STATUS_FAILED*/;
if( mgr != null ) {
try {
mgr.checkLink( libName );
} catch (SecurityException e) {
canLoad = false;
}
}
try {
System.loadLibrary( libName );
if (canLoad) {
cannotBeRun = null;
} else {
cannotBeRun = "Incorrectly loaded library: " + libName;
}
} catch (SecurityException e) {
if (!canLoad) {
linkStatus = 0/*STATUS_PASSED*/;
cannotBeRun = "Correctly prevented loadLibrary: "
+ libName;
} else {
cannotBeRun = "Incorrectly prevented loadLibrary: "
+ libName;
}
} catch (UnsatisfiedLinkError e) {
cannotBeRun = "Cannot find library: " + libName;
throw e;
}
}
}
======================================================================
- duplicates
-
JDK-4261718 VM crashes whenever GetThreadGroupInfo is called
- Closed