diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/gdb/mozilla/GCCellPtr.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/gdb/mozilla/GCCellPtr.py')
-rw-r--r-- | js/src/gdb/mozilla/GCCellPtr.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/js/src/gdb/mozilla/GCCellPtr.py b/js/src/gdb/mozilla/GCCellPtr.py new file mode 100644 index 000000000..87dcf73da --- /dev/null +++ b/js/src/gdb/mozilla/GCCellPtr.py @@ -0,0 +1,49 @@ +# Pretty-printers for GCCellPtr values. + +import gdb +import mozilla.prettyprinters + +from mozilla.prettyprinters import pretty_printer + +# Forget any printers from previous loads of this module. +mozilla.prettyprinters.clear_module_printers(__name__) + +# Cache information about the JS::TraceKind type for this objfile. +class GCCellPtrTypeCache(object): + def __init__(self, cache): + self.TraceKind_t = gdb.lookup_type('JS::TraceKind') + + # Build a mapping from TraceKind enum values to the types they denote. + e = gdb.types.make_enum_dict(self.TraceKind_t) + kind_to_type = {} + def kind(k, t): + kind_to_type[e['JS::TraceKind::' + k]] = gdb.lookup_type(t) + kind('Object', 'JSObject') + kind('String', 'JSString') + kind('Symbol', 'JS::Symbol') + kind('Script', 'JSScript') + kind('Shape', 'js::Shape') + kind('ObjectGroup', 'js::ObjectGroup') + kind('BaseShape', 'js::BaseShape') + kind('JitCode', 'js::jit::JitCode') + kind('LazyScript', 'js::LazyScript') + self.kind_to_type = kind_to_type + + self.Null = e['JS::TraceKind::Null'] + self.mask = gdb.parse_and_eval('JS::OutOfLineTraceKindMask') + +@pretty_printer('JS::GCCellPtr') +class GCCellPtr(object): + def __init__(self, value, cache): + self.value = value + if not cache.mod_GCCellPtr: + cache.mod_GCCellPtr = GCCellPtrTypeCache(cache) + self.cache = cache + + def to_string(self): + ptr = self.value['ptr'] + kind = ptr & self.cache.mod_GCCellPtr.mask + if kind == self.cache.mod_GCCellPtr.Null: + return "JS::GCCellPtr(nullptr)" + tipe = self.cache.mod_GCCellPtr.kind_to_type[int(kind)] + return "JS::GCCellPtr(({}*) {})".format(tipe, ptr.cast(self.cache.void_ptr_t)) |