Read JDWP options from runtime
Allocates JDWP::JdwpOptions on the heap and copies parsed options to
avoid the need to include jdwp/jdwp.h into runtime.h file.
Also does some minor cleanup and removes the old JDWP options parsing
code that became dead code after we move it to the new command-line
parser.
Bug: 19275792
Change-Id: I71901c89fbf2cc3c1901a089e2a98b4326c6ee70
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 43f3a2e..e868e75 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -173,7 +173,8 @@
implicit_null_checks_(false),
implicit_so_checks_(false),
implicit_suspend_checks_(false),
- is_native_bridge_loaded_(false) {
+ is_native_bridge_loaded_(false),
+ jdwp_options_(nullptr) {
CheckAsmSupportOffsetsAndSizes();
}
@@ -227,6 +228,10 @@
// Make sure our internal threads are dead before we start tearing down things they're using.
Dbg::StopJdwp();
+ if (jdwp_options_ != nullptr) {
+ delete jdwp_options_;
+ }
+
delete signal_catcher_;
// Make sure all other non-daemon threads have terminated, and all daemon threads are suspended.
@@ -590,7 +595,7 @@
// Start the JDWP thread. If the command-line debugger flags specified "suspend=y",
// this will pause the runtime, so we probably want this to come last.
- Dbg::StartJdwp();
+ Dbg::StartJdwp(jdwp_options_);
}
void Runtime::StartSignalCatcher() {
@@ -799,6 +804,11 @@
dump_gc_performance_on_shutdown_ = runtime_options.Exists(Opt::DumpGCPerformanceOnShutdown);
+ if (runtime_options.Exists(Opt::JdwpOptions)) {
+ JDWP::JdwpOptions options = runtime_options.GetOrDefault(Opt::JdwpOptions);
+ jdwp_options_ = new JDWP::JdwpOptions(options);
+ }
+
BlockSignals();
InitPlatformSignalHandlers();