mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Renamed DebugBreak to avoid collision and implemented in terms of __debugbreak() on Windows
This commit is contained in:
parent
7d65a8c612
commit
dea778138e
@ -443,7 +443,7 @@ inline bool isTrue
|
||||
#define INTERNAL_CATCH_ACCEPT_RESULT( result, stopOnFailure ) \
|
||||
if( Catch::ResultAction::Value action = Catch::Hub::getResultCapture().acceptResult( result ) ) \
|
||||
{ \
|
||||
if( action == Catch::ResultAction::DebugFailed ) DebugBreak(); \
|
||||
if( action == Catch::ResultAction::DebugFailed ) BreakIntoDebugger(); \
|
||||
if( Catch::isTrue( stopOnFailure ) ) throw Catch::TestFailureException(); \
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,7 @@
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Provides a DebugBreak() macro for platforms other than Windows
|
||||
* (currently only Macs are supported)
|
||||
* Provides a BreakIntoDebugger() macro for Windows and Mac (so far)
|
||||
*/
|
||||
|
||||
#ifndef TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED
|
||||
@ -68,21 +67,22 @@
|
||||
// http://cocoawithlove.com/2008/03/break-into-debugger.html
|
||||
#ifdef DEBUG
|
||||
#if defined(__ppc64__) || defined(__ppc__)
|
||||
#define DebugBreak() \
|
||||
#define BreakIntoDebugger() \
|
||||
if( Catch::AmIBeingDebugged() ) \
|
||||
{ \
|
||||
__asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \
|
||||
: : : "memory","r0","r3","r4" ); \
|
||||
}
|
||||
#else
|
||||
#define DebugBreak() if( Catch::AmIBeingDebugged() ) {__asm__("int $3\n" : : );}
|
||||
#define BreakIntoDebugger() if( Catch::AmIBeingDebugged() ) {__asm__("int $3\n" : : );}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef DebugBreak
|
||||
inline void DebugBreak(){}
|
||||
#elif defined(__WIN32__) && defined(_MSC_VER)
|
||||
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
|
||||
#define BreakIntoDebugger() if (IsDebuggerPresent() ) { __debugbreak(); }
|
||||
#else
|
||||
inline void BreakIntoDebugger(){}
|
||||
#endif
|
||||
|
||||
inline void writeToDebugConsole( const std::string& text )
|
||||
|
Loading…
Reference in New Issue
Block a user