Make CATCH_BREAK_INTO_DEBUGGER be user-configurable

This commit is contained in:
khyperia 2020-01-27 15:43:27 +01:00 committed by Martin Hořeňovský
parent 481f54b357
commit 4a5bc0f39a
2 changed files with 19 additions and 4 deletions

View File

@ -16,6 +16,7 @@
[Windows header clutter](#windows-header-clutter)<br> [Windows header clutter](#windows-header-clutter)<br>
[Enabling stringification](#enabling-stringification)<br> [Enabling stringification](#enabling-stringification)<br>
[Disabling exceptions](#disabling-exceptions)<br> [Disabling exceptions](#disabling-exceptions)<br>
[Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)<br>
Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```). Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```).
@ -257,6 +258,18 @@ namespace Catch {
} }
``` ```
## Overriding Catch's debug break (`-b`)
> [Introduced](https://github.com/catchorg/Catch2/pull/1846) in Catch X.Y.Z.
You can override Catch2's break-into-debugger code by defining the
`CATCH_BREAK_INTO_DEBUGGER()` macro. This can be used if e.g. Catch2 does
not know your platform, or your platform is misdetected.
The macro will be used as is, that is, `CATCH_BREAK_INTO_DEBUGGER();`
must compile and must break into debugger.
--- ---
[Home](Readme.md#top) [Home](Readme.md#top)

View File

@ -48,10 +48,12 @@ namespace Catch {
#define CATCH_TRAP() DebugBreak() #define CATCH_TRAP() DebugBreak()
#endif #endif
#ifdef CATCH_TRAP #ifndef CATCH_BREAK_INTO_DEBUGGER
#define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() #ifdef CATCH_TRAP
#else #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()
#define CATCH_BREAK_INTO_DEBUGGER() []{}() #else
#define CATCH_BREAK_INTO_DEBUGGER() []{}()
#endif
#endif #endif
#endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED #endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED