参考
- (官方源码)google/breakpad: Mirror of Google Breakpad project (github.com)
- (8条消息) 12.5-使用Qt实现跨平台C++崩溃捕获,看这一篇就足够了(Breakpad)_Robert Zhang-CSDN博客_breakpad qt
- Google Breakpad:脱离符号的调试工具 | 黎明灰烬 博客 (jackwish.net)
一 学习要点
- 在
.pro
文件中包含.pri
文件,eg:include($$PWD/src/third_libs/log4qt/log4qtlib.pri)
依赖源码的集成
二 借助python
在Windows
下编译成库文件
- (使用
demo
)UpperComputerProgramingGuideSrc/12_5_qt_breakpad_demo at master · robert1207/UpperComputerProgramingGuideSrc (github.com) - 参考:(8条消息) Google Breakpad--VS2015 编译、使用、定位错误(如何使用gyp)_一蓑烟雨任平生 也无风雨也无晴-CSDN博客_breakpad 使用
三 在vs2017
中搞CMake
工程,编成静态库,主要是在上面能知道(依赖源码集成)源码是哪些
-
CMakeSettings.json
-
CMakeList.txt
-
最简单的测试代码,如果指定路径为"./",则会保存在C:\Users\zhouqinan\AppData\Local\CrashDumps
#include <iostream> #include <string> #include <cstdio> // import breakpad cli #include "client/windows/handler/exception_handler.h" #include <string> #include <locale> #include <codecvt> // convert string to wstring inline std::wstring to_wide_string(const std::string& input) { std::wstring_convert<std::codecvt_utf8<wchar_t>> converter; return converter.from_bytes(input); } template <typename T> class MONI_SP { public: MONI_SP(T* p_in) { p = p_in; }; ~MONI_SP() { delete p; p = nullptr; } private: T* p; }; int buggyFunc() { delete reinterpret_cast<char*>(0xFEE1DEAD); return 0; } int main(int argc, char* argv[]) { std::string str_path = "./"; auto wstr_path = to_wide_string(str_path); auto pHandler = new google_breakpad::ExceptionHandler( wstr_path, /*FilterCallback*/ 0, DumpCallback, /*context*/ 0, true ); MONI_SP<google_breakpad::ExceptionHandler> sp_hander(pHandler); buggyFunc(); return 0; }