Wire up enough of the pieces that we can connect ddms or jdb.
(And die with an UNIMPLEMENTED as soon as they connect, of course.)
Change-Id: I9abb25d581384361c215b3cd96b8278c751e79ea
diff --git a/src/runtime.cc b/src/runtime.cc
index a144c44..5f2eddd 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -56,6 +56,8 @@
}
Runtime::~Runtime() {
+ Dbg::StopJdwp();
+
// Make sure our internal threads are dead before we start tearing down things they're using.
delete signal_catcher_;
// TODO: GC thread.
@@ -402,7 +404,9 @@
// come after ClassLinker::RunRootClinits.
started_ = true;
- StartSignalCatcher();
+ if (!is_zygote_) {
+ DidForkFromZygote();
+ }
StartDaemonThreads();
@@ -416,9 +420,13 @@
}
void Runtime::DidForkFromZygote() {
- CHECK(is_zygote_);
is_zygote_ = false;
+
StartSignalCatcher();
+
+ // 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();
}
void Runtime::StartSignalCatcher() {