简体   繁体   English

POSIX 上的 C++ 故障转储

[英]C++ Crash Dumps on POSIX

I have a big C++ code (server for some application).我有一个大的 C++ 代码(某些应用程序的服务器)。 This application is big, and catch a crash per 2 months in average.这个应用程序很大,平均每 2 个月就会崩溃一次。 And i can't simulate this crash to catch her with gdb .而且我无法模拟这种崩溃来用gdb抓住她。

Is exists some cool api to analyze memory on crash dump (stacktrace, local vars)?是否存在一些很酷的 api 来分析故障转储(堆栈跟踪、本地变量)上的 memory?

What is best way to catch stack corruption time?捕获堆栈损坏时间的最佳方法是什么?

Enable core dumping, wait for it to crash.启用核心转储,等待它崩溃。 Then load the core into gdb and debug as usual.然后将内核加载到 gdb 并照常调试。

ulimit -c unlimited

There are several things you can do:您可以做几件事:
1. Unit test your code, and execute them using valgrind 1. 对代码进行单元测试,并使用 valgrind 执行它们
2. enable core dumps (as Let_Me_Be said in his answer) 2.启用核心转储(正如 Let_Me_Be 在他的回答中所说)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM