stack_backtrace.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2017 Andrey Semashev
  3. *
  4. * Distributed under the Boost Software License, Version 1.0.
  5. * See http://www.boost.org/LICENSE_1_0.txt
  6. */
  7. #ifndef BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_
  8. #define BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_
  9. #include <boost/winapi/basic_types.hpp>
  10. #include <boost/winapi/config.hpp>
  11. #ifdef BOOST_HAS_PRAGMA_ONCE
  12. #pragma once
  13. #endif
  14. // MinGW does not provide RtlCaptureStackBackTrace
  15. #if !defined( BOOST_WINAPI_IS_MINGW )
  16. // Note: RtlCaptureStackBackTrace is available in WinXP SP1 and later
  17. #if (BOOST_USE_NTDDI_VERSION > BOOST_WINAPI_NTDDI_WINXP)
  18. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  19. // Windows SDK shipped with MSVC 7.1 and 8 does not declare RtlCaptureStackBackTrace in headers but allows to link with it
  20. #if !defined( BOOST_USE_WINDOWS_H ) || (defined(_MSC_VER) && (_MSC_VER+0) < 1500)
  21. extern "C" {
  22. BOOST_SYMBOL_IMPORT boost::winapi::WORD_
  23. BOOST_WINAPI_NTAPI_CC RtlCaptureStackBackTrace(
  24. boost::winapi::DWORD_ FramesToSkip,
  25. boost::winapi::DWORD_ FramesToCapture,
  26. boost::winapi::PVOID_* BackTrace,
  27. boost::winapi::PDWORD_ BackTraceHash);
  28. } // extern "C"
  29. #endif
  30. namespace boost {
  31. namespace winapi {
  32. using ::RtlCaptureStackBackTrace;
  33. }
  34. }
  35. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  36. #endif // (BOOST_USE_NTDDI_VERSION > BOOST_WINAPI_NTDDI_WINXP)
  37. #endif // !defined( BOOST_WINAPI_IS_MINGW )
  38. #endif // BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_