Do I have to do something in the debugger plugin or this is just setup related?
No need to change our debugger plugin code. For me, I just comment out one line in my gdb script file.
That problem doesn't occur when using stl pretty printers loaded gdb-init way.
Do you mean the gdbinit script automatically loaded when GDB started? (Disable the "-nx" option).
For me, if I comment the two line in my custom script:
#from libstdcxx.v6.printers import register_libstdcxx_printers
#register_libstdcxx_printers (None)
Then "info pretty-printer" doesn't show stl pretty printer, but if I uncomment two lines, I get the "already registered" issue.
That problem doesn't occur when using stl pretty printers loaded gdb-init way.
Do you mean the gdbinit script automatically loaded when GDB started? (Disable the "-nx" option).
Yes. My gdbinit is as follows:
python
import sys
sys.path.insert(0, sys.path[0] + '/../../gcc-4.8.2/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
And the result originating from 'info pretty-printer' command in gdb:
> info pretty-printer
global pretty-printers:
builtin
mpx_bound128
libstdc++-v6
__gnu_cxx::_Slist_iterator
__gnu_cxx::__7::_Slist_iterator
__gnu_cxx::__7::__normal_iterator
__gnu_cxx::__7::slist
__gnu_cxx::__normal_iterator
__gnu_cxx::slist
__gnu_debug::_Safe_iterator
std::_Deque_const_iterator
std::_Deque_iterator
std::_List_const_iterator
std::_List_iterator
std::_Rb_tree_const_iterator
std::_Rb_tree_iterator
std::__7::_Deque_const_iterator
std::__7::_Deque_iterator
std::__7::_List_const_iterator
std::__7::_List_iterator
std::__7::_Rb_tree_const_iterator
std::__7::_Rb_tree_iterator
std::__7::basic_string
std::__7::bitset
std::__7::deque
std::__7::forward_list
std::__7::list
std::__7::map
std::__7::multimap
std::__7::multiset
std::__7::priority_queue
std::__7::queue
std::__7::set
std::__7::shared_ptr
std::__7::stack
std::__7::tuple
std::__7::unique_ptr
std::__7::unordered_map
std::__7::unordered_multimap
std::__7::unordered_multiset
std::__7::unordered_set
std::__7::vector
std::__7::weak_ptr
std::__cxx1998::_Deque_const_iterator
std::__cxx1998::_Deque_iterator
std::__cxx1998::_List_const_iterator
std::__cxx1998::_List_iterator
std::__cxx1998::__7::_Deque_const_iterator
std::__cxx1998::__7::_Deque_iterator
std::__cxx1998::__7::_List_const_iterator
std::__cxx1998::__7::_List_iterator
std::__cxx1998::__7::bitset
std::__cxx1998::__7::deque
std::__cxx1998::__7::forward_list
std::__cxx1998::__7::list
std::__cxx1998::__7::map
std::__cxx1998::__7::multimap
std::__cxx1998::__7::multiset
std::__cxx1998::__7::set
std::__cxx1998::__7::unordered_map
std::__cxx1998::__7::unordered_multimap
std::__cxx1998::__7::unordered_multiset
std::__cxx1998::__7::unordered_set
std::__cxx1998::__7::vector
std::__cxx1998::bitset
std::__cxx1998::deque
std::__cxx1998::forward_list
std::__cxx1998::list
std::__cxx1998::map
std::__cxx1998::multimap
std::__cxx1998::multiset
std::__cxx1998::set
std::__cxx1998::unordered_map
std::__cxx1998::unordered_multimap
std::__cxx1998::unordered_multiset
std::__cxx1998::unordered_set
std::__cxx1998::vector
std::__debug::bitset
std::__debug::deque
std::__debug::forward_list
std::__debug::list
std::__debug::map
std::__debug::multimap
std::__debug::multiset
std::__debug::priority_queue
std::__debug::queue
std::__debug::set
std::__debug::stack
std::__debug::unique_ptr
std::__debug::unordered_map
std::__debug::unordered_multimap
std::__debug::unordered_multiset
std::__debug::unordered_set
std::__debug::vector
std::__norm::_Deque_const_iterator
std::__norm::_Deque_iterator
std::__norm::_List_const_iterator
std::__norm::_List_iterator
std::basic_string
std::bitset
std::deque
std::forward_list
std::list
std::map
std::multimap
std::multiset
std::priority_queue
std::queue
std::set
std::shared_ptr
std::stack
std::tr1::__7::shared_ptr
std::tr1::__7::unordered_map
std::tr1::__7::unordered_multimap
std::tr1::__7::unordered_multiset
std::tr1::__7::unordered_set
std::tr1::__7::weak_ptr
std::tr1::shared_ptr
std::tr1::unordered_map
std::tr1::unordered_multimap
std::tr1::unordered_multiset
std::tr1::unordered_set
std::tr1::weak_ptr
std::tuple
std::unique_ptr
std::unordered_map
std::unordered_multimap
std::unordered_multiset
std::unordered_set
std::vector
std::weak_ptr
I'm using http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/ (http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/) btw.
Did you check the code: libstdcxx\v6\__init__.py
Mine is:
# Copyright (C) 2014-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import gdb
# Load the pretty-printers.
from printers import register_libstdcxx_printers
register_libstdcxx_printers(gdb.current_objfile())
# Load the xmethods if GDB supports them.
def gdb_has_xmethods():
try:
import gdb.xmethod
return True
except ImportError:
return False
if gdb_has_xmethods():
from xmethods import register_libstdcxx_xmethods
register_libstdcxx_xmethods(gdb.current_objfile())
Look, it did have
# Load the pretty-printers.
from printers import register_libstdcxx_printers
register_libstdcxx_printers(gdb.current_objfile())
so, I think it will be registered here.
I believe your "__init__.py" don't have such code(I checked my old "__init__.py" from gcc 4.7.4, the file is empty). ;)