xref: /aosp_15_r20/art/tools/jvmti-agents/dump-jvmti-state/README.md (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker# dumpjvmti
2*795d594fSAndroid Build Coastguard Worker
3*795d594fSAndroid Build Coastguard Workerdumpjvmti is a JVMTI agent designed for helping debug the working of the openjdkjvmti plugin. It
4*795d594fSAndroid Build Coastguard Workerallows one to use SIGQUIT to dump information about the current JVMTI state to logcat. It does
5*795d594fSAndroid Build Coastguard Workerthis by calling the com.android.art.misc.get_plugin_internal_state extension function.
6*795d594fSAndroid Build Coastguard Worker
7*795d594fSAndroid Build Coastguard Worker# Usage
8*795d594fSAndroid Build Coastguard Worker### Build
9*795d594fSAndroid Build Coastguard Worker>    `m libdumpjvmti`
10*795d594fSAndroid Build Coastguard Worker
11*795d594fSAndroid Build Coastguard WorkerThe libraries will be built for 32-bit, 64-bit, host and target. Below examples
12*795d594fSAndroid Build Coastguard Workerassume you want to use the 64-bit version.
13*795d594fSAndroid Build Coastguard Worker
14*795d594fSAndroid Build Coastguard Worker#### ART
15*795d594fSAndroid Build Coastguard Worker>    `art -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so '-agentpath:libdumpjvmti.so' -cp tmp/java/helloworld.dex -Xint helloworld`
16*795d594fSAndroid Build Coastguard Worker>    `kill -3 <pid>`
17*795d594fSAndroid Build Coastguard Worker
18*795d594fSAndroid Build Coastguard Worker* `-Xplugin` and `-agentpath` need to be used, otherwise the agent will fail during init.
19*795d594fSAndroid Build Coastguard Worker* If using `libartd.so`, make sure to use the debug version of jvmti.
20*795d594fSAndroid Build Coastguard Worker
21*795d594fSAndroid Build Coastguard Worker>    `adb shell setenforce 0`
22*795d594fSAndroid Build Coastguard Worker>
23*795d594fSAndroid Build Coastguard Worker>    `adb push $ANDROID_PRODUCT_OUT/system/lib64/libdumpjvmti.so /data/local/tmp/`
24*795d594fSAndroid Build Coastguard Worker>
25*795d594fSAndroid Build Coastguard Worker>    `adb shell am start-activity --attach-agent /data/local/tmp/libdumpjvmti.so some.debuggable.apps/.the.app.MainActivity`
26*795d594fSAndroid Build Coastguard Worker>
27*795d594fSAndroid Build Coastguard Worker>    `adb shell kill -3 $(adb shell pidof some.debuggable.apps)`
28