3 ms·
Java Agents
- lewich 5y agoSuprized to see this on top of HN.
- cpach 5y agoWhy are you surprised?
- matsemann 5y agoBecause tutorials often aren't featured here. Especially not video tutorials. If it introduced a concept or something it would be more in line what's normal on here. As a Javadeveloper for many years for which this could be relevant, I'm not too interested because it's not selling why it's useful, just diving into lots of code. So to be a bit blunt, but I don't think the quality warrants being on top. And I know one's not supposed to speculate, but multiple upvotes in short time without any discussion for something of this caliber is a bit off.
- native_samples 5y agoJava agents are neat, but what relatively few people realize is that there are two agent APIs, one for agents written in Java and one for agents written in C++. The latter is drastically more powerful but hardly ever used. It exposes all the functionality available to Java agents like class redefinition, and then a lot more. The C++ API gives you access to, amongst other things: manipulating the stack by reading/writing local variables or forcing early returns with values of your choice, learning what locks a thread holds, walking the heap including unreachable objects, tagging objects, adding field watches, getting the bytecodes of a method, intercepting the entire JNI API, receiving callbacks on dozens of different events including things like field modification, JITC, object allocation and the begin/end of GC. Very few people really take advantage of this API, even though it can be used to achieve remarkable effects all against public, stable API.
- J-Kuhn 5y agoIt's called the Java VM Tool Interface (JVMTI) - and it's C, not C++. The Java debugger is implemented on top of the JVMTI.