autoload.py (1327B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 # You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 # mozilla/autoload.py: Autoload SpiderMonkey pretty-printers. 6 7 print("Loading JavaScript value pretty-printers; see js/src/gdb/README.") 8 print("If they cause trouble, type: disable pretty-printer .* SpiderMonkey") 9 10 import gdb.printing 11 12 import mozilla.ExecutableAllocator 13 14 # Import the pretty-printer modules. As a side effect, loading these 15 # modules registers their printers with mozilla.prettyprinters. 16 import mozilla.GCCellPtr 17 import mozilla.Interpreter 18 import mozilla.IonGraph 19 import mozilla.JSObject 20 import mozilla.jsop 21 import mozilla.JSString 22 import mozilla.JSSymbol 23 import mozilla.jsval 24 import mozilla.prettyprinters 25 import mozilla.PropertyKey 26 import mozilla.Root 27 import mozilla.unwind 28 29 # The user may have personal pretty-printers. Get those, too, if they exist. 30 try: 31 import my_mozilla_printers # NOQA: F401 32 except ImportError: 33 pass 34 35 36 def register(objfile): 37 # Register our pretty-printers with |objfile|. 38 lookup = mozilla.prettyprinters.lookup_for_objfile(objfile) 39 if lookup: 40 gdb.printing.register_pretty_printer(objfile, lookup, replace=True) 41 mozilla.unwind.register_unwinder(objfile)