diff options
| -rw-r--r-- | cmdline/cmdline_parser_test.cc | 2 | ||||
| -rw-r--r-- | runtime/jdwp_provider.h | 23 | ||||
| -rw-r--r-- | runtime/runtime.cc | 8 | ||||
| -rw-r--r-- | runtime/runtime_options.def | 2 | ||||
| -rwxr-xr-x | test/etc/run-test-jar | 3 | ||||
| -rw-r--r-- | tools/veridex/Android.mk | 4 |
6 files changed, 36 insertions, 6 deletions
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc index 235a2aa90e..a52e16328a 100644 --- a/cmdline/cmdline_parser_test.cc +++ b/cmdline/cmdline_parser_test.cc @@ -371,7 +371,7 @@ TEST_F(CmdlineParserTest, DISABLED_TestXGcOption) { */ TEST_F(CmdlineParserTest, TestJdwpProviderEmpty) { { - EXPECT_SINGLE_PARSE_DEFAULT_VALUE(JdwpProvider::kNone, "", M::JdwpProvider); + EXPECT_SINGLE_PARSE_DEFAULT_VALUE(JdwpProvider::kUnset, "", M::JdwpProvider); } } // TEST_F diff --git a/runtime/jdwp_provider.h b/runtime/jdwp_provider.h index 698fdc086d..c4f19899c9 100644 --- a/runtime/jdwp_provider.h +++ b/runtime/jdwp_provider.h @@ -19,6 +19,7 @@ #include <ios> +#include "base/globals.h" #include "base/macros.h" #include "base/logging.h" @@ -26,13 +27,33 @@ namespace art { enum class JdwpProvider { kNone, + // Special value only used to denote that no explicit choice has been made by the user. This + // should not be used and one should always call CanonicalizeJdwpProvider which will remove this + // value before using a JdwpProvider value. + kUnset, kInternal, kAdbConnection, - // The current default provider + // The current default provider. Used if you run -XjdwpProvider:default kDefaultJdwpProvider = kAdbConnection, + + // What we should use as provider with no options and debuggable. On host we always want to be + // none since there is no adbd on host. + kUnsetDebuggable = kIsTargetBuild ? kDefaultJdwpProvider : kNone, + // What we should use as provider with no options and non-debuggable + kUnsetNonDebuggable = kNone, }; +inline JdwpProvider CanonicalizeJdwpProvider(JdwpProvider p, bool debuggable) { + if (p != JdwpProvider::kUnset) { + return p; + } + if (debuggable) { + return JdwpProvider::kUnsetDebuggable; + } + return JdwpProvider::kUnsetNonDebuggable; +} + std::ostream& operator<<(std::ostream& os, const JdwpProvider& rhs); } // namespace art diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 1e327fc8ed..7efd000f33 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1283,7 +1283,8 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { dump_gc_performance_on_shutdown_ = runtime_options.Exists(Opt::DumpGCPerformanceOnShutdown); jdwp_options_ = runtime_options.GetOrDefault(Opt::JdwpOptions); - jdwp_provider_ = runtime_options.GetOrDefault(Opt::JdwpProvider); + jdwp_provider_ = CanonicalizeJdwpProvider(runtime_options.GetOrDefault(Opt::JdwpProvider), + IsJavaDebuggable()); switch (jdwp_provider_) { case JdwpProvider::kNone: { VLOG(jdwp) << "Disabling all JDWP support."; @@ -1317,6 +1318,11 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { constexpr const char* plugin_name = kIsDebugBuild ? "libadbconnectiond.so" : "libadbconnection.so"; plugins_.push_back(Plugin::Create(plugin_name)); + break; + } + case JdwpProvider::kUnset: { + LOG(FATAL) << "Illegal jdwp provider " << jdwp_provider_ << " was not filtered out!"; + break; } } callbacks_->AddThreadLifecycleCallback(Dbg::GetThreadLifecycleCallback()); diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def index e647423b9c..3f9a3229ca 100644 --- a/runtime/runtime_options.def +++ b/runtime/runtime_options.def @@ -44,7 +44,7 @@ RUNTIME_OPTIONS_KEY (std::string, Image) RUNTIME_OPTIONS_KEY (Unit, CheckJni) RUNTIME_OPTIONS_KEY (Unit, JniOptsForceCopy) RUNTIME_OPTIONS_KEY (std::string, JdwpOptions, "") -RUNTIME_OPTIONS_KEY (JdwpProvider, JdwpProvider, JdwpProvider::kNone) +RUNTIME_OPTIONS_KEY (JdwpProvider, JdwpProvider, JdwpProvider::kUnset) 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 diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index 1ba433e974..713fd35523 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -377,6 +377,9 @@ CHROOT_DEX_LOCATION="$CHROOT$DEX_LOCATION" if [ "$USE_JVM" = "n" ]; then FLAGS="${FLAGS} ${ANDROID_FLAGS}" + # we don't want to be trying to get adbconnections since the plugin might + # not have been built. + FLAGS="${FLAGS} -XjdwpProvider:none" for feature in ${EXPERIMENTAL}; do FLAGS="${FLAGS} -Xexperimental:${feature} -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:${feature}" COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xexperimental:${feature}" diff --git a/tools/veridex/Android.mk b/tools/veridex/Android.mk index f8463c1c33..2faa577262 100644 --- a/tools/veridex/Android.mk +++ b/tools/veridex/Android.mk @@ -22,13 +22,13 @@ LOCAL_PATH := $(call my-dir) system_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex $(system_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 $(system_stub_dex): $(call resolve-prebuilt-sdk-jar-path,system_current) | $(ZIP2ZIP) $(DX) - $(transform-classes-d8.jar-to-dex) + $(transform-classes.jar-to-dex) oahl_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/oahl_dex_intermediates/classes.dex $(oahl_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 $(oahl_stub_dex): $(call get-prebuilt-sdk-dir,current)/org.apache.http.legacy.jar | $(ZIP2ZIP) $(DX) - $(transform-classes-d8.jar-to-dex) + $(transform-classes.jar-to-dex) app_compat_lists := \ $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \ |