1# Add this folder to the python sys path; GDB Python-interpreter will now find modules in this path 2import sys 3from os import path 4self_dir = path.dirname(path.realpath(__file__)) 5sys.path.append(self_dir) 6 7# ruff: noqa: E402 8import gdb 9import gdb_lookup 10 11# current_objfile can be none; even with `gdb foo-app`; sourcing this file after gdb init now works 12try: 13 gdb_lookup.register_printers(gdb.current_objfile()) 14except Exception: 15 gdb_lookup.register_printers(gdb.selected_inferior().progspace) 16