Logging calls made by native code
In Java, several native methods e.g. in the Java Runtime Library may call regular (byteco开发者_如何学运维de-based) methods. I would like to know if there is some VM command-line parameter or some instrumentation tool or API that I can use to such calls.
P.S. Note that I am not interested in calls to native code but from native code.
On linux, you could use ltrace to detect calls to the JNI functions that call Java methods, such as CallVoidMethod, CallObjectMethod, etc.
Are you looking for something like Java Native Interface (JNI)?
"The Java Native Interface (JNI) is a programming framework that allows Java code running in a Java Virtual Machine (JVM) to call and to be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages, such as C, C++ and assembly."
JNI Wikipedia Article
精彩评论