You need to call register_libstdcxx_xmethods
manually as mentioned in this thread. The set up is similar to pretty-printers.
More specifically, clone gcc to your home directory, and modify ~/.gdbinit
: (assume your username is j3soon
)
python
import sys
sys.path.insert(0, '/home/j3soon/gcc/libstdc++-v3/python')
# from libstdcxx.v6.printers import register_libstdcxx_printers
# register_libstdcxx_printers(None)
from libstdcxx.v6.xmethods import register_libstdcxx_xmethods
register_libstdcxx_xmethods(None)
end
You may also uncomment the 2 lines above to enable pretty printers. Then, relaunch gdb:
(gdb) info xmethod
Xmethods in global:
libstdc++::shared_ptr
get
operator->
operator*
operator[]
use_count
unique
--Type <RET> for more, q to quit, c to continue without paging--
Note: Don't use -D_GLIBCXX_DEBUG
when compiling. The xmethods seem to fail if the libcxx debug flag is used.