Best practices for recovering from a segmentation fault(从分段错误中恢复的最佳实践)
问题描述
我正在开发一个用 C++ 编写的多线程进程,并且正在考虑使用 google 修改 SIGSEGV 处理-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, recompile and then relaunch the application.
要在实际部署之前发现这些错误,请进行大量同行评审并编写大量测试.
To catch these errors before deploying in the wild, do plenty of peer review and write lots of tests.
这篇关于从分段错误中恢复的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从分段错误中恢复的最佳实践
基础教程推荐
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 这个宏可以转换成函数吗? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 我有静态或动态 boost 库吗? 2021-01-01
