| 1 |
# listextensions |
| 2 |
|
| 3 |
listextensions is a jvmti agent that will print the details of all available jvmti extension |
| 4 |
functions and events. |
| 5 |
|
| 6 |
# Usage |
| 7 |
### Build |
| 8 |
> `m liblistextensions` |
| 9 |
|
| 10 |
The libraries will be built for 32-bit, 64-bit, host and target. Below examples |
| 11 |
assume you want to use the 64-bit version. |
| 12 |
|
| 13 |
#### ART |
| 14 |
> `art -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so '-agentpath:liblistextensions.so' -cp tmp/java/helloworld.dex -Xint helloworld` |
| 15 |
|
| 16 |
This will print something similar to: |
| 17 |
``` |
| 18 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:104] Found 13 extension functions |
| 19 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:107] com.android.art.heap.get_object_heap_id |
| 20 |
dalvikvm64 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 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:109] arguments: (count: 2) |
| 22 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] tag (IN, JLONG) |
| 23 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] heap_id (OUT, JINT) |
| 24 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:114] Errors: (count: 1) |
| 25 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:118] JVMTI_ERROR_NOT_FOUND |
| 26 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:107] com.android.art.heap.get_heap_name |
| 27 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:108] desc: Retrieve the name of the heap with the given id. |
| 28 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:109] arguments: (count: 2) |
| 29 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] heap_id (IN, JINT) |
| 30 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:112] heap_name (ALLOC_BUF, CCHAR) |
| 31 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:114] Errors: (count: 1) |
| 32 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:118] JVMTI_ERROR_ILLEGAL_ARGUMENT |
| 33 |
... |
| 34 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:130] Found 2 extension events |
| 35 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:133] com.android.art.internal.ddm.publish_chunk |
| 36 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:134] index: 86 |
| 37 |
dalvikvm64 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 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:136] event arguments: (count: 4) |
| 39 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] jni_env (IN_PTR, JNIENV) |
| 40 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] type (IN, JINT) |
| 41 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] data_size (IN, JINT) |
| 42 |
dalvikvm64 I 07-30 10:47:37 154719 154719 list-extensions.cc:139] data (IN_BUF, JBYTE) |
| 43 |
... |
| 44 |
``` |
| 45 |
|
| 46 |
* `-Xplugin` and `-agentpath` need to be used, otherwise the agent will fail during init. |
| 47 |
* If using `libartd.so`, make sure to use the debug version of jvmti. |
| 48 |
|
| 49 |
> `adb shell setenforce 0` |
| 50 |
> |
| 51 |
> `adb push $ANDROID_PRODUCT_OUT/system/lib64/liblistextensions.so /data/local/tmp/` |
| 52 |
> |
| 53 |
> `adb shell am start-activity --attach-agent /data/local/tmp/liblistextensions.so some.debuggable.apps/.the.app.MainActivity` |
| 54 |
|
| 55 |
#### RI |
| 56 |
> `java -agentpath:liblistextensions.so -cp tmp/helloworld/classes helloworld` |