ART: Restrict dex2oat watchdog dumping to host
Follow-up to commit cd607315e1e75feb3d1fab503d79586f26213970.
Bug: 62337922
Test: m test-art-host
Change-Id: I1d84bf2d7868cf6e3524da90cff2439e230264db
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 80d5a9c..dcdf3bc 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -478,7 +478,10 @@
android::base::LogId::DEFAULT,
LogSeverity::FATAL,
message.c_str());
- if (Runtime::Current() != nullptr) {
+ // If we're on the host, try to dump all threads to get a sense of what's going on. This is
+ // restricted to the host as the dump may itself go bad.
+ // TODO: Use a double watchdog timeout, so we can enable this on-device.
+ if (!kIsTargetBuild && Runtime::Current() != nullptr) {
Runtime::Current()->AttachCurrentThread("Watchdog thread attached for dumping",
true,
nullptr,