Native JVMTI agent for full debugger-level local variable capture on exceptions.
The standard Java agent (ByteBuddy) can only capture:
- Method arguments
- Instance fields (
this.xxx)
This JVMTI agent captures everything a debugger sees:
- All local variables in each stack frame
- Method arguments
- Instance fields
- Static fields
- Full object state
- Java Application: Must be compiled with
-g(debug info) for local variable names - Build Tools: CMake 3.10+, C compiler (gcc/clang/MSVC)
- JAVA_HOME: Must be set to JDK installation
mkdir build && cd build
cmake ..
makeOutput: libaivory_jvmti.so (Linux) or libaivory_jvmti.dylib (macOS)
mkdir build && cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build . --config ReleaseOutput: aivory_jvmti.dll
Load both the JVMTI native agent and the Java agent:
java \
-agentpath:/path/to/libaivory_jvmti.so=debug \
-javaagent:/path/to/aivory-agent.jar \
-Daivory.api.key=YOUR_API_KEY \
-jar your-application.jardebug- Enable debug logging from native agent
- JVMTI Exception Event: When any exception is thrown, JVMTI fires a callback
- Non-Blocking: The callback runs in the throwing thread but does NOT pause execution
- Variable Capture: Uses
GetLocalVariableTable+GetLocal*JVMTI functions - JNI Callback: Captured data is passed to Java agent via
JVMTICallback.onException() - Backend Transmission: Java agent sends the enriched data to AIVory backend
- Escape Analysis: JVMTI with
can_access_local_variablescapability may disable EA optimization - Filtering: Internal Java/JDK classes are skipped to reduce overhead
- Deduplication: Same exception instance is only captured once as it propagates
| Feature | ByteBuddy Only | With JVMTI Agent |
|---|---|---|
| Method arguments | Yes | Yes |
| Instance fields | Yes | Yes |
| Local variables | No | Yes |
| All stack frames | No | Yes |
| Requires -g flag | No | Yes |
| Native code | No | Yes |
The Java code was not compiled with debug info. Add -g to javac:
javac -g MyClass.javaOr in Maven:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>Check that:
JAVA_HOMEpoints to a JDK (not JRE)- The native library matches your OS/architecture
- Both
-agentpathand-javaagentare specified