Converting floating point exceptions into C++ exceptions

前端 未结 5 885
栀梦
栀梦 2021-02-06 08:41

Is it possible to convert floating point exceptions (signals) into C++ exceptions on x86 Linux?

This is for debugging purposes, so nonportability and imperfection is oka

5条回答
  •  北海茫月
    2021-02-06 09:40

    I don't have a ready made solution, but one thing you could look at are signals (not sure whether you can safely throw C++ exceptions from them, but it should help for debugging anyway.)

    You could install a signal handler for SIGFPE, and use that for your debugging purposes.

提交回复
热议问题