File tree Expand file tree Collapse file tree
include/boost/stacktrace/detail Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111#include < cstdlib> // std::exit
1212
1313void print_signal_handler_and_exit () {
14- void * p = reinterpret_cast <void *>(::signal (SIGSEGV, SIG_DFL));
15- boost::stacktrace::frame f (p);
14+ typedef void (*function_t )(int );
15+
16+ function_t old_signal_function = ::signal (SIGSEGV, SIG_DFL);
17+ boost::stacktrace::frame f (old_signal_function);
1618 std::cout << f << std::endl;
1719 std::exit (0 );
1820}
Original file line number Diff line number Diff line change 1818#include < boost/core/explicit_operator_bool.hpp>
1919
2020#include < boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t
21+ #include < boost/stacktrace/detail/void_ptr_cast.hpp>
2122
2223#include < boost/stacktrace/detail/push_options.pp>
2324
@@ -82,6 +83,17 @@ class frame {
8283 : addr_(addr)
8384 {}
8485
86+ // / @brief Constructs frame that references function_addr and could later generate information about that function using platform specific features.
87+ // /
88+ // / @b Complexity: O(1).
89+ // /
90+ // / @b Async-Handler-Safety: Safe.
91+ // / @throws Nothing.
92+ template <class T >
93+ explicit frame (T* function_addr) BOOST_NOEXCEPT
94+ : addr_(boost::stacktrace::detail::void_ptr_cast<native_frame_ptr_t >(function_addr))
95+ {}
96+
8597 // / @returns Name of the frame (function name in a human readable form).
8698 // /
8799 // / @b Complexity: unknown (lots of platform specific work).
You can’t perform that action at this time.
0 commit comments