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 7print("Loading JavaScript value pretty-printers; see js/src/gdb/README.") 8print("If they cause trouble, type: disable pretty-printer .* SpiderMonkey") 9 10import gdb.printing 11import mozilla.prettyprinters 12 13# Import the pretty-printer modules. As a side effect, loading these 14# modules registers their printers with mozilla.prettyprinters. 15import mozilla.GCCellPtr 16import mozilla.ExecutableAllocator 17import mozilla.Interpreter 18import mozilla.IonGraph 19import mozilla.JSObject 20import mozilla.JSString 21import mozilla.JSSymbol 22import mozilla.Root 23import mozilla.PropertyKey 24import mozilla.jsop 25import mozilla.jsval 26import mozilla.unwind 27 28# The user may have personal pretty-printers. Get those, too, if they exist. 29try: 30 import my_mozilla_printers # NOQA: F401 31except ImportError: 32 pass 33 34 35def register(objfile): 36 # Register our pretty-printers with |objfile|. 37 lookup = mozilla.prettyprinters.lookup_for_objfile(objfile) 38 if lookup: 39 gdb.printing.register_pretty_printer(objfile, lookup, replace=True) 40 mozilla.unwind.register_unwinder(objfile) 41