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