ART: Add thread dump to dex2oat watchdog

To improve timeout investigations, add thread dumping to the dex2oat
watchdog.

This is a double-edged sword. To be really robust, we probably need
a second watchdog to kill the the first if it gets stuck dumping. So
consider this CL temporary.

Bug: 62337922
Test: m test-art-host-gtest_dex2oat_test
Test: m test-art-host
Change-Id: I2cef6c5978c7d8e487168ce8c0c5380e667c3fbc
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 53e73c3..12d2388 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -477,6 +477,13 @@
                                        android::base::LogId::DEFAULT,
                                        LogSeverity::FATAL,
                                        message.c_str());
+    if (Runtime::Current() != nullptr) {
+      Runtime::Current()->AttachCurrentThread("Watchdog thread attached for dumping",
+                                              true,
+                                              nullptr,
+                                              false);
+      Runtime::Current()->DumpForSigQuit(std::cerr);
+    }
     exit(1);
   }