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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 15 | #ifndef NDNBOOST_TEST_DEBUG_API_HPP_112006GER |
| 16 | #define NDNBOOST_TEST_DEBUG_API_HPP_112006GER |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 38 | bool NDNBOOST_TEST_DECL under_debugger(); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 39 | |
| 40 | // ************************************************************************** // |
| 41 | // ************** cause program to break execution ************** // |
| 42 | // ************** in debugger at call point ************** // |
| 43 | // ************************************************************************** // |
| 44 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 45 | void NDNBOOST_TEST_DECL debugger_break(); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 65 | #if NDNBOOST_WORKAROUND( NDNBOOST_MSVC, <1300) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 66 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 67 | std::string NDNBOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 68 | |
| 69 | #else |
| 70 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 71 | std::string NDNBOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 72 | |
| 73 | #endif |
| 74 | |
| 75 | |
| 76 | // ************************************************************************** // |
| 77 | // ************** attach debugger to the current process ************** // |
| 78 | // ************************************************************************** // |
| 79 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 80 | bool NDNBOOST_TEST_DECL attach_debugger( bool break_or_continue = true ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 81 | |
| 82 | // ************************************************************************** // |
| 83 | // ************** switch on/off detect memory leaks feature ************** // |
| 84 | // ************************************************************************** // |
| 85 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 86 | void NDNBOOST_TEST_DECL detect_memory_leaks( bool on_off ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 87 | |
| 88 | // ************************************************************************** // |
| 89 | // ************** cause program to break execution in ************** // |
| 90 | // ************** debugger at specific allocation point ************** // |
| 91 | // ************************************************************************** // |
| 92 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 93 | void NDNBOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 94 | |
| 95 | } // namespace debug |
| 96 | |
| 97 | } // namespace ndnboost |
| 98 | |
| 99 | #include <ndnboost/test/detail/enable_warnings.hpp> |
| 100 | |
| 101 | #endif |