# to pythondir, and then we want to apply that relative path to the # directory holding the objfile with which this file is associated. # This preserves relocatability of the gcc tree. # Do a simple normalization that removes duplicate separators. pythondir = os.path.normpath (pythondir) libdir = os.path.normpath (libdir) prefix = os.path.commonprefix ([libdir, pythondir]) # In some bizarre configuration we might have found a match in the # middle of a directory name. if prefix[-1] != '/': prefix = os.path.dirname (prefix) + '/' # Strip off the prefix. pythondir = pythondir[len (prefix):] libdir = libdir[len (prefix):] # Compute the ".."s needed to get from libdir to the prefix. dotdots = ('..' + os.sep) * len (libdir.split (os.sep)) objfile = gdb.current_objfile ().filename dir_ = os.path.join (os.path.dirname (objfile), dotdots, pythondir) if not dir_ in sys.path: sys.path.insert(0, dir_) # Load the pretty-printers. from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (gdb.current_objfile ())
StdDequeIteratorPrinter) libstdcxx_printer.add_container('std::', '_Deque_const_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add_version('__gnu_cxx::', '__normal_iterator', StdVectorIteratorPrinter) libstdcxx_printer.add_version('__gnu_cxx::', '_Slist_iterator', StdSlistIteratorPrinter) # Debug (compiled with -D_GLIBCXX_DEBUG) printer # registrations. The Rb_tree debug iterator when unwrapped # from the encapsulating __gnu_debug::_Safe_iterator does not # have the __norm namespace. Just use the existing printer # registration for that. libstdcxx_printer.add('__gnu_debug::_Safe_iterator', StdDebugIteratorPrinter) libstdcxx_printer.add('std::__norm::_List_iterator', StdListIteratorPrinter) libstdcxx_printer.add('std::__norm::_List_const_iterator', StdListIteratorPrinter) libstdcxx_printer.add('std::__norm::_Deque_const_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add('std::__norm::_Deque_iterator', StdDequeIteratorPrinter) build_libstdcxx_dictionary() sys.path.insert(0, os.path.expanduser("~") + '/.gdb_printers/stdcxx') from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers(None)
# to pythondir, and then we want to apply that relative path to the # directory holding the objfile with which this file is associated. # This preserves relocatability of the gcc tree. # Do a simple normalization that removes duplicate separators. pythondir = os.path.normpath(pythondir) libdir = os.path.normpath(libdir) prefix = os.path.commonprefix([libdir, pythondir]) # In some bizarre configuration we might have found a match in the # middle of a directory name. if prefix[-1] != '/': prefix = os.path.dirname(prefix) + '/' # Strip off the prefix. pythondir = pythondir[len(prefix):] libdir = libdir[len(prefix):] # Compute the ".."s needed to get from libdir to the prefix. dotdots = ('..' + os.sep) * len(libdir.split(os.sep)) objfile = gdb.current_objfile().filename dir_ = os.path.join(os.path.dirname(objfile), dotdots, pythondir) if not dir_ in sys.path: sys.path.insert(0, dir_) # Load the pretty-printers. from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers(gdb.current_objfile())
libstdcxx_printer.add_container('std::', '_Deque_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add_container('std::', '_Deque_const_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add_version('__gnu_cxx::', '__normal_iterator', StdVectorIteratorPrinter) libstdcxx_printer.add_version('__gnu_cxx::', '_Slist_iterator', StdSlistIteratorPrinter) # Debug (compiled with -D_GLIBCXX_DEBUG) printer # registrations. The Rb_tree debug iterator when unwrapped # from the encapsulating __gnu_debug::_Safe_iterator does not # have the __norm namespace. Just use the existing printer # registration for that. libstdcxx_printer.add('__gnu_debug::_Safe_iterator', StdDebugIteratorPrinter) libstdcxx_printer.add('std::__norm::_List_iterator', StdListIteratorPrinter) libstdcxx_printer.add('std::__norm::_List_const_iterator', StdListIteratorPrinter) libstdcxx_printer.add('std::__norm::_Deque_const_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add('std::__norm::_Deque_iterator', StdDequeIteratorPrinter) build_libstdcxx_dictionary () sys.path.insert(0, os.path.expanduser("~") + '/.gdb_printers/stdcxx') from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None)