File: README.md

package info (click to toggle)
android-platform-art 11.0.0%2Br48-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,932 kB
  • sloc: cpp: 459,858; java: 163,268; asm: 22,644; python: 9,815; sh: 6,330; ansic: 4,117; xml: 2,855; perl: 77; makefile: 73
file content (33 lines) | stat: -rw-r--r-- 1,585 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# forceredfine

ForceRedefine is a JVMTI agent designed for testing how redefiniton affects running processes. It
allows one to force classes to be redefined by writing to a fifo or give a process a list of
classes to try redefining. Currently the redefinition is limited to adding (or removing) a single
NOP at the beginning of every function in the class.

# Usage
### Build
>    `m libforceredefine`

The libraries will be built for 32-bit, 64-bit, host and target. Below examples
assume you want to use the 64-bit version.

#### ART
>    `adb shell setenforce 0`
>
>    `adb push $ANDROID_PRODUCT_OUT/system/lib64/libforceredefine.so /data/local/tmp/`
>
>    `echo java/util/ArrayList > /tmp/classlist`
>    `echo java/util/Arrays >> /tmp/classlist`
>    `adb push /tmp/classlist /data/local/tmp/`
>
>    `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist`

Since the agent has no static state it can be attached multiple times to the same process.

>    `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist`
>    `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist2`
>    `adb shell am attach-agent $(adb shell pidof some.deubggable.app) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist`

One can also use fifos to send classes interactively to the process. (TODO: Have the agent
continue reading from the fifo even after it gets an EOF.)