ART: Set Runtime fault message on abort
In Runtime::Abort, set the fault message when not on Android. This
will help re-print the message at the end of aborts when the
unexpected-signal handler is being used.
Bug: 120506942
Test: mmma art
Test: manual
Change-Id: I0b81049d700012250a16c45d0657b06d1f4d8aa0
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index d53cc07..8be3730 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -548,18 +548,18 @@
void Runtime::Abort(const char* msg) {
auto old_value = gAborting.fetch_add(1); // set before taking any locks
-#ifdef ART_TARGET_ANDROID
+ // Only set the first abort message.
if (old_value == 0) {
- // Only set the first abort message.
- android_set_abort_message(msg);
- }
-#else
- UNUSED(old_value);
-#endif
-
#ifdef ART_TARGET_ANDROID
- android_set_abort_message(msg);
+ android_set_abort_message(msg);
+#else
+ // Set the runtime fault message in case our unexpected-signal code will run.
+ Runtime* current = Runtime::Current();
+ if (current != nullptr) {
+ current->SetFaultMessage(msg);
+ }
#endif
+ }
// Ensure that we don't have multiple threads trying to abort at once,
// which would result in significantly worse diagnostics.