mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Send to debugger console by default if running within debugger (only support on Windows at the moment)
This commit is contained in:
parent
62e23ac5a8
commit
8431fa1ec5
@ -137,6 +137,8 @@ namespace Catch
|
||||
)
|
||||
{
|
||||
Config config;
|
||||
if( isDebuggerActive() )
|
||||
config.useStream( "debug" );
|
||||
return Main( argc, argv, config );
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
// The following function is taken directly from the following technical note:
|
||||
// http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html
|
||||
|
||||
inline bool AmIBeingDebugged(void)
|
||||
inline bool isDebuggerActive()
|
||||
// Returns true if the current process is being debugged (either
|
||||
// running under the debugger or has a debugger attached post facto).
|
||||
{
|
||||
@ -74,13 +74,13 @@
|
||||
#ifdef DEBUG
|
||||
#if defined(__ppc64__) || defined(__ppc__)
|
||||
#define BreakIntoDebugger() \
|
||||
if( Catch::AmIBeingDebugged() ) \
|
||||
if( Catch::isDebuggerActive() ) \
|
||||
{ \
|
||||
__asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \
|
||||
: : : "memory","r0","r3","r4" ); \
|
||||
}
|
||||
#else
|
||||
#define BreakIntoDebugger() if( Catch::AmIBeingDebugged() ) {__asm__("int $3\n" : : );}
|
||||
#define BreakIntoDebugger() if( Catch::isDebuggerActive() ) {__asm__("int $3\n" : : );}
|
||||
#endif
|
||||
#else
|
||||
inline void BreakIntoDebugger(){}
|
||||
@ -90,6 +90,10 @@
|
||||
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
|
||||
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA( const char* );
|
||||
#define BreakIntoDebugger() if (IsDebuggerPresent() ) { __debugbreak(); }
|
||||
inline bool isDebuggerActive()
|
||||
{
|
||||
return IsDebuggerPresent();
|
||||
}
|
||||
#else
|
||||
inline void BreakIntoDebugger(){}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user