I am trying to record the state of the application when an Exception occurs within the application, i am specifically interested with the method local variable values(Both Primitive and User Defined)? i have gone through the documentation of ASM 5.1, but i couldn't find any interfaces which lets me access the values? is there a way to do this, if not using ASM are there any other Interfaces which would let me do this ? The solution should be independent of the application, it should be a plug and play type solution, using which i should be able to plug it to any java application.
Getting Field Ids using JNI:
char *klazName;
error = (*jvmti)->GetLocalObject(jvmti, thread, i,
table_ptr[j].slot, &value_ptr);
check_jvmti_error(jvmti, error,
"Cannot Get Local Variable Object");
if(!error){
klaz = (*env)->GetObjectClass(env,value_ptr);
error = (*jvmti)->GetClassSignature(jvmti, klaz,
&klazName, NULL);
if(strstr(klazName,"String")!=NULL){
printf("...%s\n",klazName);
field = (*env)->GetFieldID(env,declaring_class_ptr,table_ptr[j].name,"S");
value = (jstring)(*env)->GetObjectField(env,value_ptr,field);
stringVal = (*env)->GetStringUTFChars(env,value,0);
printf("Value of Field %s is .\n", stringVal);