I am writing a jvmti agent for java programs.I am trying to read objects on the stack.Using jnienv pointer received on VMinit/vmstart event. I succeeded in reading objects upon methodexit event using the foll: get varaible (slot) from getlocalvariableentry() ; from the variable signature use jni functions to get object, use getlocalobject function for a reference object/subclass of object.Then if its a subclass of object; jni::getobjectclass(); use returned class and obtain fields in the class; using getclassfields(); then get field signature from getfieldname(); then call appropriate function for the field as per its signature eg getintfield() for int field. Howver once I try this upon Objects created within a try block within the function for which methodexit event is raised; I get a crash(SIGSEGV) everytime at Getobjectclass() .Is this because the object has gotten destroyed being out of scope; If so how to read values of variables in a try block of a function at function exit. obtain crash when upon reading a jobject for Integer (from localvariabletableentry) object , I call getintfield() for its int field member MIN_VALUE which is its first member.If I just try to read member "value" of Integer class then calling getintfield() does not crash. Is this crash because Im trying to read a static final member of a class ie. member MIN_VALUE Of integer class. How to come around this and avoid the crashes?
Asked
Active
Viewed 223 times
0
-
1) How to know if a jobject gotten via GetLocalobject is destroyed already or not? – Debugger Mar 21 '17 at 16:17
-
2) How to know if a field of a class(obtained via Getclassfields) is a static or final member of its class – Debugger Mar 21 '17 at 16:18
-
3) the getobjectclass crashes when jobject refers to a class object which is empty (has no members) and is in a try block within the function upon whose exit getobjectclass is called – Debugger Mar 21 '17 at 16:21