ruediger / Boost-Pretty-Printer

GDB Pretty Printers for Boost
197 stars 61 forks source link

error for shared pointer in boost::program_options::options_description #39

Closed phcerdan closed 5 years ago

phcerdan commented 5 years ago
warning: RTTI symbol not found for class 'boost::detail::sp_counted_impl_p<boost::program_options::option_description>'
Traceback (most recent call last):
  File "~/.gdb/Boost-Pretty-Printer/boost/printers.py", line 222, in to_string
    self.value['px'])
gdb.error: Cannot convert value to long.

Boost-Pretty-Printer/boost/printers.py:222

@add_printer
class BoostSharedPtr:
    "Pretty Printer for boost::shared/weak_ptr/array (Boost.SmartPtr)"
    printer_name = 'boost::shared/weak_ptr/array'
    version = '1.40'
    template_name = ['boost::shared_array', 'boost::shared_ptr',
                     'boost::weak_array', 'boost::weak_ptr']

    def __init__(self, value):
        self.typename = value.type_name
        self.value = value

    def to_string(self):
        if self.value['px'] == 0x0:
            return '(%s) %s' % (self.typename, self.value['px'])
        countobj = self.value['pn']['pi_'].dereference()
        refcount = countobj['use_count_']
        weakcount = countobj['weak_count_']
        return '(%s) (count %d, weak count %d) %s' % (self.typename,
                                                      refcount, weakcount,
                                                      self.value['px']) # <- line 222
phcerdan commented 5 years ago

Nevermind, I was using an unmaintained fork...