Fix silently lost nlassert, ryzom/ryzomcore#596

develop
kaetemi 5 years ago
parent 75777b3497
commit bcac1e7955

@ -89,6 +89,9 @@ void createDebug (const char *logPath = NULL, bool logInFile = true, bool eraseL
/// Do not call this, unless you know what you're trying to do (it kills debug)!
void destroyDebug();
/// Attach exception handler, for new threads and fibers
void attachExceptionHandler();
// call this if you want to change the dir of the log.log file
void changeLogDirectory(const std::string &dir);
@ -352,7 +355,7 @@ void setCrashAlreadyReported(bool state);
* Same as nlassertex(false,exp);
*/
// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG)
#if defined(NL_DEBUG) /* Debug break is only useful in debug builds */
#if defined(NL_OS_WINDOWS)
#define NLMISC_BREAKPOINT __debugbreak()
#elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC)
@ -360,6 +363,9 @@ void setCrashAlreadyReported(bool state);
#else
#define NLMISC_BREAKPOINT abort()
#endif
#else
#define NLMISC_BREAKPOINT do { } while (0)
#endif
// Internal, don't use it (make smaller assert code)
extern bool _assert_stop(bool &ignoreNextTime, sint line, const char *file, const char *funcName, const char *exp);

@ -143,6 +143,9 @@ namespace NLMISC
NL_CT_DEBUG("CoTask : task %p start func called", task);
// Attach exception handler
attachExceptionHandler();
try
{
// run the task
@ -151,6 +154,7 @@ namespace NLMISC
catch(...)
{
nlwarning("CCoTask::startFunc : the task has generated an unhandled exeption and will terminate");
NLMISC_BREAKPOINT;
}
task->_Finished = true;

@ -1157,6 +1157,15 @@ void destroyDebug()
}
}
void attachExceptionHandler()
{
#ifndef NL_COMP_MINGW
# ifdef NL_OS_WINDOWS
_set_se_translator(exceptionTranslator);
# endif // NL_OS_WINDOWS
#endif //!NL_COMP_MINGW
}
void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
{
// Do some basic compiler time check on type size

@ -67,6 +67,9 @@ static unsigned long __stdcall ProxyFunc (void *arg)
// Set the thread pointer in TLS memory
nlverify (TlsSetValue (TLSThreadPointer, (void*)parent) != 0);
// Attach exception handler
attachExceptionHandler();
// Run the thread
parent->Runnable->run();

Loading…
Cancel
Save