Fix macOS build in ART's runtime/runtime_common.{h,cc}
Test: mmma art (on macOS)
Bug: 32466479
Change-Id: I9996c6a495d2465a4b00affd2ef19102c815a58f
diff --git a/runtime/runtime_common.cc b/runtime/runtime_common.cc
index 1d8c16d..70aff37 100644
--- a/runtime/runtime_common.cc
+++ b/runtime/runtime_common.cc
@@ -126,6 +126,20 @@
return "?";
}
+struct UContext {
+ explicit UContext(void* raw_context)
+ : context(reinterpret_cast<ucontext_t*>(raw_context)->uc_mcontext) {}
+
+ void Dump(std::ostream& os) const;
+
+ void DumpRegister32(std::ostream& os, const char* name, uint32_t value) const;
+ void DumpRegister64(std::ostream& os, const char* name, uint64_t value) const;
+
+ void DumpX86Flags(std::ostream& os, uint32_t flags) const;
+
+ mcontext_t& context;
+};
+
void UContext::Dump(std::ostream& os) const {
// TODO: support non-x86 hosts.
#if defined(__APPLE__) && defined(__i386__)
@@ -274,6 +288,13 @@
return signal_number == GetTimeoutSignal();
}
+#if defined(__APPLE__)
+// On macOS, clang complains about art::HandleUnexpectedSignalCommon's
+// stack frame size being too large; disable that warning locally.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wframe-larger-than="
+#endif
+
void HandleUnexpectedSignalCommon(int signal_number,
siginfo_t* info,
void* raw_context,
@@ -356,6 +377,10 @@
}
}
+#if defined(__APPLE__)
+#pragma GCC diagnostic pop
+#endif
+
void InitPlatformSignalHandlersCommon(void (*newact)(int, siginfo_t*, void*),
struct sigaction* oldact,
bool handle_timeout_signal) {