def load_boost_pretty_printer(): '''Boost-Pretty-Printer''' boost_pp_path = os.path.join(os.environ["HOME"],".local","share","gdb","Boost-Pretty-Printer") if not os.path.exists(boost_pp_path): return sys.path.insert(1, boost_pp_path) import boost ver_major = 1 ver_minor = 73 print("load boost_pretty_printer -- boost version: {}.{}".format(ver_major,ver_minor)) boost.register_printers(boost_version=(ver_major,ver_minor,0))
self.assertEqual(display_hint, None) def test_duration_not_a_time(self): string, children, display_hint = self.get_printer_result('duration_not_a_time') self.assertEqual(string,'(boost::posix_time::time_duration) not a date time') self.assertEqual(children, None) self.assertEqual(display_hint, None) def test_duration_3600(self): string, children, display_hint = self.get_printer_result('duration_3600') self.assertEqual(string,'(boost::posix_time::time_duration) 1h') self.assertEqual(children, None) self.assertEqual(display_hint, None) # TODO: More intrusive tests: # 1. Non-raw pointers # 2. Custom node traits # TODO: More printers: # 1. Pointer containers # 2. boost 1.65: poly_collection, atomic_shared_ptr, local_shared_ptr # 3. Boost.Lockfree ? # 4. Rest of Boost.Containers? print('*** GDB version:', gdb.VERSION) print('*** Python version: {}.{}.{}'.format(sys.version_info.major, sys.version_info.minor, sys.version_info.micro)) print('*** Boost version: {}.{}.{}'.format(*boost_version)) boost.register_printers(boost_version=boost_version) test_result = run_printer_tests(globals().values()) sys.exit(0 if test_result.wasSuccessful() else 1)
import gdb import sys import os sys.path.insert(1, os.path.expanduser("~") + '/.gdb.d') sys.path.insert(1, os.path.expanduser("~") + '/.gdb.d/Boost-Pretty-Printer') from eigen_printer import register_eigen_printers import boost register_eigen_printers (None) boost.register_printers()
'(boost::posix_time::time_duration) not a date time') self.assertEqual(children, None) self.assertEqual(display_hint, None) def test_duration_3600(self): string, children, display_hint = self.get_printer_result( 'duration_3600') self.assertEqual(string, '(boost::posix_time::time_duration) 1h') self.assertEqual(children, None) self.assertEqual(display_hint, None) # TODO: More intrusive tests: # 1. Non-raw pointers # 2. Custom node traits # TODO: More printers: # 1. Pointer containers # 2. boost 1.65: poly_collection, atomic_shared_ptr, local_shared_ptr # 3. Boost.Lockfree ? # 4. Rest of Boost.Containers? print('*** GDB version:', gdb.VERSION) print('*** Python version: {}.{}.{}'.format(sys.version_info.major, sys.version_info.minor, sys.version_info.micro)) print('*** Boost version: {}.{}.{}'.format(*boost_version)) boost.register_printers(boost_version=boost_version) test_result = run_printer_tests(globals().values()) sys.exit(0 if test_result.wasSuccessful() else 1)