WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 6e070440 authored by john's avatar john
Browse files

corrected the problem page (again)

parent 1c1e1bb3
......@@ -10,9 +10,10 @@
<description>DaCapo Agent</description>
<import file="../util.xml"/>
<import file="../libs/libs.xml"/>
<property name="agentdir" value="${basedir}/agent"/>
<property name="dist-dir" value="${agentdir}/dist"/>
<property name="agent-dir" value="${basedir}/agent"/>
<property name="dist-dir" value="${agent-dir}/dist"/>
<property file="dacapo.properties"/>
......@@ -20,7 +21,8 @@
<equals arg1="${os.name}" arg2="linux" casesensitive="no" trim="yes"/>
</condition>
<property name="download-dir" value="${agentdir}/download"/>
<property name="download-dir" value="${agent-dir}/download"/>
<!--
<property name="asm-verison" value="3.2"/>
<property name="asm-jar" value="asm-${asm-verison}.jar"/>
<property name="asm-analysis-jar" value="asm-analysis-${asm-verison}.jar"/>
......@@ -31,6 +33,16 @@
<property name="asm-xml-jar" value="asm-xml-${asm-verison}.jar"/>
<property name="asm-zip" value="asm-${asm-verison}-bin.zip"/>
<property name="asm-url" value="http://download.forge.objectweb.org/asm"/>
-->
<!-- http://zlib.net/zlib-1.2.5.tar.gz -->
<property name="zlib" value="zlib"/>
<property name="zlib-version" value="1.2.5"/>
<property name="zlib-basename" value="${zlib}-${zlib-version}"/>
<property name="zlib-name" value="${zlib-basename}.tar.gz"/>
<property name="zlib-url" value="http://${zlib}.net"/>
<property name="zlib-lib-base" value="z"/>
<property name="cli" value="commons-cli"/>
<property name="cli-version" value="1.2"/>
......@@ -42,26 +54,38 @@
<property name="make" value="make"/>
<target name="init">
<mkdir dir="${agentdir}/build"/>
<mkdir dir="${agentdir}/lib"/>
<mkdir dir="${agent-dir}/build"/>
<mkdir dir="${agent-dir}/lib"/>
<mkdir dir="${dist-dir}"/>
</target>
<target name="libs" depends="init">
<target name="libs" depends="init,asm,bcel">
<antcall target="check-source">
<param name="target-file" value="${zlib-name}" />
<param name="target-dir" value="${download-dir}" />
<param name="target-url" value="${zlib-url}"/>
</antcall>
<untar src="${download-dir}/${zlib-name}" dest="${agent-dir}/build" compression="gzip"/>
<exec executable="sh" dir="${agent-dir}/build/${zlib-basename}" >
<arg value="configure"/>
</exec>
<exec executable="make" dir="${agent-dir}/build/${zlib-basename}" />
<!--
<antcall target="check-source">
<param name="target-file" value="${asm-zip}" />
<param name="target-dir" value="${download-dir}" />
<param name="target-url" value="${asm-url}"/>
</antcall>
<unzip src="${download-dir}/${asm-zip}" dest="${agentdir}/build">
<unzip src="${download-dir}/${asm-zip}" dest="${agent-dir}/build">
<fileset dir=".">
<include name="asm-3.2/lib/*.jar"/>
</fileset>
</unzip>
<copy file="${agentdir}/build/asm-3.2/lib/${asm-jar}" todir="${dist-dir}"/>
<copy file="${agentdir}/build/asm-3.2/lib/${asm-commons-jar}" todir="${dist-dir}"/>
<copy file="${agent-dir}/build/asm-3.2/lib/${asm-jar}" todir="${dist-dir}"/>
<copy file="${agent-dir}/build/asm-3.2/lib/${asm-commons-jar}" todir="${dist-dir}"/>
-->
<copy file="${asm-jar}" todir="${dist-dir}"/>
<copy file="${asm-commons-jar}" todir="${dist-dir}"/>
<!-- get commons commandline -->
<antcall target="check-source">
......@@ -72,27 +96,43 @@
<untar src="${download-dir}/${cli-name}" dest="${build-dir}" compression="gzip"/>
<copy file="${build-dir}/${cli-basename}/${cli-basename}.jar" todir="${dist-dir}"/>
</target>
</target>
<target name="all" depends="init,libs,jar,build-agent-linux">
</target>
<target name="jar">
<javac debug="on" srcdir="${agentdir}/src" destdir="${agentdir}/src" classpath="${dist-dir}/${asm-jar}:${dist-dir}/${asm-commons-jar}" />
<jar destfile="${agentdir}/dist/agent.jar" basedir="${agentdir}/src" />
<javac debug="on" srcdir="${agent-dir}/src" destdir="${agent-dir}/src" classpath="${asm-jar}:${asm-commons-jar}" />
<jar destfile="${agent-dir}/dist/agent.jar" basedir="${agent-dir}/src" />
</target>
<target name="build-agent-linux" if="linux">
<exec executable="${make}" dir="agent">
<mkdir dir="${agent-dir}/build/agent" />
<copy todir="${agent-dir}/build/agent" >
<fileset dir="${agent-dir}/src">
<include name="**.c"/>
<include name="**.h"/>
<include name="Makefile"/>
</fileset>
</copy>
<exec executable="${make}" dir="${agent-dir}/build/agent">
<arg value="JAVA_HOME=${java.home}/.."/>
<arg value="OSNAME=linux"/>
<!-- <arg value="OPT=true"/> -->
<arg value="ZLIB_DIR=${agent-dir}/build/${zlib-basename}"/>
<arg value="ZLIB_LIB=${zlib-lib-base}"/>
</exec>
<copy todir="${agent-dir}/lib">
<fileset dir="${agent-dir}/build/agent">
<include name="lib*.so"/>
</fileset>
</copy>
</target>
<target name="clean" depends="clean-linux">
<delete dir="${dist-dir}"/>
<delete dir="${agentdir}/lib"/>
<delete dir="${agentdir}/build"/>
<delete dir="${agent-dir}/lib"/>
<delete dir="${agent-dir}/build"/>
</target>
<target name="clean-linux" if="linux">
......
......@@ -46,6 +46,7 @@
#define NONE "<none>"
/*
#define LOG_CLASS(jni_table,jvmti_env,klass) \
{\
char* signature = NULL;\
......@@ -58,7 +59,31 @@
if (generic!=NULL) JVMTI_FUNC_PTR(jvmti_env,Deallocate)(jvmti_env,(unsigned char*)generic);\
}
#define LOG_OBJECT_CLASS(jni_table,jni_env,jvmti_env,object) LOG_CLASS(jni_tble,jvmti_env,JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,object))
#define LOG_OBJECT_CLASS(x)
*/
/*
#define LOG_OBJECT_CLASS(jni_table,jni_env,jvmti_env,object) \
{\
if (object != NULL) {\
jobject klass = JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,object); \
jlong klass_tag = 0; \
\
jboolean klass_has_new_tag = getTag(klass,&klass_tag);\
\
log_field_jlong(klass_tag);\
\
if (klass_has_new_tag) {\
LOG_CLASS(jni_table,jvmti_env,JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,object));\
} else {\
log_field_string(NULL); \
}\
} else {\
log_field_jlong(0);\
log_field_string(NULL);\
}\
}
*/
#define DEFINE_CALLBACK(cb,c,s) \
(cb)->c = callback##c; \
......@@ -76,6 +101,10 @@ extern jvmtiEnv* baseEnv;
extern jboolean jvmRunning;
extern jboolean jvmStopped;
jniNativeInterface* getJNIFunctionTable(char* file, int line);
#define JNIFunctionTable() getJNIFunctionTable(__FILE__,__LINE__)
void reportJVMTIError(FILE* fh, jvmtiError errorNumber, const char *str);
#endif
......@@ -60,7 +60,8 @@ jvmtiCapabilities availableCapabilities;
jvmtiCapabilities capabilities;
jvmtiEventCallbacks callbacks;
jrawMonitorID lockClass;
MonitorLockType agentLock;
MonitorLockType lockClass;
jboolean jvmRunning = FALSE;
jboolean jvmStopped = FALSE;
......@@ -87,6 +88,18 @@ static void processCapabilities();
static void processOptions();
static void agent_thread_main(void* arg);
static jniNativeInterface* jni_table = NULL;
jniNativeInterface* getJNIFunctionTable(char* file, int line) {
if (jni_table==NULL) {
if (JVMTI_FUNC_PTR(baseEnv,GetJNIFunctionTable)(baseEnv,&jni_table) != JNI_OK) {
fprintf(stderr, "failed to get JNI function table: %s:%d\n",file,line);
exit(1);
}
}
return jni_table;
}
static void JNICALL callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv* env,
jclass class_being_redefined, jobject loader,
const char* name, jobject protection_domain,
......@@ -239,11 +252,18 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
fprintf(stderr, "failed to initialize tag\n");
exit(1);
}
if (JVMTI_FUNC_PTR(baseEnv,CreateRawMonitor)(baseEnv, "agent data", &(lockClass))!=JNI_OK) {
if (!rawMonitorInit(baseEnv, "agent data", &lockClass)) {
/* JVMTI_FUNC_PTR(baseEnv,CreateRawMonitor)(baseEnv, "agent data", &(lockClass))!=JNI_OK) { */
fprintf(stderr, "failed to create raw monitor\n");
exit(1);
}
if (!rawMonitorInit(baseEnv,"agent lock",&agentLock)) {
/* JVMTI_FUNC_PTR(baseEnv,CreateRawMonitor)(baseEnv, "agent lock", &(agentLock)) != JNI_OK) { */
return FALSE;
}
agent_exclude_list();
allocation_init();
exception_init();
......@@ -273,12 +293,7 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
JNIEXPORT void JNICALL
Agent_OnUnload(JavaVM *vm)
{
if (logFile != NULL) {
FILE* tmp = logFile;
logFile = NULL;
fflush(tmp);
fclose(tmp);
}
dacapo_log_stop();
}
/* ------------------------------------------------------------------- */
......@@ -491,6 +506,8 @@ static void generateFileName(char* file_name, int max_file_name_len) {
#define ASM_PACKAGE_NAME "org/objectweb/asm/"
#define DACAPO_PACKAGE_NAME "org/dacapo/instrument/"
#define EXCLUDE_CHECK "sun/reflect/"
static jboolean isNotExcluded(const char* name)
{
struct exclude_list_s* chk;
......@@ -594,7 +611,7 @@ callbackVMDeath(jvmtiEnv *jvmti, JNIEnv *env)
}
static void reportMethod(char* class_name, jlong class_tag, jmethodID method) {
if (logFile==NULL) return;
if (! logFileOpen()) return;
char* name_ptr = NULL;
char* signature_ptr = NULL;
......@@ -606,8 +623,9 @@ static void reportMethod(char* class_name, jlong class_tag, jmethodID method) {
log_field_string(LOG_PREFIX_METHOD_PREPARE);
log_field_current_time();
log_field_pointer(method);
log_field_jlong(class_tag);
log_field_string(class_name);
log_field_jlong((jlong)method);
/* log_field_jlong(class_tag); */
log_field_string(name_ptr);
log_field_string(signature_ptr);
log_eol();
......@@ -626,11 +644,12 @@ static void processClassPrepare(jvmtiEnv *jvmti_env,
jlong class_tag = 0;
// jclass GetObjectClass(JNIEnv *env, jobject obj);
/*
rawMonitorEnter(&lockTag);
getTag(thread,&thread_tag);
getTag(klass,&class_tag);
jboolean klass_new_tag = getTag(klass,&class_tag);
rawMonitorExit(&lockTag);
*/
jint method_count = 0;
jmethodID* methods = NULL;
......@@ -653,21 +672,25 @@ static void processClassPrepare(jvmtiEnv *jvmti_env,
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_CLASS_PREPARE);
log_field_current_time();
log_field_jlong(class_tag);
// log_field_jlong(class_tag);
log_field_string(signature);
log_eol();
while(i<method_count) reportMethod(signature,class_tag,methods[i++]);
rawMonitorExit(&lockLog);
while(i<method_count) {
rawMonitorEnter(&lockLog);
reportMethod(signature,class_tag,methods[i++]);
rawMonitorExit(&lockLog);
}
JVMTI_FUNC_PTR(jvmti_env,Deallocate)(jvmti_env,(unsigned char*)methods);
JVMTI_FUNC_PTR(jvmti_env,Deallocate)(jvmti_env,(unsigned char*)signature);
JVMTI_FUNC_PTR(jvmti_env,Deallocate)(jvmti_env,(unsigned char*)generic);
allocation_class(jvmti_env, jni_env, klass);
exception_class(jvmti_env, jni_env, klass);
method_class(jvmti_env, jni_env, klass);
monitor_class(jvmti_env, jni_env, klass);
thread_class(jvmti_env, jni_env, klass);
allocation_class(jvmti_env, jni_env, thread, klass);
exception_class(jvmti_env, jni_env, thread, klass);
method_class(jvmti_env, jni_env, thread, klass);
monitor_class(jvmti_env, jni_env, thread, klass);
thread_class(jvmti_env, jni_env, thread, klass);
}
......@@ -679,7 +702,7 @@ callbackClassPrepare(jvmtiEnv *jvmti_env,
JNIEnv* jni_env,
jthread thread,
jclass klass) {
if (logFile==NULL || jvmStopped) return;
if (jvmStopped || !logFileOpen()) return;
if (jvmRunning)
processClassPrepare(jvmti_env, jni_env, thread, klass);
......
......@@ -51,29 +51,107 @@ void allocation_logon(JNIEnv* env) {
}
void allocation_live(jvmtiEnv* jvmti, JNIEnv* env) {
// at this point we should enumerate all the objects in the heap.
// how do we do this sensibly? we do not have an allocation order here, so
// pointer distances at this point are meaningless.
}
void allocation_class(jvmtiEnv *env, JNIEnv *jnienv, jthread thread, jclass klass) {
}
void allocation_class(jvmtiEnv *env, JNIEnv *jnienv, jclass klass) {
/*
* Class: org_dacapo_instrument_Agent
* Method: internalLogPointerChange
* Signature: (Ljava/lang/Thread;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_org_dacapo_instrument_Agent_internalLogPointerChange
(JNIEnv *jni_env, jclass agent_klass, jthread thread, jobject after, jobject object, jobject before)
{
if (jvmRunning && !jvmStopped) {
jniNativeInterface* jni_table = JNIFunctionTable();
jlong thread_tag = 0;
jclass thread_klass = JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,thread);
jlong thread_klass_tag = 0;
jlong before_tag = 0;
jclass before_klass = (before!=NULL)?JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,before):NULL;
jlong before_klass_tag = 0;
jlong object_tag = 0;
jclass object_klass = (object!=NULL)?JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,object):NULL;
jlong object_klass_tag = 0;
jlong after_tag = 0;
jclass after_klass = (after!=NULL)?JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,after):NULL;
jlong after_klass_tag = 0;
rawMonitorEnter(&lockTag);
jboolean thread_has_new_tag = getTag(thread, &thread_tag);
jboolean thread_klass_has_new_tag = getTag(thread_klass, &thread_klass_tag);
jboolean before_has_new_tag = getTag(before, &before_tag);
jboolean before_klass_has_new_tag = getTag(before_klass, &before_klass_tag);
jboolean object_has_new_tag = getTag(object, &object_tag);
jboolean object_klass_has_new_tag = getTag(object_klass, &object_klass_tag);
jboolean after_has_new_tag = getTag(after, &after_tag);
jboolean after_klass_has_new_tag = getTag(after_klass, &after_klass_tag);
rawMonitorExit(&lockTag);
/* trace allocation */
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_POINTER);
log_field_current_time();
log_thread(thread,thread_tag,thread_has_new_tag,thread_klass,thread_klass_tag,thread_klass_has_new_tag);
log_field_jlong(object_tag);
log_class(object_klass,object_klass_tag,object_klass_has_new_tag);
log_field_jlong(before_tag);
log_class(before_klass,before_klass_tag,before_klass_has_new_tag);
log_field_jlong(after_tag);
log_class(after_klass,after_klass_tag,after_klass_has_new_tag);
log_eol();
rawMonitorExit(&lockLog);
}
}
/*
* Class: org_dacapo_instrument_Agent
* Method: internalAllocReport
* Signature: (Ljava/lang/Thread;Ljava/lang/Object;Ljava/lang/Class;)V
*/
JNIEXPORT void JNICALL Java_org_dacapo_instrument_Agent_internalAllocReport
(JNIEnv *jni_env, jclass agent_klass, jthread thread, jobject object, jclass klass)
{
jlong size = 0;
JVMTI_FUNC_PTR(baseEnv,GetObjectSize)(baseEnv,object,&size);
callbackVMObjectAlloc(baseEnv, jni_env, thread, object, klass, size);
}
/* Callback for JVMTI_EVENT_VM_OBJECT_ALLOC */
void JNICALL callbackVMObjectAlloc(jvmtiEnv *jvmti, JNIEnv *env, jthread thread,
void JNICALL callbackVMObjectAlloc(jvmtiEnv *jvmti, JNIEnv *jni_env, jthread thread,
jobject object, jclass object_klass, jlong size)
{
if (jvmRunning && !jvmStopped) {
jlong class_tag = 0;
jniNativeInterface* jni_table = JNIFunctionTable();
jlong object_klass_tag = 0;
jlong thread_tag = 0;
jclass thread_klass = JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,object);
jlong thread_klass_tag = 0;
gcCount += size;
if (0<gcForceCycle && gcForceCycle<gcCount)
forceGC(env);
forceGC(jni_env);
rawMonitorEnter(&lockTag);
jlong tag = setTag(object, size);
jboolean class_has_new_tag = getTag(object_klass, &class_tag);
jboolean object_klass_has_new_tag = getTag(object_klass, &object_klass_tag);
jboolean thread_has_new_tag = getTag(thread, &thread_tag);
jboolean thread_klass_has_new_tag = getTag(thread_klass, &thread_klass_tag);
rawMonitorExit(&lockTag);
/* trace allocation */
......@@ -81,19 +159,10 @@ void JNICALL callbackVMObjectAlloc(jvmtiEnv *jvmti, JNIEnv *env, jthread thread,
log_field_string(LOG_PREFIX_ALLOCATION);
log_field_current_time();
log_field_jlong(tag);
if (class_has_new_tag) {
jniNativeInterface* jni_table;
if (JVMTI_FUNC_PTR(baseEnv,GetJNIFunctionTable)(baseEnv,&jni_table) != JNI_OK) {
fprintf(stderr, "failed to get JNI function table\n");
exit(1);
}
LOG_CLASS(jni_table,baseEnv,object_klass);
} else
log_field_string(NULL);
log_thread(thread,thread_tag,thread_has_new_tag,object_klass,object_klass_tag,object_klass_has_new_tag);
thread_log(env,thread,thread_tag,thread_has_new_tag);
log_field_jlong(tag);
log_class(object_klass,object_klass_tag,object_klass_has_new_tag);
log_field_jlong(size);
......@@ -107,10 +176,12 @@ void JNICALL callbackObjectFree(jvmtiEnv *jvmti, jlong tag)
{
if (jvmRunning && !jvmStopped) {
/* trace free */
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_FREE);
log_field_current_time();
log_field_jlong(tag);
log_eol();
rawMonitorExit(&lockLog);
}
}
......@@ -49,7 +49,7 @@ void allocation_capabilities(const jvmtiCapabilities* availableCapabilities, jvm
void allocation_callbacks(const jvmtiCapabilities* capabilities, jvmtiEventCallbacks* callbacks);
void allocation_live(jvmtiEnv* jvmti, JNIEnv* env);
void allocation_logon(JNIEnv* env);
void allocation_class(jvmtiEnv *env, JNIEnv *jnienv, jclass klass);
void allocation_class(jvmtiEnv *env, JNIEnv *jnienv, jthread thread, jclass klass);
void JNICALL callbackVMObjectAlloc(jvmtiEnv *jvmti, JNIEnv *env, jthread thread,
jobject object, jclass object_klass, jlong size);
......
......@@ -34,11 +34,16 @@ void call_chain_logon(JNIEnv* env) {
#define MAX_NUMBER_OF_FRAMES 64
#define START_FRAME 4
void log_call_chain(JNIEnv *env, jclass klass, jobject thread) {
void log_call_chain(JNIEnv *jni_env, jclass klass, jobject thread) {
jniNativeInterface* jni_table = JNIFunctionTable();
jlong thread_tag = 0;
jclass thread_klass = JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,thread);
jlong thread_klass_tag = 0;
rawMonitorEnter(&lockTag);
jboolean thread_has_new_tag = getTag(thread, &thread_tag);
jboolean thread_klass_has_new_tag = getTag(thread_klass, &thread_klass_tag);
rawMonitorExit(&lockTag);
/* iterate through frames */
......@@ -50,26 +55,27 @@ void log_call_chain(JNIEnv *env, jclass klass, jobject thread) {
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_CALL_CHAIN_START);
thread_log(env, thread, thread_tag, thread_has_new_tag);
log_thread(thread,thread_tag,thread_has_new_tag,thread_klass,thread_klass_tag,thread_klass_has_new_tag);
log_eol();
jniNativeInterface* jni_table;
if (JVMTI_FUNC_PTR(baseEnv,GetJNIFunctionTable)(baseEnv,&jni_table) != JNI_OK) {
fprintf(stderr, "failed to get JNI function table\n");
exit(1);
}
rawMonitorExit(&lockLog);
int i;
for(i=0; i<count; i++) {
jlong class_tag = 0;
jclass klass = NULL;
jlong klass_tag = 0;
err = JVMTI_FUNC_PTR(baseEnv,GetMethodDeclaringClass)(baseEnv,frames[i].method,&klass);
rawMonitorEnter(&lockTag);
jboolean klass_has_new_tag = getTag(klass,&klass_tag);
rawMonitorExit(&lockTag);
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_CALL_CHAIN_FRAME);
log_field_jlong(thread_tag);
log_field_jlong((jlong)i);
jclass declClass = NULL;
err = JVMTI_FUNC_PTR(baseEnv,GetMethodDeclaringClass)(baseEnv,frames[i].method,&declClass);
getTag(declClass,&class_tag);
LOG_CLASS(jni_table,baseEnv,declClass);
log_class(klass,klass_tag,klass_has_new_tag);
char* name_ptr = NULL;
char* signature_ptr = NULL;
......@@ -88,6 +94,7 @@ void log_call_chain(JNIEnv *env, jclass klass, jobject thread) {
if (generic_ptr!=NULL) JVMTI_FUNC_PTR(baseEnv,Deallocate)(baseEnv,(unsigned char*)generic_ptr);
log_eol();
rawMonitorExit(&lockLog);
}
/*
......@@ -109,6 +116,7 @@ void log_call_chain(JNIEnv *env, jclass klass, jobject thread) {
}
*/
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_CALL_CHAIN_STOP);
log_field_jlong(thread_tag);
log_eol();
......
......@@ -30,7 +30,7 @@ void exception_logon(JNIEnv* env) {
}
void exception_class(jvmtiEnv *env, JNIEnv *jnienv, jclass klass) {
void exception_class(jvmtiEnv *env, JNIEnv *jnienv, jthread thread, jclass klass) {
}
......@@ -44,37 +44,35 @@ void exception_callbacks(const jvmtiCapabilities* capabilities, jvmtiEventCallba
void JNICALL callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location)
{
if (logState) {
jniNativeInterface* jni_table = JNIFunctionTable();
jlong thread_tag = 0;
jlong exception_tag = 0;
jlong klass_tag = 0;
jlong exception_klass_tag = 0;
jclass klass = JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,thread);
jobject exception_klass = JVM_FUNC_PTR(jni_table,GetObjectClass)(jni_env,exception);
rawMonitorEnter(&lockTag);
jboolean thread_has_new_tag = getTag(thread, &thread_tag);
jboolean exception_has_new_tag = getTag(exception, &exception_tag);
jboolean klass_has_new_tag = getTag(klass, &klass_tag);
jboolean exception_klass_has_new_tag = getTag(exception_klass, &exception_klass_tag);
rawMonitorExit(&lockTag);
rawMonitorEnter(&lockLog);
log_field_string(LOG_PREFIX_EXCEPTION);
thread_log(jni_env, thread, thread_tag, thread_has_new_tag);
log_thread(thread, thread_tag, thread_has_new_tag, klass, klass_tag, klass_has_new_tag);
jniNativeInterface* jni_table;
if (exception_has_new_tag) {
if (JVMTI_FUNC_PTR(baseEnv,GetJNIFunctionTable)(baseEnv,&jni_table) != JNI_OK) {
fprintf(stderr, "failed to get JNI function table\n");
exit(1);
}
}
log_field_jlong(exception_tag);
if (exception_has_new_tag) {