xref: /aosp_15_r20/art/tools/jvmti-agents/wrapagentproperties/README.md (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker# wrapagentproperties
2*795d594fSAndroid Build Coastguard Worker
3*795d594fSAndroid Build Coastguard Workerwrapagentproperties is a JVMTI agent that lets one change the returned values of
4*795d594fSAndroid Build Coastguard Workeran agents GetSystemPropert{y,ies} calls.
5*795d594fSAndroid Build Coastguard Worker
6*795d594fSAndroid Build Coastguard Worker# Usage
7*795d594fSAndroid Build Coastguard Worker### Build
8*795d594fSAndroid Build Coastguard Worker>    `m libwrapagentproperties`  # or 'm libwrapagentpropertiesd' with debugging checks enabled
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### Command Line
14*795d594fSAndroid Build Coastguard Worker#### ART
15*795d594fSAndroid Build Coastguard Worker>    `art -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so -agentpath:$ANDROID_HOST_OUT/lib64/libwrapagentproperties.so=/path/to/prop.file,/path/to/agent=agent-args -cp tmp/java/helloworld.dex -Xint helloworld`
16*795d594fSAndroid Build Coastguard Worker
17*795d594fSAndroid Build Coastguard Worker* `-Xplugin` and `-agentpath` need to be used, otherwise libtitrace agent will fail during init.
18*795d594fSAndroid Build Coastguard Worker* If using `libartd.so`, make sure to use the debug version of jvmti.
19*795d594fSAndroid Build Coastguard Worker
20*795d594fSAndroid Build Coastguard Worker### prop file format.
21*795d594fSAndroid Build Coastguard Worker
22*795d594fSAndroid Build Coastguard WorkerThe property file is a text file containing the values of java properties you
23*795d594fSAndroid Build Coastguard Workerwish to override. The format is property=value on each line. Blank lines and
24*795d594fSAndroid Build Coastguard Workerlines beginning with "#" are ignored.
25*795d594fSAndroid Build Coastguard Worker
26*795d594fSAndroid Build Coastguard Worker#### Example prop file
27*795d594fSAndroid Build Coastguard Worker
28*795d594fSAndroid Build Coastguard Worker    # abc.prop
29*795d594fSAndroid Build Coastguard Worker    abc.def=123
30*795d594fSAndroid Build Coastguard Worker    def.hij=a big deal
31