mirror of https://github.com/PCSX2/pcsx2.git
Common: Add assertion failure message to crashlogs
This commit is contained in:
parent
e63c068720
commit
04681babf1
|
@ -138,7 +138,7 @@ void pxOnAssertFail(const char* file, int line, const char* func, const char* ms
|
||||||
fputs(full_msg, stderr);
|
fputs(full_msg, stderr);
|
||||||
fputs("\nAborting application.\n", stderr);
|
fputs("\nAborting application.\n", stderr);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
abort();
|
AbortWithMessage(full_msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ResumeThreads(handle);
|
ResumeThreads(handle);
|
||||||
|
|
|
@ -160,6 +160,8 @@ extern u64 GetPhysicalMemory();
|
||||||
extern u32 ShortSpin();
|
extern u32 ShortSpin();
|
||||||
/// Number of ns to spin for before sleeping a thread
|
/// Number of ns to spin for before sleeping a thread
|
||||||
extern const u32 SPIN_TIME_NS;
|
extern const u32 SPIN_TIME_NS;
|
||||||
|
/// Like C abort() but adds the given message to the crashlog
|
||||||
|
[[noreturn]] void AbortWithMessage(const char* msg);
|
||||||
|
|
||||||
extern std::string GetOSVersionString();
|
extern std::string GetOSVersionString();
|
||||||
|
|
||||||
|
|
|
@ -71,3 +71,31 @@ static u32 GetSpinTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 SPIN_TIME_NS = GetSpinTime();
|
const u32 SPIN_TIME_NS = GetSpinTime();
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// https://alastairs-place.net/blog/2013/01/10/interesting-os-x-crash-report-tidbits/
|
||||||
|
// https://opensource.apple.com/source/WebKit2/WebKit2-7608.3.10.0.3/Platform/spi/Cocoa/CrashReporterClientSPI.h.auto.html
|
||||||
|
struct crash_info_t
|
||||||
|
{
|
||||||
|
u64 version;
|
||||||
|
u64 message;
|
||||||
|
u64 signature;
|
||||||
|
u64 backtrace;
|
||||||
|
u64 message2;
|
||||||
|
u64 reserved;
|
||||||
|
u64 reserved2;
|
||||||
|
};
|
||||||
|
#define CRASH_ANNOTATION __attribute__((section("__DATA,__crash_info")))
|
||||||
|
#define CRASH_VERSION 4
|
||||||
|
extern "C" crash_info_t gCRAnnotations CRASH_ANNOTATION = { CRASH_VERSION };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void AbortWithMessage(const char* msg)
|
||||||
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
gCRAnnotations.message = reinterpret_cast<size_t>(msg);
|
||||||
|
// Some macOS's seem to have issues displaying non-static `message`s, so throw it in here too
|
||||||
|
gCRAnnotations.backtrace = gCRAnnotations.message;
|
||||||
|
#endif
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue