I am writing a Java instrumentation program that uses the built-in Instrumentation API with Javassist (v3.26.0-GA) to intercept all the method calls in the target program. Also, I have implemented a REST API service inside this program using Java Spark to send requests for starting/stopping instrumentation by adding/removing transformers, and also for fetching intercepted methods during the instrumentation time. Now,
Tag: instrumentation
Make a Java class visible from any ClassLoader
I’m using a Java Agent (Agent.class) to transform a method in a program (Program.class) in a way that includes a call to the Agent class. I’ve inspected the class loaders and their parents of both Agent and Program classes, and their hierarchy looks like this: Agent.class: AppClassLoader <- PlatformClassLoader <- null Program.class: URLClassLoader <- PlatformClassLoader <- null When the Program
Profiled application started too soon
When I try to perform the application startup profiling getting Profiled application started too soon have attached error message screenshot below. This warning shows after I forcibly killed a previously profiled application. Have restarted my system but still shows that warning. Thanks in advance. Answer After analysing the visualvm source code, there is a file (${user.home}/.nbprofiler/5140) which will be create
How to dynamically cast an object (of class Object) to the method return type using ASM?
What I want to do is to modify a method using ASM: I push an object (of class Object) to the stack I want to cast that object to the return type of that method Return that casted object. My code in …
Can JVM bytecode running on the GraalVM be instrumented by a custom `TruffleInstrument`?
I would like to write a Truffle instrument which can instrument Java programs (or at least JVM bytecode programs) when they are run on GraalVM. I have been investigating different ways to perform fine-grained instrumentation of Java programs to support a runtime verification project. To me, manipulating Truffle AST nodes sounds much more attractive than the more traditional Java instrumentation
How to get arround java.lang.verrifyError
I am trying to generate a random number with the instrumented code. For that I have added following expression to generate a random number. But it is throwing a verify Error as given below. I have added a long variable and assign the above generated value. But I am getting following exception during the run time. But if I run