Bug 1564314 - Make linters happy with the gdbpp code. r=nalexander

Differential Revision: https://phabricator.services.mozilla.com/D37676

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-07-11 18:19:44 +00:00
parent f7f0525dc1
commit 5bfb4c9c92
8 changed files with 35 additions and 15 deletions

View File

@ -4,9 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import gdb
import gdb.printing
class GeckoPrettyPrinter(object):
pp = gdb.printing.RegexpCollectionPrettyPrinter('GeckoPrettyPrinters')
@ -18,12 +21,13 @@ class GeckoPrettyPrinter(object):
GeckoPrettyPrinter.pp.add_printer(self.name, self.regexp, wrapped)
return wrapped
import gdbpp.enumset
import gdbpp.linkedlist
import gdbpp.owningthread
import gdbpp.smartptr
import gdbpp.string
import gdbpp.tarray
import gdbpp.thashtable
import gdbpp.enumset # NOQA: F401
import gdbpp.linkedlist # NOQA: F401
import gdbpp.owningthread # NOQA: F401
import gdbpp.smartptr # NOQA: F401
import gdbpp.string # NOQA: F401
import gdbpp.tarray # NOQA: F401
import gdbpp.thashtable # NOQA: F401
gdb.printing.register_pretty_printer(None, GeckoPrettyPrinter.pp)

View File

@ -4,10 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import gdb
import itertools
from gdbpp import GeckoPrettyPrinter
@GeckoPrettyPrinter('mozilla::EnumSet', '^mozilla::EnumSet<.*>$')
class enumset_printer(object):
def __init__(self, value):

View File

@ -4,10 +4,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import gdb
import itertools
from __future__ import absolute_import
from gdbpp import GeckoPrettyPrinter
# mfbt's LinkedList<T> is a doubly-linked list where the items in the list store
# the next/prev pointers as part of themselves rather than the list structure be
# its own independent data structure. This means:

View File

@ -4,9 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import gdb
from gdbpp import GeckoPrettyPrinter
@GeckoPrettyPrinter('nsAutoOwningThread', '^nsAutoOwningThread$')
class owning_thread_printer(object):
def __init__(self, value):

View File

@ -4,9 +4,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import gdb
from __future__ import absolute_import
from gdbpp import GeckoPrettyPrinter
@GeckoPrettyPrinter('nsWeakPtr', '^nsCOMPtr<nsIWeakReference>$')
class weak_ptr_printer(object):
def __init__(self, value):
@ -24,6 +26,7 @@ class weak_ptr_printer(object):
return '[(%s) %s]' % (weak_ptr.dynamic_type, weak_ptr)
@GeckoPrettyPrinter('mozilla::StaticAutoPtr', '^mozilla::StaticAutoPtr<.*>$')
@GeckoPrettyPrinter('mozilla::StaticRefPtr', '^mozilla::StaticRefPtr<.*>$')
@GeckoPrettyPrinter('nsAutoPtr', '^nsAutoPtr<.*>$')
@ -41,6 +44,7 @@ class smartptr_printer(object):
return '[(%s) %s]' % (type_name, str(self.value))
@GeckoPrettyPrinter('UniquePtr', '^mozilla::UniquePtr<.*>$')
class uniqueptr_printer(object):
def __init__(self, value):

View File

@ -4,9 +4,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import gdb
from __future__ import absolute_import
from gdbpp import GeckoPrettyPrinter
@GeckoPrettyPrinter('nsString', '^ns.*String$')
class string_printer(object):
def __init__(self, value):

View File

@ -4,10 +4,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import gdb
import itertools
from __future__ import absolute_import
from gdbpp import GeckoPrettyPrinter
@GeckoPrettyPrinter('InfallibleTArray', '^InfallibleTArray<.*>$')
@GeckoPrettyPrinter('FallibleTArray', '^FallibleTArray<.*>$')
@GeckoPrettyPrinter('AutoTArray', '^AutoTArray<.*>$')

View File

@ -4,10 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import gdb
import itertools
from gdbpp import GeckoPrettyPrinter
def walk_template_to_given_base(value, desired_tag_prefix):
'''Given a value of some template subclass, walk up its ancestry until we
hit the desired type, then return the appropriate value (which will then
@ -38,6 +40,7 @@ def walk_template_to_given_base(value, desired_tag_prefix):
return walk_template_to_given_base(fv, desired_tag_prefix)
return None
# The templates and their inheritance hierarchy form an onion of types around
# the nsTHashtable core at the center. All we care about is that nsTHashtable,
# but we register for the descendant types in order to avoid the default pretty