зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1014479: Update js-gdb pretty printers to python3; r=jorendorff
This commit is contained in:
Родитель
73faa4dc74
Коммит
913ef85f15
|
@ -4,6 +4,11 @@ import gdb
|
|||
import mozilla.prettyprinters
|
||||
from mozilla.prettyprinters import pretty_printer, ptr_pretty_printer
|
||||
|
||||
try:
|
||||
chr(10000) # UPPER RIGHT PENCIL
|
||||
except ValueError as exc: # yuck, we are in Python 2.x, so chr() is 8-bit
|
||||
chr = unichr # replace with teh unicodes
|
||||
|
||||
# Forget any printers from previous loads of this module.
|
||||
mozilla.prettyprinters.clear_module_printers(__name__)
|
||||
|
||||
|
@ -43,13 +48,13 @@ class JSStringPtr(Common):
|
|||
chars = d['inlineStorage']
|
||||
else:
|
||||
chars = d['s']['u2']['nonInlineChars']
|
||||
for i in xrange(length):
|
||||
for i in range(length):
|
||||
yield chars[i]
|
||||
|
||||
def to_string(self):
|
||||
s = u''
|
||||
for c in self.jschars():
|
||||
s += unichr(c)
|
||||
s += chr(c)
|
||||
return s
|
||||
|
||||
@ptr_pretty_printer("JSAtom")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# mozilla/autoload.py: Autoload SpiderMonkey pretty-printers.
|
||||
|
||||
print "Loading JavaScript value pretty-printers; see js/src/gdb/README."
|
||||
print "If they cause trouble, type: disable pretty-printer .* SpiderMonkey"
|
||||
print("Loading JavaScript value pretty-printers; see js/src/gdb/README.")
|
||||
print("If they cause trouble, type: disable pretty-printer .* SpiderMonkey")
|
||||
|
||||
import gdb.printing
|
||||
import mozilla.prettyprinters
|
||||
|
|
|
@ -35,8 +35,8 @@ class jsid(object):
|
|||
elif self.concrete_type.code == gdb.TYPE_CODE_INT:
|
||||
return self.value
|
||||
else:
|
||||
raise RuntimeError, ("definition of SpiderMonkey 'jsid' type"
|
||||
"neither struct nor integral type")
|
||||
raise RuntimeError("definition of SpiderMonkey 'jsid' type"
|
||||
"neither struct nor integral type")
|
||||
|
||||
def to_string(self):
|
||||
bits = self.as_bits()
|
||||
|
|
|
@ -167,7 +167,7 @@ class jsvalTypeCache(object):
|
|||
# Let self.magic_names be an array whose i'th element is the name of
|
||||
# the i'th magic value.
|
||||
d = gdb.types.make_enum_dict(gdb.lookup_type('JSWhyMagic'))
|
||||
self.magic_names = range(max(d.itervalues()) + 1)
|
||||
self.magic_names = list(range(max(d.values()) + 1))
|
||||
for (k,v) in d.items(): self.magic_names[v] = k
|
||||
|
||||
# Choose an unboxing scheme for this architecture.
|
||||
|
|
|
@ -16,7 +16,7 @@ import re
|
|||
# object can't carry the 'enabled' flags for two different printers.)
|
||||
def check_for_reused_pretty_printer(fn):
|
||||
if hasattr(fn, 'enabled'):
|
||||
raise RuntimeError, ("pretty-printer function %r registered more than once" % fn)
|
||||
raise RuntimeError("pretty-printer function %r registered more than once" % fn)
|
||||
|
||||
# a dictionary mapping gdb.Type tags to pretty-printer functions.
|
||||
printers_by_tag = {}
|
||||
|
@ -107,7 +107,7 @@ def clear_module_printers(module_name):
|
|||
# should remove. (It's not safe to delete entries from a dictionary
|
||||
# while we're iterating over it.)
|
||||
to_delete = []
|
||||
for (k, v) in d.iteritems():
|
||||
for (k, v) in d.items():
|
||||
if v.__module__ == module_name:
|
||||
to_delete.append(k)
|
||||
remove_from_subprinter_list(v)
|
||||
|
|
Загрузка…
Ссылка в новой задаче