Up to higher level directory | |||
Name | Date | Size | |
---|---|---|---|
Android.bp | 22-Oct-2020 | 2.2K | |
forceredefine.cc | 22-Oct-2020 | 9.8K | |
README.md | 22-Oct-2020 | 1.5K |
1 # forceredfine 2 3 ForceRedefine is a JVMTI agent designed for testing how redefiniton affects running processes. It 4 allows one to force classes to be redefined by writing to a fifo or give a process a list of 5 classes to try redefining. Currently the redefinition is limited to adding (or removing) a single 6 NOP at the beginning of every function in the class. 7 8 # Usage 9 ### Build 10 > `make libforceredefine` 11 12 The libraries will be built for 32-bit, 64-bit, host and target. Below examples 13 assume 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 26 Since 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 32 One can also use fifos to send classes interactively to the process. (TODO: Have the agent 33 continue reading from the fifo even after it gets an EOF.)