If I use jvmti_env->GetClassFields(objClass, &numOfFields, &fieldIds);
I still have to decide whether to call GetStatic<Type>Field or Get<Type>Field.
How do I determine which one to use? I know that in java.lang.reflect.Field I can query fields' modifiers for static.
I've found a workaround here:
http://zoo.cs.yale.edu/classes/cs433/programming/examples-java-socket/jdk1.5/hotspot/src/share/vm/runtime/jfieldIDWorkaround.hpp
But I prefer a solution from the JVM.
Thanks!
Use function GetFieldModifiers in JVMTI.
Values returned by this function are described here: http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#1480
So for static you should check like this: