Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 1 | // (C) Copyright Gennadiy Rozental 2006-2008. |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | // See http://www.boost.org/libs/test for the library home page. |
| 7 | // |
| 8 | // File : $RCSfile$ |
| 9 | // |
| 10 | // Version : $Revision: 49312 $ |
| 11 | // |
| 12 | // Description : defines portable debug interfaces |
| 13 | // *************************************************************************** |
| 14 | |
| 15 | #ifndef BOOST_TEST_DEBUG_API_HPP_112006GER |
| 16 | #define BOOST_TEST_DEBUG_API_HPP_112006GER |
| 17 | |
| 18 | // Boost.Test |
| 19 | #include <ndnboost/test/detail/config.hpp> |
| 20 | #include <ndnboost/test/utils/callback.hpp> |
| 21 | #include <ndnboost/test/utils/basic_cstring/basic_cstring.hpp> |
| 22 | |
| 23 | // STL |
| 24 | #include <string> |
| 25 | |
| 26 | #include <ndnboost/test/detail/suppress_warnings.hpp> |
| 27 | |
| 28 | //____________________________________________________________________________// |
| 29 | |
| 30 | namespace ndnboost { |
| 31 | |
| 32 | namespace debug { |
| 33 | |
| 34 | // ************************************************************************** // |
| 35 | // ************** check if program is running under debugger ************** // |
| 36 | // ************************************************************************** // |
| 37 | |
| 38 | bool BOOST_TEST_DECL under_debugger(); |
| 39 | |
| 40 | // ************************************************************************** // |
| 41 | // ************** cause program to break execution ************** // |
| 42 | // ************** in debugger at call point ************** // |
| 43 | // ************************************************************************** // |
| 44 | |
| 45 | void BOOST_TEST_DECL debugger_break(); |
| 46 | |
| 47 | // ************************************************************************** // |
| 48 | // ************** gui debugger setup ************** // |
| 49 | // ************************************************************************** // |
| 50 | |
| 51 | struct dbg_startup_info { |
| 52 | long pid; |
| 53 | bool break_or_continue; |
| 54 | unit_test::const_string binary_path; |
| 55 | unit_test::const_string display; |
| 56 | unit_test::const_string init_done_lock; |
| 57 | }; |
| 58 | |
| 59 | typedef unit_test::callback1<dbg_startup_info const&> dbg_starter; |
| 60 | |
| 61 | // ************************************************************************** // |
| 62 | // ************** debugger setup ************** // |
| 63 | // ************************************************************************** // |
| 64 | |
| 65 | #if BOOST_WORKAROUND( BOOST_MSVC, <1300) |
| 66 | |
| 67 | std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id ); |
| 68 | |
| 69 | #else |
| 70 | |
| 71 | std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() ); |
| 72 | |
| 73 | #endif |
| 74 | |
| 75 | |
| 76 | // ************************************************************************** // |
| 77 | // ************** attach debugger to the current process ************** // |
| 78 | // ************************************************************************** // |
| 79 | |
| 80 | bool BOOST_TEST_DECL attach_debugger( bool break_or_continue = true ); |
| 81 | |
| 82 | // ************************************************************************** // |
| 83 | // ************** switch on/off detect memory leaks feature ************** // |
| 84 | // ************************************************************************** // |
| 85 | |
| 86 | void BOOST_TEST_DECL detect_memory_leaks( bool on_off ); |
| 87 | |
| 88 | // ************************************************************************** // |
| 89 | // ************** cause program to break execution in ************** // |
| 90 | // ************** debugger at specific allocation point ************** // |
| 91 | // ************************************************************************** // |
| 92 | |
| 93 | void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num ); |
| 94 | |
| 95 | } // namespace debug |
| 96 | |
| 97 | } // namespace ndnboost |
| 98 | |
| 99 | #include <ndnboost/test/detail/enable_warnings.hpp> |
| 100 | |
| 101 | #endif |