From 068b2056ca02a707b164693fefc9e0dd9637e6f2 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 6 Sep 2015 13:34:39 -0700 Subject: [PATCH] Explode more gracefully on crashes while crashing. --- src/xenia/memory.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index 1a3cebb45..7904a61ca 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -69,7 +69,16 @@ uint32_t get_page_count(uint32_t value, uint32_t page_size) { static Memory* active_memory_ = nullptr; -void CrashDump() { active_memory_->DumpMap(); } +void CrashDump() { + static std::atomic in_crash_dump(0); + if (in_crash_dump.fetch_add(1)) { + xe::FatalError( + "Hard crash: the memory system crashed while dumping a crash dump."); + return; + } + active_memory_->DumpMap(); + --in_crash_dump; +} Memory::Memory() { system_page_size_ = uint32_t(xe::memory::page_size());