跳到主要內容

發表文章

目前顯示的是 10月, 2021的文章

Breakpad on Windows

Breakpad on Windows Exception Handling Windows’ SEH can be handled with compiler extension __try {} __exception() {} or by setting top-level handler via SetUnhandledExceptionFilter() . The latter is tricky since it’s easy to replace a previous registered handler whenever a module or library wants to. Breakpad Breakpad implements ExceptionHandler for Windows. It registers an exception handler that capable of dump minidump to a specified directory. It uses, unfortunately, SetUnhandledExceptionFilter() and potentially fail to capture an exception if another handler was registered after Breakpad. Solution We are left with __try {} __exception() {} as follows. using namespace google_breakpad ; auto handler = ExceptionHandler ( L "dumps" , nullptr , nullptr , nullptr , ExceptionHandler :: HANDLER_NONE ) ; __try { // ... } __except ( ( handler . WriteMinidumpForException ( :: GetExceptionInformation ( ) , EXCEPTION_EXECUTE_HANDLER