Catch Segfault or any other errors/exceptions/signals in C++ like catching exceptions in Java

前端 未结 5 1493
长情又很酷
长情又很酷 2020-12-11 03:43

I wrote a Linux program based on a buggy open source library. This library sometimes triggers segfaults that I cannot control. And of course once the library has segfaults,

5条回答
  •  半阙折子戏
    2020-12-11 04:15

    You can use signal handlers. It's not really recommended though because you can't guarantee that you've eliminated the cause of the problem. The best thing to do would be to isolate it in a separate process- this is the approach Google Chrome takes.

    If it's FOSS, the easiest thing to do would be to just debug it.

提交回复
热议问题