Files
YYCCommonplace/src/ExceptionHelper.hpp
T

45 lines
1.4 KiB
C++
Raw Normal View History

2024-05-23 09:37:41 +08:00
#pragma once
#include "YYCCInternal.hpp"
#if YYCC_OS == YYCC_OS_WINDOWS
2024-06-18 16:03:41 +08:00
/**
* @brief Windows specific unhandled exception processor.
* @details
* This namespace is Windows specific. On other platforms, the whole namespace is unavailable.
*
* This namespace allow user register unhandled exception handler on Windows
* to output error log into \c stderr and log file, and generate coredump if possible.
* This is useful for bug tracing on Windows, especially most Windows user are naive and don't know how to report bug.
*
*/
2024-05-23 09:37:41 +08:00
namespace YYCC::ExceptionHelper {
/**
* @brief Register unhandled exception handler
2024-06-13 11:18:25 +08:00
* @details
* This function will set an internal function as unhandled exception handler on Windows.
*
2024-06-13 11:18:25 +08:00
* When unhandled exception raised,
* That internal function will output error stacktrace in standard output
* and log file (located in temp folder), and also generate a dump file
* in temp folder (for convenient debugging of developer when reporting bugs) if it can.
*
2024-06-13 11:18:25 +08:00
* This function usually is called at the start of program.
2024-05-23 09:37:41 +08:00
*/
void Register();
/**
2024-06-13 11:18:25 +08:00
* @brief Unregister unhandled exception handler
* @details
* The reverse operation of Register().
*
2024-06-13 11:18:25 +08:00
* This function and Register() should always be used as a pair.
* You must call this function if you have called Register() before.
*
2024-06-13 11:18:25 +08:00
* This function usually is called at the end of program.
2024-05-23 09:37:41 +08:00
*/
void Unregister();
}
#endif