Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:53:00

0001 // Copyright Antony Polukhin, 2016-2025.
0002 //
0003 // Distributed under the Boost Software License, Version 1.0. (See
0004 // accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_STACKTRACE_FRAME_HPP
0008 #define BOOST_STACKTRACE_FRAME_HPP
0009 
0010 #include <boost/config.hpp>
0011 #ifdef BOOST_HAS_PRAGMA_ONCE
0012 #   pragma once
0013 #endif
0014 
0015 #include <iosfwd>
0016 #include <string>
0017 
0018 #include <boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t
0019 
0020 #include <boost/stacktrace/detail/frame_decl.hpp>
0021 #include <boost/stacktrace/detail/push_options.h>
0022 
0023 #if defined(BOOST_MSVC) && (defined(BOOST_STACKTRACE_INTERNAL_BUILD_LIBS) || !defined(BOOST_STACKTRACE_LINK))
0024 extern "C" {
0025 
0026 #if defined(BOOST_STACKTRACE_DYN_LINK)
0027 BOOST_SYMBOL_EXPORT
0028 #elif defined(BOOST_STACKTRACE_LINK)
0029 #else
0030 BOOST_SYMBOL_EXPORT inline
0031 #endif
0032 void* boost_stacktrace_impl_return_nullptr() { return nullptr; }
0033 
0034 }
0035 #endif
0036 
0037 namespace boost { namespace stacktrace {
0038 
0039 /// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe.
0040 constexpr inline bool operator< (const frame& lhs, const frame& rhs) noexcept { return lhs.address() < rhs.address(); }
0041 constexpr inline bool operator> (const frame& lhs, const frame& rhs) noexcept { return rhs < lhs; }
0042 constexpr inline bool operator<=(const frame& lhs, const frame& rhs) noexcept { return !(lhs > rhs); }
0043 constexpr inline bool operator>=(const frame& lhs, const frame& rhs) noexcept { return !(lhs < rhs); }
0044 constexpr inline bool operator==(const frame& lhs, const frame& rhs) noexcept { return lhs.address() == rhs.address(); }
0045 constexpr inline bool operator!=(const frame& lhs, const frame& rhs) noexcept { return !(lhs == rhs); }
0046 
0047 /// Fast hashing support, O(1) complexity; Async-Handler-Safe.
0048 inline std::size_t hash_value(const frame& f) noexcept {
0049     return reinterpret_cast<std::size_t>(f.address());
0050 }
0051 
0052 /// Outputs stacktrace::frame in a human readable format to string; unsafe to use in async handlers.
0053 BOOST_STACKTRACE_FUNCTION std::string to_string(const frame& f);
0054 
0055 /// Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers.
0056 template <class CharT, class TraitsT>
0057 std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const frame& f) {
0058     return os << boost::stacktrace::to_string(f);
0059 }
0060 
0061 }} // namespace boost::stacktrace
0062 
0063 /// @cond
0064 
0065 #include <boost/stacktrace/detail/pop_options.h>
0066 
0067 #ifndef BOOST_STACKTRACE_LINK
0068 #   if defined(BOOST_STACKTRACE_USE_NOOP)
0069 #       include <boost/stacktrace/detail/frame_noop.ipp>
0070 #   elif defined(BOOST_MSVC) || defined(BOOST_STACKTRACE_USE_WINDBG) || defined(BOOST_STACKTRACE_USE_WINDBG_CACHED)
0071 #       include <boost/stacktrace/detail/frame_msvc.ipp>
0072 #   else
0073 #       include <boost/stacktrace/detail/frame_unwind.ipp>
0074 #   endif
0075 #endif
0076 /// @endcond
0077 
0078 
0079 #endif // BOOST_STACKTRACE_FRAME_HPP