blob: 5536961c677ff7903a9bdb4b021696a75716d6a3 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// (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 Thompson3d613fd2013-10-15 15:39:04 -070015#ifndef NDNBOOST_TEST_DEBUG_API_HPP_112006GER
16#define NDNBOOST_TEST_DEBUG_API_HPP_112006GER
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070017
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
30namespace ndnboost {
31
32namespace debug {
33
34// ************************************************************************** //
35// ************** check if program is running under debugger ************** //
36// ************************************************************************** //
37
Jeff Thompson3d613fd2013-10-15 15:39:04 -070038bool NDNBOOST_TEST_DECL under_debugger();
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070039
40// ************************************************************************** //
41// ************** cause program to break execution ************** //
42// ************** in debugger at call point ************** //
43// ************************************************************************** //
44
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045void NDNBOOST_TEST_DECL debugger_break();
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070046
47// ************************************************************************** //
48// ************** gui debugger setup ************** //
49// ************************************************************************** //
50
51struct 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
59typedef unit_test::callback1<dbg_startup_info const&> dbg_starter;
60
61// ************************************************************************** //
62// ************** debugger setup ************** //
63// ************************************************************************** //
64
Jeff Thompson3d613fd2013-10-15 15:39:04 -070065#if NDNBOOST_WORKAROUND( NDNBOOST_MSVC, <1300)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070066
Jeff Thompson3d613fd2013-10-15 15:39:04 -070067std::string NDNBOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070068
69#else
70
Jeff Thompson3d613fd2013-10-15 15:39:04 -070071std::string NDNBOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070072
73#endif
74
75
76// ************************************************************************** //
77// ************** attach debugger to the current process ************** //
78// ************************************************************************** //
79
Jeff Thompson3d613fd2013-10-15 15:39:04 -070080bool NDNBOOST_TEST_DECL attach_debugger( bool break_or_continue = true );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070081
82// ************************************************************************** //
83// ************** switch on/off detect memory leaks feature ************** //
84// ************************************************************************** //
85
Jeff Thompson3d613fd2013-10-15 15:39:04 -070086void NDNBOOST_TEST_DECL detect_memory_leaks( bool on_off );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070087
88// ************************************************************************** //
89// ************** cause program to break execution in ************** //
90// ************** debugger at specific allocation point ************** //
91// ************************************************************************** //
92
Jeff Thompson3d613fd2013-10-15 15:39:04 -070093void NDNBOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070094
95} // namespace debug
96
97} // namespace ndnboost
98
99#include <ndnboost/test/detail/enable_warnings.hpp>
100
101#endif