33 struct sigaction Foam::sigSegvImpl::oldAction_;
37 void Foam::sigSegvImpl::sigSegvHandler(int)
40 if (sigaction(SIGSEGV, &oldAction_, NULL) < 0)
44 "Foam::sigSegvImpl::sigSegvHandler()"
45 ) <<
"Cannot reset SIGSEGV trapping"
53 "************************************************************\n"
54 "* FreeFOAM crashed. See below for a backtrace to help *\n"
55 "* locating the problem. *\n"
56 "************************************************************\n";
57 error::printStack(
Perr);
58 Perr <<
"************************************************************\n"
70 oldAction_.sa_handler = NULL;
79 if (sigaction(SIGSEGV, &oldAction_, NULL) < 0)
83 "Foam::sigSegvImpl::~sigSegvImpl()"
84 ) <<
"Cannot reset SIGSEGV trapping"
94 if (oldAction_.sa_handler)
98 "Foam::sigSegvImpl::set()"
99 ) <<
"Cannot call sigSegvImpl::set() more than once"
103 struct sigaction newAction;
104 newAction.sa_handler = sigSegvHandler;
105 newAction.sa_flags = SA_NODEFER;
106 sigemptyset(&newAction.sa_mask);
107 if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0)
111 "Foam::sigSegvImpl::set()"
112 ) <<
"Cannot set SIGSEGV trapping"