1*795d594fSAndroid Build Coastguard Worker# listextensions 2*795d594fSAndroid Build Coastguard Worker 3*795d594fSAndroid Build Coastguard Workerlistextensions is a jvmti agent that will print the details of all available jvmti extension 4*795d594fSAndroid Build Coastguard Workerfunctions and events. 5*795d594fSAndroid Build Coastguard Worker 6*795d594fSAndroid Build Coastguard Worker# Usage 7*795d594fSAndroid Build Coastguard Worker### Build 8*795d594fSAndroid Build Coastguard Worker> `m liblistextensions` 9*795d594fSAndroid Build Coastguard Worker 10*795d594fSAndroid Build Coastguard WorkerThe libraries will be built for 32-bit, 64-bit, host and target. Below examples 11*795d594fSAndroid Build Coastguard Workerassume you want to use the 64-bit version. 12*795d594fSAndroid Build Coastguard Worker 13*795d594fSAndroid Build Coastguard Worker#### ART 14*795d594fSAndroid Build Coastguard Worker> `art -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so '-agentpath:liblistextensions.so' -cp tmp/java/helloworld.dex -Xint helloworld` 15*795d594fSAndroid Build Coastguard Worker 16*795d594fSAndroid Build Coastguard WorkerThis will print something similar to: 17*795d594fSAndroid Build Coastguard Worker``` 18*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:104] Found 13 extension functions 19*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:107] com.android.art.heap.get_object_heap_id 20*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:108] desc: Retrieve the heap id of the object tagged with the given argument. An arbitrary object is chosen if multiple objects exist with the same tag. 21*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:109] arguments: (count: 2) 22*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] tag (IN, JLONG) 23*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] heap_id (OUT, JINT) 24*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:114] Errors: (count: 1) 25*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:118] JVMTI_ERROR_NOT_FOUND 26*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:107] com.android.art.heap.get_heap_name 27*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:108] desc: Retrieve the name of the heap with the given id. 28*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:109] arguments: (count: 2) 29*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] heap_id (IN, JINT) 30*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] heap_name (ALLOC_BUF, CCHAR) 31*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:114] Errors: (count: 1) 32*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:118] JVMTI_ERROR_ILLEGAL_ARGUMENT 33*795d594fSAndroid Build Coastguard Worker... 34*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:130] Found 2 extension events 35*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:133] com.android.art.internal.ddm.publish_chunk 36*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:134] index: 86 37*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:135] desc: Called when there is new ddms information that the agent or other clients can use. The agent is given the 'type' of the ddms chunk and a 'data_size' byte-buffer in 'data'. The 'data' pointer is only valid for the duration of the publish_chunk event. The agent is responsible for interpreting the information present in the 'data' buffer. This is provided for backwards-compatibility support only. Agents should prefer to use relevant JVMTI events and functions above listening for this event. 38*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:136] event arguments: (count: 4) 39*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] jni_env (IN_PTR, JNIENV) 40*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] type (IN, JINT) 41*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] data_size (IN, JINT) 42*795d594fSAndroid Build Coastguard Workerdalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] data (IN_BUF, JBYTE) 43*795d594fSAndroid Build Coastguard Worker... 44*795d594fSAndroid Build Coastguard Worker``` 45*795d594fSAndroid Build Coastguard Worker 46*795d594fSAndroid Build Coastguard Worker* `-Xplugin` and `-agentpath` need to be used, otherwise the agent will fail during init. 47*795d594fSAndroid Build Coastguard Worker* If using `libartd.so`, make sure to use the debug version of jvmti. 48*795d594fSAndroid Build Coastguard Worker 49*795d594fSAndroid Build Coastguard Worker> `adb shell setenforce 0` 50*795d594fSAndroid Build Coastguard Worker> 51*795d594fSAndroid Build Coastguard Worker> `adb push $ANDROID_PRODUCT_OUT/system/lib64/liblistextensions.so /data/local/tmp/` 52*795d594fSAndroid Build Coastguard Worker> 53*795d594fSAndroid Build Coastguard Worker> `adb shell am start-activity --attach-agent /data/local/tmp/liblistextensions.so some.debuggable.apps/.the.app.MainActivity` 54*795d594fSAndroid Build Coastguard Worker 55*795d594fSAndroid Build Coastguard Worker#### RI 56*795d594fSAndroid Build Coastguard Worker> `java -agentpath:liblistextensions.so -cp tmp/helloworld/classes helloworld` 57