Add an FLOG if profiler depth goes negative. Make Crash()/FLOG actually crash on win64.

This commit is contained in:
Henrik Rydgard 2015-06-11 18:43:59 +02:00
parent 316d6ab84d
commit 32a75bea46
2 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,7 @@
#ifdef _WIN32
#ifdef _M_X64
inline void Crash() { /*DebugBreak();*/ }
inline void Crash() { int *x = (int *)1337; *x = 1; }
#else
inline void Crash() { __asm { int 3 }; }
#endif

View File

@ -125,6 +125,9 @@ void internal_profiler_leave(int category) {
history[profiler.historyPos].count[category]++;
profiler.depth--;
if (profiler.depth < 0) {
FLOG("Profiler enter/leave mismatch!");
}
int parent = profiler.parentCategory[profiler.depth];
if (parent != -1) {
// Resume tracking the parent.