]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/callcc/backtrace.cpp
2 // Copyright Oliver Kowalke 2016.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
12 #include <libunwind.h>
14 #include <boost/context/continuation.hpp>
16 namespace ctx
= boost::context
;
20 unw_context_t context
;
21 unw_getcontext( & context
);
22 unw_init_local( & cursor
, & context
);
23 while ( 0 < unw_step( & cursor
) ) {
24 unw_word_t offset
, pc
;
25 unw_get_reg( & cursor
, UNW_REG_IP
, & pc
);
29 std::cout
<< "0x" << pc
<< ":";
32 if ( 0 == unw_get_proc_name( & cursor
, sym
, sizeof( sym
), & offset
) ) {
33 std::cout
<< " (" << sym
<< "+0x" << offset
<< ")" << std::endl
;
35 std::cout
<< " -- error: unable to obtain symbol name for this frame" << std::endl
;
48 ctx::continuation
f1( ctx::continuation
&& c
) {
55 std::cout
<< "main: done" << std::endl
;