Follow up 129144

Passes JDWP options to debugger on runtime init so we no longer need
to keep them on the heap.

Updates ParseJdwpOption to return Result for consistency.

Bug: 19275792
Change-Id: I68b7e58908164d3e4cf9e3fbcc3dfab6ce0579a5
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6704963..c6e858b 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -173,8 +173,7 @@
       implicit_null_checks_(false),
       implicit_so_checks_(false),
       implicit_suspend_checks_(false),
-      is_native_bridge_loaded_(false),
-      jdwp_options_(nullptr) {
+      is_native_bridge_loaded_(false) {
   CheckAsmSupportOffsetsAndSizes();
 }
 
@@ -228,10 +227,6 @@
 
   // 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.
@@ -595,7 +590,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(jdwp_options_);
+  Dbg::StartJdwp();
 }
 
 void Runtime::StartSignalCatcher() {
@@ -805,8 +800,7 @@
   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);
+    Dbg::ConfigureJdwp(runtime_options.GetOrDefault(Opt::JdwpOptions));
   }
 
   BlockSignals();