Add support for selecting alternate JDWP implementations
Change JDWP options parsing to take place later and add a
-XjdwpProvider:_ option that can be used by the runtime to select an
appropriate JDWP provider. The argument is a string.
If 'none' is given JDWP will be totally disabled.
If 'internal' is given the current internal JDWP implementation is
used.
If 'default' is given the 'internal' JDWP implementation will
currently be used.
Other values will be added in the future.
Also adds a runtime callback that will be invoked when the runtime
wants to start or stop the debugger (namely at the post-zygote fork
and just before exit) and check if a debugger is availible.
Also add '-XjdwpOptions:_' in preparation for the eventual removal of
the existing -Xrunjdwp=_ and -Xagentlib:jdwp=_ as top-level options.
All of these options now store their arguments as a std::string to be
interpreted by the JDWP implementation as it sees fit. Also change the
jdwpOptions to default to transport=dt_android_adb if there is not one
specified and it is available. This will make changing the default
transport based on the JDWP provider easier.
These new options are needed to allow us to support both the old,
internal, JDWP implementation as its replacement is tested and
verified. This lets us switch between them with little difficulty.
We will probably remove one or both of these options once we have
confidence that the new jdwp implementation has stuck.
Test: ./test.py --host -j50
Test: ./test/run-test --host --debug 001-HelloWorld
Test: Manual, flash walleye, debug app
Bug: 62821960
Change-Id: Ie31db6b6f7d76a03d4ab8e178fcf298ed0eec203
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 2e03562..4bc8245 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -43,7 +43,8 @@
RUNTIME_OPTIONS_KEY (std::string, Image)
RUNTIME_OPTIONS_KEY (Unit, CheckJni)
RUNTIME_OPTIONS_KEY (Unit, JniOptsForceCopy)
-RUNTIME_OPTIONS_KEY (JDWP::JdwpOptions, JdwpOptions)
+RUNTIME_OPTIONS_KEY (std::string, JdwpOptions, "")
+RUNTIME_OPTIONS_KEY (JdwpProvider, JdwpProvider, JdwpProvider::kInternal)
RUNTIME_OPTIONS_KEY (MemoryKiB, MemoryMaximumSize, gc::Heap::kDefaultMaximumSize) // -Xmx
RUNTIME_OPTIONS_KEY (MemoryKiB, MemoryInitialSize, gc::Heap::kDefaultInitialSize) // -Xms
RUNTIME_OPTIONS_KEY (MemoryKiB, HeapGrowthLimit) // Default is 0 for unlimited