Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
Android.bp | D | 23-Nov-2023 | 1.8 KiB | 69 | 63 | |
README.md | D | 23-Nov-2023 | 1.5 KiB | 34 | 26 | |
forceredefine.cc | D | 23-Nov-2023 | 9.8 KiB | 318 | 260 |
README.md
1# forceredfine 2 3ForceRedefine is a JVMTI agent designed for testing how redefiniton affects running processes. It 4allows one to force classes to be redefined by writing to a fifo or give a process a list of 5classes to try redefining. Currently the redefinition is limited to adding (or removing) a single 6NOP at the beginning of every function in the class. 7 8# Usage 9### Build 10> `m libforceredefine` 11 12The libraries will be built for 32-bit, 64-bit, host and target. Below examples 13assume you want to use the 64-bit version. 14 15#### ART 16> `adb shell setenforce 0` 17> 18> `adb push $ANDROID_PRODUCT_OUT/system/lib64/libforceredefine.so /data/local/tmp/` 19> 20> `echo java/util/ArrayList > /tmp/classlist` 21> `echo java/util/Arrays >> /tmp/classlist` 22> `adb push /tmp/classlist /data/local/tmp/` 23> 24> `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist` 25 26Since the agent has no static state it can be attached multiple times to the same process. 27 28> `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist` 29> `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist2` 30> `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist` 31 32One can also use fifos to send classes interactively to the process. (TODO: Have the agent 33continue reading from the fifo even after it gets an EOF.) 34