opnsense-src/sys/tools/kernel-gdb.py
Mark Johnston 090beeed90 gdb: Make development a bit easier
Provide a command which can be used to reload gdb modules.

MFC after:	1 week

(cherry picked from commit d5d47e1e67cdf1707cb460c2722894305f3cb34d)
2025-11-04 12:46:19 +00:00

43 lines
797 B
Python

#
# Copyright (c) 2025 Mark Johnston <markj@FreeBSD.org>
#
# SPDX-License-Identifier: BSD-2-Clause
#
import importlib
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "gdb"))
modules = [
"acttrace",
"freebsd",
"pcpu",
"vnet"
]
def reload_modules(modules):
for mod in modules:
if mod in sys.modules:
importlib.reload(sys.modules[mod])
else:
importlib.import_module(mod)
reload_modules(modules)
class reload(gdb.Command):
"""
Reload the FreeBSD kernel GDB helper scripts.
"""
def __init__(self):
super(reload, self).__init__("kgdb-reload", gdb.COMMAND_USER)
def invoke(self, arg, from_tty):
reload_modules(modules)
# Register the reload command with gdb.
reload()