Questions tagged [jvmti]

JVMTI is the Java Virtual Machine Tool Interface, a native API by which authors can write JVM plugins to monitor or modify the execution of a Java Virtual Machine.

Documentation for the current JVMTI 1.2. Home page for JVMTI in JDK 7.

JVMTI was introduced in JDK 5. It replaces Java Virtual Machine Profiler Interface (JVMPI) and the Java Virtual Machine Debug Interface (JVMDI).

214 questions
2
votes
1 answer

How is Java's JDI cross platform if JVMTI is not?

So Java's debug interface is using JVMTI as a backend....but JVMTI needs to be compiled on the target architecture, so are these JVMTI functions which are used by JDI pre-compiled and shipped with the JDK as libraries? This would mean that I can use…
Nfff3
  • 321
  • 8
  • 24
2
votes
1 answer

Compile an Agent without errors and the message of "not valid Windows image"

since one week I'm trying to compile a demo Version of the JVMTI demo set. In this case I tried to compile the HeapViewer Source Code (I just renamed the file HeapViewer.c to HeapViewerByMG). I tried different compiler and used mainly the following…
Markus G.
  • 331
  • 1
  • 14
2
votes
1 answer

Is it possible to get JDI's current StackFrame in Java at the debuggee side?

So, JDI allows us to set a breakpoint in the debuggee app and then get the current StackFrame via JDWP. To my understanding, JVMTI is used at the debuggee side to send the requested information to JDI through JDWP. Is it possible to get the current…
Nfff3
  • 321
  • 8
  • 24
2
votes
1 answer

JNI GetObjectClass with primitive type

I have the following JNI/JVMTI code: jfieldID field = ...; jobject fieldValue = (*jni_env)->GetObjectField(jni_env, jObjectInstance, field); jclass fieldClass = (*jni_env)->GetObjectClass(jni_env, fieldValue); char* signature_ptr; char*…
spreiter301
  • 314
  • 1
  • 12
2
votes
0 answers

How to put a breakpoint on every line in the code using JVMTI?

According to the documentation, I have to use jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) Basically, I need to iterate over each class, then get each method of each class, and then put a…
Nfff3
  • 321
  • 8
  • 24
2
votes
1 answer

Measure execution time of Java with JVMTI

For the profiler which I implement using JVMTI I would like to start measuring the execution time of all Java methods. The JVMTI offers the events: MethodEntry MethodExit So this would be quite easy to implement, however I came across this note in…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
2
votes
0 answers

Android invoke JVMTI from java side via JNI failed, pointer is NULL

I had wrote a agent to use the JVMTI on android 9. Code like this, I create an AgentFunction object to monitor the VM. It work's fine. AgentFunction *agent = 0; JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *options, void *reserved) { …
user6361246
  • 93
  • 1
  • 8
2
votes
2 answers

Profiling JVMs with JVMTI, how to distinguish the different JVMs?

I am writing a profiler with the aid of the JVM TI. In C++ I have written a simple agent, which writes the information collected to a socket. With Java Swing I have built a simple GUI which reads these data from a socket to visualize it. However I…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
2
votes
5 answers

Identify the current JVM with Java or JVMTI

I would like to identify the current JVM which is run. In the best case with a function described in the JVMTI Documentation, but I cannot find anything. What I meant, is something like this: VirtualMachine.list() delivers:…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
2
votes
4 answers

Features for profiling concurrent program behaviour in Java

Nowadays there are some profilers which promise to profile concurrent behavior of program execution in order to understand the threaded execution. I am collection features which would be useful for a Java profiler concentrating on profiling…
2
votes
2 answers

Link library name for JVM TI

I am trying to write a JVM TI sample agent on Mac OS X. I have Java 5 installed. I want to know against which dynamic library should I link my sample agent code?
Prahalad Deshpande
  • 4,709
  • 1
  • 20
  • 22
2
votes
0 answers

How to call a method from a specific thread context using JVMTI and JNI?

We are using JVMTI and JNI to issue static method calls in method entry and method exit callbacks of the JVMTI. We have a need to be able to call a static method on a Thread Context other then the Thread Context that JVMTI has issued the callback…
Amy
  • 21
  • 1
2
votes
1 answer

Java agent, instrumentation and array creation

I need to write an agent for my java application, that does some specific stuff on every array creation. So far I was unable to find any way to run my code on this event. java.lang.instrument.ClassFileTransformer does not get "array classes", so no…
Nikem
  • 5,716
  • 3
  • 32
  • 59
2
votes
1 answer

How to do programmatic profiling while running a testng

I'm planning to do some profiling around a set of regression test cases. My idea is to leverage AOP around the testng methods which will invoke some profiling tool api and print the profiled data at the end of the test case execution. I want to log…
Shamik
  • 1,671
  • 11
  • 36
  • 64
2
votes
1 answer

Accessing class fields for their value

I'm writing JVMTI agent and I'm trying to access specific class fields values at some point when I got jobject. I know they are located on heap instead of stack. Looking at this unfortunately doesn't help…
fritz
  • 23
  • 4