Print nicer error messages for uncaught exceptions

Former-commit-id: 23b0268a7fc1f7116e96905502895a445d2caf76
This commit is contained in:
John Sully 2019-05-18 20:22:16 -04:00
parent 2dccb832bf
commit 7ccf4f2dcf
2 changed files with 13 additions and 1 deletions

View File

@ -21,7 +21,7 @@ NODEPS:=clean distclean
# Default settings
STD=-std=c11 -pedantic -DREDIS_STATIC=''
CXX_STD=-std=c++14 -pedantic -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS
CXX_STD=-std=c++14 -pedantic -fno-rtti -D__STDC_FORMAT_MACROS
ifneq (,$(findstring clang,$(CC)))
ifneq (,$(findstring FreeBSD,$(uname_S)))
STD+=-Wno-c11-extensions

View File

@ -4919,6 +4919,16 @@ void incrementMvccTstamp()
}
}
void OnTerminate()
{
/* Any uncaught exception will call std::terminate().
We want this handled like a segfault (printing the stack trace etc).
The easiest way to achieve that is to acutally segfault, so we assert
here.
*/
serverAssert(false);
}
void *workerThreadMain(void *parg)
{
int iel = (int)((int64_t)parg);
@ -4939,6 +4949,8 @@ int main(int argc, char **argv) {
struct timeval tv;
int j;
std::set_terminate(OnTerminate);
#ifdef USE_MEMKIND
storage_init(NULL, 0);
#endif