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
6
votes
2 answers

How to uniquely distinguish Java's object instance

I'm currently building a native JVMTI agent for Java 1.7. The problem is that I need to index some data regarding specific Java's object instances. So my question is can I use jobject type's value as an object's instance ID to retrieve my indexed…
Gu0sur20
  • 63
  • 1
  • 4
6
votes
3 answers

JDI: How to pause a Java application (JVM) like in the debugger

I am looking for potentially a JDI API to pause the JVM at any arbitrary point during its execution. Looking at the BreakPointRequest createBreakpointRequest method needs a specific location. Is there any other API that does not need a location or…
anurag
  • 117
  • 1
  • 8
6
votes
1 answer

lsof counterpart for a JVM?

lsof is a nice tool for Unix, showing all currently open file handles. Does anyone know a similar tool that would show all open files inside a running JVM (via JVMTI or any similar interface)? In this particular case, it would be sufficient for me…
mindas
  • 26,463
  • 15
  • 97
  • 154
6
votes
1 answer

How to abort long running invokeMethod on com.sun.jdi.ObjectReference?

I have my own JDI Debugger which calls the toString method on some objects: com.sun.jdi.ObjectReferenceobject object = ... ThreadReference threadRef = frameProxy.threadProxy().getThreadReference(); Value value = object.invokeMethod(threadRef,…
Nfff3
  • 321
  • 8
  • 24
6
votes
1 answer

Converting BCI (bytecode indices) to source code line numbers

I am writing JVMTI code to profile Java programs, which mostly entails obtaining stack traces from random threads at fixed time intervals using the function AsyncGetCallTrace. Thus, I am able to obtain CallTrace structures, each of which contains an…
user400348
  • 236
  • 2
  • 7
6
votes
1 answer

Java Attach API: UnsatisfiedLinkError

When using the Java Attach API, I'm getting the following link error on Linux (tried it on different machines) only: Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.tools.attach.WindowsAttachProvider.tempPath()Ljava/lang/String; …
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
6
votes
2 answers

BCI library for Java in C

I am looking for a BCI (Bytecode Instrumentation) library for Java in C or C++, to use in a JVMTI agent. Best case scenario would be something like ASM or BCEL in pure C. The closest thing I have found so far is only a demo java_crw_demo written by…
vektor
  • 3,312
  • 8
  • 41
  • 71
5
votes
1 answer

Byte code instrumentation - implement native or java agent?

If I want to realize a profiler using byte code instrumentation, should I write a native agent using JVMTI or should I write a java agent using the java.lang.instrument package? If I want to use libraries like ASM - which seems to be mandatory if…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
5
votes
1 answer

Identifying exceptions through JVMTI

I'm writing an instrumentation tool for Java applications using JVMTI. I've seen that JVMTI detects when an exception has been thrown and when has been caught according to…
Harald
  • 3,110
  • 1
  • 24
  • 35
5
votes
2 answers

How to uniquely identify thread in jvmti

i'm working on JVMTI agent and I want to identify same thread on method enter and exit. I'm able to obtain thread name, but that's not sufficient. Imagine you have a method like this: public class Main { public static void myMethod() { …
czs
  • 185
  • 2
  • 12
5
votes
2 answers

Hot Swap agent Configuration for multi module project

I need help in configuring hotswap agent in my project for hot deploying class files. In my project we have project setup like below : WebProject (war) | |_ _ Service Project(jar) Service project is used as a jar file in web project. So whenever I…
Onkar Salvi
  • 151
  • 1
  • 10
5
votes
2 answers

how to fix fatal error jvmti.h No such file or directory compilation terminated c code ubuntu?

how to fix fatal error jvmti.h No such file or directory compilation terminated c code ubuntu? my c code is: include "jvmti.h" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { /* We return JNI_OK to signify success…
Blue Rose
  • 101
  • 1
  • 2
  • 6
5
votes
1 answer

java agent with jvmti load at runtime, unload from within

I'm writing a Java agent to interact with JVMTI. For reasons I won't get into, I need to use JVMTI (the C interface inside the java process) rather than the Java APIs like java.lang.instrument or JDI. I would like to be able to do a couple of things…
Dan
  • 7,155
  • 2
  • 29
  • 54
5
votes
2 answers

Java Bytecode Instrumentation: NullPointerException in reflective call to defineClass

Intent: I'm using the java.lang.instrument package to create some instrumentation for Java programs. The idea is that I use bytecode manipulation via this system in order to add method calls at the beginning and end of each method. Generally…
Dylan
  • 13,645
  • 3
  • 40
  • 67
5
votes
2 answers

Attaching Java VisualVM for CPU-Profiling leads to JVMTI error 66

When using VisualVM for cpu-profiling of my application, I run into the error "Profiler Agent Error: with message: Redefinition failed with error 66". Upon that, it copies all the class-files from the build path to the location I've started the…
chrisstr
  • 53
  • 1
  • 5
1
2
3
14 15