Attempt to get better file/line info for LL_ERRS crahses in bugsplat. (#2447)

secondlife/viewer#2445
master
Brad Linden 2024-08-28 16:20:25 -07:00 committed by Beq
parent 41eedc9bb3
commit 34389c6cc2
2 changed files with 5 additions and 22 deletions

View File

@ -1663,19 +1663,3 @@ namespace LLError
sLocalizedOutOfMemoryWarning = message;
}
}
void crashdriver(void (*callback)(int*))
{
// The LLERROR_CRASH macro used to have inline code of the form:
//int* make_me_crash = NULL;
//*make_me_crash = 0;
// But compilers are getting smart enough to recognize that, so we must
// assign to an address supplied by a separate source file. We could do
// the assignment here in crashdriver() -- but then BugSplat would group
// all LL_ERRS() crashes as the fault of this one function, instead of
// identifying the specific LL_ERRS() source line. So instead, do the
// assignment in a lambda in the caller's source. We just provide the
// nullptr target.
callback(nullptr);
}

View File

@ -420,9 +420,11 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
#define LL_NEWLINE '\n'
// Use this only in LL_ERRS or in a place that LL_ERRS may not be used
#define LLERROR_CRASH \
{ \
crashdriver([](int* ptr){ *ptr = 0; exit(*ptr); }); \
#define LLERROR_CRASH \
{ \
int* make_me_crash = (int*)0xDEADBEEFDEADBEEFUL; \
*make_me_crash = 0; \
exit(*make_me_crash); \
}
#define LL_ENDL \
@ -524,7 +526,4 @@ LL_DEBUGS("SomeTag") performs the locking and map-searching ONCE, then caches
the result in a static variable.
*/
// used by LLERROR_CRASH
void crashdriver(void (*)(int*));
#endif // LL_LLERROR_H