Solving random crashes

前端 未结 17 1165
青春惊慌失措
青春惊慌失措 2021-01-31 08:15

I am getting random crashes on my C++ application, it may not crash for a month, and then crash 10 times in a hour, and sometimes it may crash on launch, while sometimes it may

17条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 09:02

    The first thing I would do is debug the core dump with gdb (both Windows and Linux). The second would be be running a program like Lint, Prefast (Windows), Clang Analyzer or some other static analysis program (be prepared for a lot of false positives). Third thing would be some kind of runtime check, like Valgrind (or its close variants), Microsoft Application Verifier, or Google Perftools.

    And logging. Which doesn't have to go to disk. You could, for instance, log to a global std::list which would be pruned to the last 100 entries. When an exception is caught display the contents of that list.

提交回复
热议问题