Skip to content

Commit 2f9ecc6

Browse files
Hor911GrigoriyPA
authored andcommitted
FPE Handler (ydb-platform#13868)
1 parent 65176c7 commit 2f9ecc6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ydb/tests/tools/kqprun/kqprun.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,16 @@ void SegmentationFaultHandler(int) {
967967
abort();
968968
}
969969

970+
void FloatingPointExceptionHandler(int) {
971+
NColorizer::TColors colors = NColorizer::AutoColors(Cerr);
972+
973+
Cerr << colors.Red() << "======= floating point exception call stack ========" << colors.Default() << Endl;
974+
FormatBackTrace(&Cerr);
975+
Cerr << colors.Red() << "==============================================" << colors.Default() << Endl;
976+
977+
abort();
978+
}
979+
970980
#ifdef PROFILE_MEMORY_ALLOCATIONS
971981
void InterruptHandler(int) {
972982
NColorizer::TColors colors = NColorizer::AutoColors(Cerr);
@@ -985,6 +995,7 @@ void InterruptHandler(int) {
985995
int main(int argc, const char* argv[]) {
986996
std::set_terminate(NKqpRun::KqprunTerminateHandler);
987997
signal(SIGSEGV, &NKqpRun::SegmentationFaultHandler);
998+
signal(SIGFPE, &NKqpRun::FloatingPointExceptionHandler);
988999

9891000
#ifdef PROFILE_MEMORY_ALLOCATIONS
9901001
signal(SIGINT, &NKqpRun::InterruptHandler);

0 commit comments

Comments
 (0)