CrashHelpers.cpp 797 B

123456789101112131415161718192021222324252627282930313233
  1. #include "il2cpp-config.h"
  2. #include "os/CrashHelpers.h"
  3. #include "os/StackTrace.h"
  4. #include "utils/Logging.h"
  5. #include <string>
  6. namespace il2cpp
  7. {
  8. namespace os
  9. {
  10. void CrashHelpers::Crash()
  11. {
  12. std::string nativeStackTrace;
  13. #if IL2CPP_ENABLE_NATIVE_STACKTRACES
  14. nativeStackTrace = il2cpp::os::StackTrace::NativeStackTrace();
  15. #endif
  16. if (!nativeStackTrace.empty())
  17. {
  18. std::string nativeStackTraceMessage = "Native stack trace:\n" + nativeStackTrace;
  19. il2cpp::utils::Logging::Write(nativeStackTraceMessage.c_str());
  20. }
  21. else
  22. {
  23. il2cpp::utils::Logging::Write("No native stack trace exists. Make sure this is platform supports native stack traces.");
  24. }
  25. CrashHelpers::CrashImpl();
  26. }
  27. }
  28. }