Backed out changeset e50e7d030a33 (bug 1180985)

This commit is contained in:
Carsten "Tomcat" Book 2015-07-29 15:26:12 +02:00
Родитель 68b080c7c5
Коммит 2b2184326d
6 изменённых файлов: 4 добавлений и 89 удалений

Просмотреть файл

@ -9,7 +9,6 @@ GeckoProgram('gdb-tests', linkage=None)
UNIFIED_SOURCES += [
'gdb-tests.cpp',
'tests/test-asmjs.cpp',
'tests/test-GCCellPtr.cpp',
'tests/test-Interpreter.cpp',
'tests/test-jsid.cpp',
'tests/test-JSObject.cpp',

Просмотреть файл

@ -1,49 +0,0 @@
# 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))

Просмотреть файл

@ -8,14 +8,13 @@ import mozilla.prettyprinters
# Import the pretty-printer modules. As a side effect, loading these
# modules registers their printers with mozilla.prettyprinters.
import mozilla.GCCellPtr
import mozilla.Interpreter
import mozilla.jsid
import mozilla.JSObject
import mozilla.JSString
import mozilla.JSSymbol
import mozilla.Root
import mozilla.jsid
import mozilla.jsval
import mozilla.Root
# The user may have personal pretty-printers. Get those, too, if they exist.
try:

Просмотреть файл

@ -179,11 +179,10 @@ class TypeCache(object):
except gdb.error:
raise NotSpiderMonkeyObjfileError
self.mod_GCCellPtr = None
self.mod_Interpreter = None
self.mod_JSObject = None
self.mod_JSString = None
self.mod_JSObject = None
self.mod_jsval = None
self.mod_Interpreter = None
# Yield a series of all the types that |t| implements, by following typedefs
# and iterating over base classes. Specifically:

Просмотреть файл

@ -1,23 +0,0 @@
#include "gdb-tests.h"
#include "jsapi.h"
#include "js/HeapAPI.h"
FRAGMENT(GCCellPtr, simple) {
JS::GCCellPtr nulll(nullptr);
JS::Rooted<JSObject*> glob(cx, JS::CurrentGlobalOrNull(cx));
JS::Rooted<JSString*> empty(cx, JS_NewStringCopyN(cx, nullptr, 0));
JS::Rooted<Symbol*> unique(cx, NewSymbol(cx, nullptr));
JS::GCCellPtr object(glob.get());
JS::GCCellPtr string(empty.get());
JS::GCCellPtr symbol(unique.get());
breakpoint();
(void) nulll;
(void) object;
(void) string;
(void) symbol;
}

Просмотреть файл

@ -1,10 +0,0 @@
# Tests for GCCellPtr pretty-printing
assert_subprinter_registered('SpiderMonkey', 'JS::GCCellPtr')
run_fragment('GCCellPtr.simple')
assert_pretty('nulll', 'JS::GCCellPtr(nullptr)')
assert_pretty('object', 'JS::GCCellPtr((JSObject*) )')
assert_pretty('string', 'JS::GCCellPtr((JSString*) )')
assert_pretty('symbol', 'JS::GCCellPtr((JS::Symbol*) )')