18#ifndef CRYPTOPP_TRAP_H
19#define CRYPTOPP_TRAP_H
23#if defined(CRYPTOPP_DEBUG)
26# if defined(UNIX_SIGNALS_AVAILABLE)
28# elif defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(__CYGWIN__)
29 extern "C" __declspec(dllimport)
void __stdcall DebugBreak();
30 extern "C" __declspec(dllimport)
int __stdcall IsDebuggerPresent();
36#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
68# define CRYPTOPP_ASSERT(exp) { ... }
71#if defined(CRYPTOPP_DEBUG)
72# if defined(UNIX_SIGNALS_AVAILABLE) || defined(__CYGWIN__)
73# define CRYPTOPP_ASSERT(exp) { \
75 std::ostringstream oss; \
76 oss << "Assertion failed: " << __FILE__ << "(" \
77 << __LINE__ << "): " << __func__ \
79 std::cout << std::flush; \
80 std::cerr << oss.str(); \
84# elif CRYPTOPP_DEBUG && defined(CRYPTOPP_WIN32_AVAILABLE)
85# define CRYPTOPP_ASSERT(exp) { \
87 std::ostringstream oss; \
88 oss << "Assertion failed: " << __FILE__ << "(" \
89 << __LINE__ << "): " << __FUNCTION__ \
91 std::cout << std::flush; \
92 std::cerr << oss.str(); \
93 if (IsDebuggerPresent()) {DebugBreak();} \
100#ifndef CRYPTOPP_ASSERT
101# define CRYPTOPP_ASSERT(exp) (void)0
104NAMESPACE_BEGIN(CryptoPP)
108#if (CRYPTOPP_DEBUG && defined(UNIX_SIGNALS_AVAILABLE)) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
153#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
154class DebugTrapHandler :
public SignalHandler<SIGTRAP, false> { };
156typedef SignalHandler<SIGTRAP, false> DebugTrapHandler;
Library configuration file.
Utility class for trapping OS signals.