stack_backtrace.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #include <boost/winapi/detail/header.hpp>
  20. // Windows SDK shipped with MSVC 7.1 and 8 does not declare RtlCaptureStackBackTrace in headers but allows to link with it
  21. #if !defined( BOOST_USE_WINDOWS_H ) || (defined(_MSC_VER) && (_MSC_VER+0) < 1500)
  22. extern "C" {
  23. BOOST_WINAPI_IMPORT boost::winapi::WORD_
  24. BOOST_WINAPI_NTAPI_CC RtlCaptureStackBackTrace(
  25. boost::winapi::DWORD_ FramesToSkip,
  26. boost::winapi::DWORD_ FramesToCapture,
  27. boost::winapi::PVOID_* BackTrace,
  28. boost::winapi::PDWORD_ BackTraceHash);
  29. } // extern "C"
  30. #endif
  31. namespace boost {
  32. namespace winapi {
  33. using ::RtlCaptureStackBackTrace;
  34. }
  35. }
  36. #include <boost/winapi/detail/footer.hpp>
  37. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  38. #endif // (BOOST_USE_NTDDI_VERSION > BOOST_WINAPI_NTDDI_WINXP)
  39. #endif // !defined( BOOST_WINAPI_IS_MINGW )
  40. #endif // BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_