History log of /art/dt_fd_forward/dt_fd_forward.h
Revision Date Author Comments
15b8113eb72b829e2026477a49e159635a48349b 24-Jan-2018 Alex Light <allight@google.com> Have adbconnection handle DDMS packets if agent not loaded

If DDMS was being used on a userdebug or eng build it would cause the
libjdwp agent to be loaded on various system processes, most notably
system_server. This would cause a massive performance hit as it tries
to force system_server to jit but, due to security policies, it is
forced to interpreter instead.

To fix this we make it so that (so long as no debugger commands are
issued) DDMS commands are handled without loading the JDWP agent. When
a non-DDMS command is issued we will load and initialize the JDWP
agent which will take over handling DDMS traffic from then on.

This will ensure that in the common (for userdebug) use-case where
processes only encounter DDMS commands the process will not need to
load the full debugger.

Test: ./test.py --host -j50
Test: ./art/tools/run-libjdwp-tests.sh --mode=device
Test: Run ddms monitor on host,
adb shell stop &&
adb shell setprop dalvik.vm.jdwp-provider adbconnection
adb shell start;
Ensure that device does not start to jank
Test: Run ddms monitor on host,
adb shell stop &&
adb shell setprop dalvik.vm.jdwp-provider adbconnection
adb shell start;
Turn off ddms monitor.
Ensure that device does not start to jank
Test: Build and run
Test: use ddms monitor.
Test: Use Android Studio.
Test: Build and debug debuggable app (bandhook-kotlin)
Test: Build and debug non-debuggable app on userdebug build
(bandhook-kotlin)
Test: Debug running system process on userdebug build
(com.android.packageinstaller)

Bug: 62821960
Bug: 72456312
Bug: 72457427

Change-Id: Ib8d2af6c76bd2fac5a4b27e730695b2d016d3583
3979571aa1dfc907569fb7e27ab225ca89f6f86e 14-Dec-2017 Alex Light <allight@google.com> Add fd-forwarding transport lib

dt_fd_forward is a jdwpTransport that takes as an address a local
socket file-descriptor and uses it to allow some other piece of code
or program to control the actual attach and communication process.

tools/dt_fds_forward.py is a python program that can be used as a
controller for this comms system. This is useful for testing. It
implements the same behavior (excepting DDMS) that the adbconnection
plugin will but is capable of being easily used on normal host
machines. Unlike the plugin, dt_fds_forward.py works by allowing a
socket file-descriptor to be inherited by the forked Java Language
Runtime.

The overall goal of this transport is to use it to allow us to safely
multiplex the out-bound data with DDMS data. This is needed to let us
match current DDMS behavior which transmits packets in the blind on
the same channel JDWP traffic is sent on.

Test: ./tools/dt_fds_forward.py \
./test/run-test --host --dev 001-HelloWorld
Test: jdb -attach localhost:12345
Test: nc localhost 12345, handshake, disconnect
Test: jdb -attach localhost:12345, detach, attach

Test: ./tools/dt_fds_forward.py \
--debug-lib $JAVA_HOME/jre/lib/amd64/libjdwp.so \
-- \
./test/run-test --host --jvm --dev 001-HelloWorld
Test: jdb -attach localhost:12345

Bug: 62821960
Bug: 69169846

Change-Id: I654db6c6991c006933e1e1f0a4e41c13f795f9a8