1# 2# Copyright (c) 2025 Mark Johnston <markj@FreeBSD.org> 3# 4# SPDX-License-Identifier: BSD-2-Clause 5# 6 7import importlib 8import os 9import sys 10 11sys.path.append(os.path.join(os.path.dirname(__file__), "gdb")) 12 13modules = [ 14 "acttrace", 15 "freebsd", 16 "pcpu", 17 "vnet" 18] 19 20 21def reload_modules(modules): 22 for mod in modules: 23 if mod in sys.modules: 24 importlib.reload(sys.modules[mod]) 25 else: 26 importlib.import_module(mod) 27 28reload_modules(modules) 29 30 31class reload(gdb.Command): 32 """ 33 Reload the FreeBSD kernel GDB helper scripts. 34 """ 35 def __init__(self): 36 super(reload, self).__init__("kgdb-reload", gdb.COMMAND_USER) 37 38 def invoke(self, arg, from_tty): 39 reload_modules(modules) 40 41 42# Register the reload command with gdb. 43reload() 44