summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdline/cmdline_parser_test.cc2
-rw-r--r--runtime/runtime.cc15
-rw-r--r--runtime/runtime_options.def2
-rwxr-xr-xtest/etc/run-test-jar8
4 files changed, 23 insertions, 4 deletions
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc
index 1e79fdff1b..3cb9731a17 100644
--- a/cmdline/cmdline_parser_test.cc
+++ b/cmdline/cmdline_parser_test.cc
@@ -369,7 +369,7 @@ TEST_F(CmdlineParserTest, DISABLED_TestXGcOption) {
*/
TEST_F(CmdlineParserTest, TestJdwpProviderEmpty) {
{
- EXPECT_SINGLE_PARSE_DEFAULT_VALUE(JdwpProvider::kInternal, "", M::JdwpProvider);
+ EXPECT_SINGLE_PARSE_DEFAULT_VALUE(JdwpProvider::kNone, "", M::JdwpProvider);
}
} // TEST_F
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6d065d6146..3e7133e10c 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1253,7 +1253,20 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
jdwp_provider_ = runtime_options.GetOrDefault(Opt::JdwpProvider);
switch (jdwp_provider_) {
case JdwpProvider::kNone: {
- LOG(WARNING) << "Disabling all JDWP support.";
+ LOG(INFO) << "Disabling all JDWP support.";
+ if (!jdwp_options_.empty()) {
+ bool has_transport = jdwp_options_.find("transport") != std::string::npos;
+ const char* transport_internal = !has_transport ? "transport=dt_android_adb," : "";
+ std::string adb_connection_args =
+ std::string(" -XjdwpProvider:adbconnection -XjdwpOptions:") + jdwp_options_;
+ LOG(WARNING) << "Jdwp options given when jdwp is disabled! You probably want to enable "
+ << "jdwp with one of:" << std::endl
+ << " -XjdwpProvider:internal "
+ << "-XjdwpOptions:" << transport_internal << jdwp_options_ << std::endl
+ << " -Xplugin:libopenjdkjvmti" << (kIsDebugBuild ? "d" : "") << ".so "
+ << "-agentpath:libjdwp.so=" << jdwp_options_ << std::endl
+ << (has_transport ? "" : adb_connection_args);
+ }
break;
}
case JdwpProvider::kInternal: {
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 6e1a68b07d..e78d952c1c 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::kInternal)
+RUNTIME_OPTIONS_KEY (JdwpProvider, JdwpProvider, JdwpProvider::kNone)
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 5e40b86aa0..ca24471675 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -436,7 +436,13 @@ if [ "$DEBUGGER" = "y" ]; then
msg " adb forward tcp:$PORT tcp:$PORT"
fi
msg " jdb -attach localhost:$PORT"
- DEBUGGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
+ if [ "$USE_JVM" = "n" ]; then
+ # TODO We should switch over to using the jvmti agent by default.
+ # Need to tell the runtime to enable the internal jdwp implementation.
+ DEBUGGER_OPTS="-XjdwpOptions:transport=dt_socket,address=$PORT,server=y,suspend=y -XjdwpProvider:internal"
+ else
+ DEBUGGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
+ fi
elif [ "$DEBUGGER" = "agent" ]; then
PORT=12345
# TODO Support ddms connection and support target.