iutest  1.17.99.14
iutest_debug.hpp
[詳解]
1 //======================================================================
2 //-----------------------------------------------------------------------
13 //-----------------------------------------------------------------------
14 //======================================================================
15 #ifndef INCG_IRIS_IUTEST_DEBUG_HPP_A63366D4_2112_4269_9BAF_BD30A5F2C7F2_
16 #define INCG_IRIS_IUTEST_DEBUG_HPP_A63366D4_2112_4269_9BAF_BD30A5F2C7F2_
17 
18 #if defined(_IUTEST_DEBUG)
19 // iutest 自体のデバッグ用定義
20 
21 #if defined(_MSC_VER) && !defined(IUTEST_OS_WINDOWS_MOBILE)
22 # include <crtdbg.h>
23 # include <xlocnum>
24 # include <xtree>
25 # include <streambuf>
26 # ifndef _DEBUG_NEW_
27 # define _DEBUG_NEW_ new ( _NORMAL_BLOCK , __FILE__, __LINE__)
28 # pragma push_macro("new")
29 # define new _DEBUG_NEW_
30 # endif
31 #endif
32 
33 #endif
34 
35 namespace iutest {
36 namespace detail
37 {
38 
39 //======================================================================
40 // function
41 static void IUTEST_ATTRIBUTE_UNUSED_ iuDebugInitialize()
42 {
43 #ifdef _IUTEST_DEBUG
44 # if defined(_MSC_VER) && !defined(IUTEST_OS_WINDOWS_MOBILE)
45  _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
46 # endif
47 #endif
48 }
49 
50 static void IUTEST_ATTRIBUTE_UNUSED_ iuDebugBreakAlloc(long n)
51 {
52 #ifdef _IUTEST_DEBUG
53 # if defined(_MSC_VER) && !defined(IUTEST_OS_WINDOWS_MOBILE)
54  _CrtSetBreakAlloc(n);
55 # endif
56 #endif
57  (void)n;
58 }
59 
60 #if defined(_MSC_VER) && IUTEST_HAS_MINIDUMP
61 
65 class MiniDump
66 {
67 private:
68  MiniDump();
69  ~MiniDump();
70 
71  bool Dump(HANDLE hFile, EXCEPTION_POINTERS* ep);
72 public:
76  static bool Create(const char* filepath, EXCEPTION_POINTERS* ep);
77 
78 private:
79  HMODULE m_hModule;
80  FARPROC m_pfnMiniDumpWriteDump;
81 };
82 
83 #endif
84 
85 } // end of namespace detail
86 } // end of namespace iutest
87 
88 #if !IUTEST_HAS_LIB
89 # include "../impl/iutest_debug.ipp" // IWYU pragma: export
90 #endif
91 
92 #endif // INCG_IRIS_IUTEST_DEBUG_HPP_A63366D4_2112_4269_9BAF_BD30A5F2C7F2_
iutest root namespace
Definition: iutest_charcode.hpp:33