从分段故障中恢复的最佳做法 [英] Best practices for recovering from a segmentation fault

查看:121
本文介绍了从分段故障中恢复的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C ++编写的多线程进程,并且正在考虑使用 google-coredumper

I am working on a multithreaded process written in C++, and am considering modifying SIGSEGV handling using google-coredumper to keep the process alive when a segmentation fault occurs.

然而,使用google-coredumper似乎已经成熟,有机会陷入无限循环的核心转储,除非我以某种方式重新初始化可能导致核心转储的线程和对象。

However, this use of google-coredumper seems ripe with opportunities to get stuck in an infinite loop of core dumps unless I somehow reinitialize the thread and the object that may have caused the core dump.

当尝试通过核心转储保持进程活动时,我应该记住什么最佳做法?

What best practices should I keep in mind when trying to keep a process alive through a core dump? What other 'gotchas' should I be aware of?

谢谢!

推荐答案

最佳做法是修复导致核心转储的原始问题,并重新编译并重新启动应用程序。

The best practice is to fix the original issue causing the core dump and recompile and relaunch the application.

为了捕获这些错误,的同行评审和写大量的测试

To catch these errors before deploying it in the wild do plenty of peer review and write lot of tests

这篇关于从分段故障中恢复的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆