debug.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. // File : $RCSfile$
  8. //
  9. // Version : $Revision: 49312 $
  10. //
  11. // Description : defines portable debug interfaces
  12. // ***************************************************************************
  13. #ifndef BOOST_TEST_DEBUG_API_HPP_112006GER
  14. #define BOOST_TEST_DEBUG_API_HPP_112006GER
  15. // Boost.Test
  16. #include <boost/test/detail/config.hpp>
  17. #include <boost/test/utils/callback.hpp>
  18. #include <boost/test/utils/basic_cstring/basic_cstring.hpp>
  19. // STL
  20. #include <string>
  21. #include <boost/test/detail/suppress_warnings.hpp>
  22. //____________________________________________________________________________//
  23. namespace boost {
  24. namespace debug {
  25. // ************************************************************************** //
  26. // ************** check if program is running under debugger ************** //
  27. // ************************************************************************** //
  28. bool BOOST_TEST_DECL under_debugger();
  29. // ************************************************************************** //
  30. // ************** cause program to break execution ************** //
  31. // ************** in debugger at call point ************** //
  32. // ************************************************************************** //
  33. void BOOST_TEST_DECL debugger_break();
  34. // ************************************************************************** //
  35. // ************** gui debugger setup ************** //
  36. // ************************************************************************** //
  37. struct dbg_startup_info {
  38. long pid;
  39. bool break_or_continue;
  40. unit_test::const_string binary_path;
  41. unit_test::const_string display;
  42. unit_test::const_string init_done_lock;
  43. };
  44. typedef unit_test::callback1<dbg_startup_info const&> dbg_starter;
  45. // ************************************************************************** //
  46. // ************** debugger setup ************** //
  47. // ************************************************************************** //
  48. #if BOOST_WORKAROUND( BOOST_MSVC, <1300)
  49. std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id );
  50. #else
  51. std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() );
  52. #endif
  53. // ************************************************************************** //
  54. // ************** attach debugger to the current process ************** //
  55. // ************************************************************************** //
  56. bool BOOST_TEST_DECL attach_debugger( bool break_or_continue = true );
  57. // ************************************************************************** //
  58. // ************** switch on/off detect memory leaks feature ************** //
  59. // ************************************************************************** //
  60. void BOOST_TEST_DECL detect_memory_leaks( bool on_off );
  61. // ************************************************************************** //
  62. // ************** cause program to break execution in ************** //
  63. // ************** debugger at specific allocation point ************** //
  64. // ************************************************************************** //
  65. void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num );
  66. } // namespace debug
  67. } // namespace boost
  68. #include <boost/test/detail/enable_warnings.hpp>
  69. #endif